Add migration for products and products_options tables with associated constraints and enums
- Created a new migration file to define the structure for the products and products_options tables. - Added necessary columns, data types, and constraints including foreign keys and enums for product attributes. - Updated the migrations index to include the new migration for tracking purposes.
This commit is contained in:
parent
f864f85a18
commit
1d789ecb17
2558
apps/web/src/migrations/20260403_000849.json
Normal file
2558
apps/web/src/migrations/20260403_000849.json
Normal file
File diff suppressed because it is too large
Load Diff
338
apps/web/src/migrations/20260403_000849.ts
Normal file
338
apps/web/src/migrations/20260403_000849.ts
Normal file
@ -0,0 +1,338 @@
|
|||||||
|
import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres'
|
||||||
|
|
||||||
|
export async function up({ db, payload, req }: MigrateUpArgs): Promise<void> {
|
||||||
|
await db.execute(sql`
|
||||||
|
CREATE TYPE "public"."enum_products_brand" AS ENUM('KASKI', 'ALAVUS', 'SWEDOOR', 'JELD-WEN', 'MATTIOVI', 'ABLOY');
|
||||||
|
CREATE TYPE "public"."enum_products_availability" AS ENUM('in-stock', 'made-to-order', 'coming-soon');
|
||||||
|
CREATE TYPE "public"."enum_products_orientation" AS ENUM('left', 'right', 'universal');
|
||||||
|
CREATE TYPE "public"."enum_orders_status" AS ENUM('new', 'in-progress', 'completed', 'cancelled');
|
||||||
|
CREATE TABLE "products_options" (
|
||||||
|
"_order" integer NOT NULL,
|
||||||
|
"_parent_id" integer NOT NULL,
|
||||||
|
"id" varchar PRIMARY KEY NOT NULL,
|
||||||
|
"name" varchar NOT NULL,
|
||||||
|
"price_modifier" numeric NOT NULL,
|
||||||
|
"description" varchar
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE "products" (
|
||||||
|
"id" serial PRIMARY KEY NOT NULL,
|
||||||
|
"name" varchar NOT NULL,
|
||||||
|
"slug" varchar NOT NULL,
|
||||||
|
"article_number" varchar NOT NULL,
|
||||||
|
"brand" "enum_products_brand" NOT NULL,
|
||||||
|
"producer" varchar,
|
||||||
|
"category_id" integer,
|
||||||
|
"price" numeric NOT NULL,
|
||||||
|
"discount_price" numeric,
|
||||||
|
"discount_percent" numeric,
|
||||||
|
"availability" "enum_products_availability" DEFAULT 'in-stock' NOT NULL,
|
||||||
|
"width" numeric,
|
||||||
|
"height" numeric,
|
||||||
|
"material" varchar,
|
||||||
|
"color" varchar,
|
||||||
|
"glass_type" varchar,
|
||||||
|
"orientation" "enum_products_orientation",
|
||||||
|
"frost_resistance" numeric DEFAULT 0,
|
||||||
|
"size_options" jsonb,
|
||||||
|
"variants" jsonb,
|
||||||
|
"short_description" varchar,
|
||||||
|
"technical_specs" varchar,
|
||||||
|
"seo_meta_title" varchar,
|
||||||
|
"seo_meta_description" varchar,
|
||||||
|
"seo_og_image_id" integer,
|
||||||
|
"updated_at" timestamp(3) with time zone DEFAULT now() NOT NULL,
|
||||||
|
"created_at" timestamp(3) with time zone DEFAULT now() NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE "products_rels" (
|
||||||
|
"id" serial PRIMARY KEY NOT NULL,
|
||||||
|
"order" integer,
|
||||||
|
"parent_id" integer NOT NULL,
|
||||||
|
"path" varchar NOT NULL,
|
||||||
|
"media_id" integer,
|
||||||
|
"products_id" integer
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE "categories" (
|
||||||
|
"id" serial PRIMARY KEY NOT NULL,
|
||||||
|
"name" varchar NOT NULL,
|
||||||
|
"slug" varchar NOT NULL,
|
||||||
|
"parent_id" integer,
|
||||||
|
"description" jsonb,
|
||||||
|
"image_id" integer,
|
||||||
|
"updated_at" timestamp(3) with time zone DEFAULT now() NOT NULL,
|
||||||
|
"created_at" timestamp(3) with time zone DEFAULT now() NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE "orders_items" (
|
||||||
|
"_order" integer NOT NULL,
|
||||||
|
"_parent_id" integer NOT NULL,
|
||||||
|
"id" varchar PRIMARY KEY NOT NULL,
|
||||||
|
"product_id" integer NOT NULL,
|
||||||
|
"quantity" numeric DEFAULT 1 NOT NULL,
|
||||||
|
"price_at_order" numeric NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE "orders" (
|
||||||
|
"id" serial PRIMARY KEY NOT NULL,
|
||||||
|
"order_number" numeric,
|
||||||
|
"customer_name" varchar NOT NULL,
|
||||||
|
"customer_phone" varchar NOT NULL,
|
||||||
|
"customer_email" varchar,
|
||||||
|
"customer_comment" varchar,
|
||||||
|
"status" "enum_orders_status" DEFAULT 'new' NOT NULL,
|
||||||
|
"updated_at" timestamp(3) with time zone DEFAULT now() NOT NULL,
|
||||||
|
"created_at" timestamp(3) with time zone DEFAULT now() NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE "pages" (
|
||||||
|
"id" serial PRIMARY KEY NOT NULL,
|
||||||
|
"title" varchar NOT NULL,
|
||||||
|
"slug" varchar NOT NULL,
|
||||||
|
"content" jsonb,
|
||||||
|
"seo_meta_title" varchar,
|
||||||
|
"seo_meta_description" varchar,
|
||||||
|
"seo_og_image_id" integer,
|
||||||
|
"updated_at" timestamp(3) with time zone DEFAULT now() NOT NULL,
|
||||||
|
"created_at" timestamp(3) with time zone DEFAULT now() NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE "media" (
|
||||||
|
"id" serial PRIMARY KEY NOT NULL,
|
||||||
|
"alt" varchar NOT NULL,
|
||||||
|
"updated_at" timestamp(3) with time zone DEFAULT now() NOT NULL,
|
||||||
|
"created_at" timestamp(3) with time zone DEFAULT now() NOT NULL,
|
||||||
|
"url" varchar,
|
||||||
|
"thumbnail_u_r_l" varchar,
|
||||||
|
"filename" varchar,
|
||||||
|
"mime_type" varchar,
|
||||||
|
"filesize" numeric,
|
||||||
|
"width" numeric,
|
||||||
|
"height" numeric,
|
||||||
|
"focal_x" numeric,
|
||||||
|
"focal_y" numeric,
|
||||||
|
"sizes_thumbnail_url" varchar,
|
||||||
|
"sizes_thumbnail_width" numeric,
|
||||||
|
"sizes_thumbnail_height" numeric,
|
||||||
|
"sizes_thumbnail_mime_type" varchar,
|
||||||
|
"sizes_thumbnail_filesize" numeric,
|
||||||
|
"sizes_thumbnail_filename" varchar,
|
||||||
|
"sizes_card_url" varchar,
|
||||||
|
"sizes_card_width" numeric,
|
||||||
|
"sizes_card_height" numeric,
|
||||||
|
"sizes_card_mime_type" varchar,
|
||||||
|
"sizes_card_filesize" numeric,
|
||||||
|
"sizes_card_filename" varchar,
|
||||||
|
"sizes_hero_url" varchar,
|
||||||
|
"sizes_hero_width" numeric,
|
||||||
|
"sizes_hero_height" numeric,
|
||||||
|
"sizes_hero_mime_type" varchar,
|
||||||
|
"sizes_hero_filesize" numeric,
|
||||||
|
"sizes_hero_filename" varchar
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE "users_sessions" (
|
||||||
|
"_order" integer NOT NULL,
|
||||||
|
"_parent_id" integer NOT NULL,
|
||||||
|
"id" varchar PRIMARY KEY NOT NULL,
|
||||||
|
"created_at" timestamp(3) with time zone,
|
||||||
|
"expires_at" timestamp(3) with time zone NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE "users" (
|
||||||
|
"id" serial PRIMARY KEY NOT NULL,
|
||||||
|
"name" varchar,
|
||||||
|
"updated_at" timestamp(3) with time zone DEFAULT now() NOT NULL,
|
||||||
|
"created_at" timestamp(3) with time zone DEFAULT now() NOT NULL,
|
||||||
|
"email" varchar NOT NULL,
|
||||||
|
"reset_password_token" varchar,
|
||||||
|
"reset_password_expiration" timestamp(3) with time zone,
|
||||||
|
"salt" varchar,
|
||||||
|
"hash" varchar,
|
||||||
|
"login_attempts" numeric DEFAULT 0,
|
||||||
|
"lock_until" timestamp(3) with time zone
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE "payload_kv" (
|
||||||
|
"id" serial PRIMARY KEY NOT NULL,
|
||||||
|
"key" varchar NOT NULL,
|
||||||
|
"data" jsonb NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE "payload_locked_documents" (
|
||||||
|
"id" serial PRIMARY KEY NOT NULL,
|
||||||
|
"global_slug" varchar,
|
||||||
|
"updated_at" timestamp(3) with time zone DEFAULT now() NOT NULL,
|
||||||
|
"created_at" timestamp(3) with time zone DEFAULT now() NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE "payload_locked_documents_rels" (
|
||||||
|
"id" serial PRIMARY KEY NOT NULL,
|
||||||
|
"order" integer,
|
||||||
|
"parent_id" integer NOT NULL,
|
||||||
|
"path" varchar NOT NULL,
|
||||||
|
"products_id" integer,
|
||||||
|
"categories_id" integer,
|
||||||
|
"orders_id" integer,
|
||||||
|
"pages_id" integer,
|
||||||
|
"media_id" integer,
|
||||||
|
"users_id" integer
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE "payload_preferences" (
|
||||||
|
"id" serial PRIMARY KEY NOT NULL,
|
||||||
|
"key" varchar,
|
||||||
|
"value" jsonb,
|
||||||
|
"updated_at" timestamp(3) with time zone DEFAULT now() NOT NULL,
|
||||||
|
"created_at" timestamp(3) with time zone DEFAULT now() NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE "payload_preferences_rels" (
|
||||||
|
"id" serial PRIMARY KEY NOT NULL,
|
||||||
|
"order" integer,
|
||||||
|
"parent_id" integer NOT NULL,
|
||||||
|
"path" varchar NOT NULL,
|
||||||
|
"users_id" integer
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE "payload_migrations" (
|
||||||
|
"id" serial PRIMARY KEY NOT NULL,
|
||||||
|
"name" varchar,
|
||||||
|
"batch" numeric,
|
||||||
|
"updated_at" timestamp(3) with time zone DEFAULT now() NOT NULL,
|
||||||
|
"created_at" timestamp(3) with time zone DEFAULT now() NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE "site_settings_social_links" (
|
||||||
|
"_order" integer NOT NULL,
|
||||||
|
"_parent_id" integer NOT NULL,
|
||||||
|
"id" varchar PRIMARY KEY NOT NULL,
|
||||||
|
"platform" varchar NOT NULL,
|
||||||
|
"url" varchar NOT NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE "site_settings" (
|
||||||
|
"id" serial PRIMARY KEY NOT NULL,
|
||||||
|
"phone" varchar DEFAULT '+7 495 718 1212',
|
||||||
|
"whatsapp" varchar DEFAULT '+7 985 1232828',
|
||||||
|
"telegram" varchar,
|
||||||
|
"email" varchar DEFAULT 'adv@advdoors.ru',
|
||||||
|
"address" varchar,
|
||||||
|
"working_hours" varchar,
|
||||||
|
"footer_text" varchar DEFAULT '© 1994-2026 АДВ Двери: Финские двери.',
|
||||||
|
"updated_at" timestamp(3) with time zone,
|
||||||
|
"created_at" timestamp(3) with time zone
|
||||||
|
);
|
||||||
|
|
||||||
|
ALTER TABLE "products_options" ADD CONSTRAINT "products_options_parent_id_fk" FOREIGN KEY ("_parent_id") REFERENCES "public"."products"("id") ON DELETE cascade ON UPDATE no action;
|
||||||
|
ALTER TABLE "products" ADD CONSTRAINT "products_category_id_categories_id_fk" FOREIGN KEY ("category_id") REFERENCES "public"."categories"("id") ON DELETE set null ON UPDATE no action;
|
||||||
|
ALTER TABLE "products" ADD CONSTRAINT "products_seo_og_image_id_media_id_fk" FOREIGN KEY ("seo_og_image_id") REFERENCES "public"."media"("id") ON DELETE set null ON UPDATE no action;
|
||||||
|
ALTER TABLE "products_rels" ADD CONSTRAINT "products_rels_parent_fk" FOREIGN KEY ("parent_id") REFERENCES "public"."products"("id") ON DELETE cascade ON UPDATE no action;
|
||||||
|
ALTER TABLE "products_rels" ADD CONSTRAINT "products_rels_media_fk" FOREIGN KEY ("media_id") REFERENCES "public"."media"("id") ON DELETE cascade ON UPDATE no action;
|
||||||
|
ALTER TABLE "products_rels" ADD CONSTRAINT "products_rels_products_fk" FOREIGN KEY ("products_id") REFERENCES "public"."products"("id") ON DELETE cascade ON UPDATE no action;
|
||||||
|
ALTER TABLE "categories" ADD CONSTRAINT "categories_parent_id_categories_id_fk" FOREIGN KEY ("parent_id") REFERENCES "public"."categories"("id") ON DELETE set null ON UPDATE no action;
|
||||||
|
ALTER TABLE "categories" ADD CONSTRAINT "categories_image_id_media_id_fk" FOREIGN KEY ("image_id") REFERENCES "public"."media"("id") ON DELETE set null ON UPDATE no action;
|
||||||
|
ALTER TABLE "orders_items" ADD CONSTRAINT "orders_items_product_id_products_id_fk" FOREIGN KEY ("product_id") REFERENCES "public"."products"("id") ON DELETE set null ON UPDATE no action;
|
||||||
|
ALTER TABLE "orders_items" ADD CONSTRAINT "orders_items_parent_id_fk" FOREIGN KEY ("_parent_id") REFERENCES "public"."orders"("id") ON DELETE cascade ON UPDATE no action;
|
||||||
|
ALTER TABLE "pages" ADD CONSTRAINT "pages_seo_og_image_id_media_id_fk" FOREIGN KEY ("seo_og_image_id") REFERENCES "public"."media"("id") ON DELETE set null ON UPDATE no action;
|
||||||
|
ALTER TABLE "users_sessions" ADD CONSTRAINT "users_sessions_parent_id_fk" FOREIGN KEY ("_parent_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;
|
||||||
|
ALTER TABLE "payload_locked_documents_rels" ADD CONSTRAINT "payload_locked_documents_rels_parent_fk" FOREIGN KEY ("parent_id") REFERENCES "public"."payload_locked_documents"("id") ON DELETE cascade ON UPDATE no action;
|
||||||
|
ALTER TABLE "payload_locked_documents_rels" ADD CONSTRAINT "payload_locked_documents_rels_products_fk" FOREIGN KEY ("products_id") REFERENCES "public"."products"("id") ON DELETE cascade ON UPDATE no action;
|
||||||
|
ALTER TABLE "payload_locked_documents_rels" ADD CONSTRAINT "payload_locked_documents_rels_categories_fk" FOREIGN KEY ("categories_id") REFERENCES "public"."categories"("id") ON DELETE cascade ON UPDATE no action;
|
||||||
|
ALTER TABLE "payload_locked_documents_rels" ADD CONSTRAINT "payload_locked_documents_rels_orders_fk" FOREIGN KEY ("orders_id") REFERENCES "public"."orders"("id") ON DELETE cascade ON UPDATE no action;
|
||||||
|
ALTER TABLE "payload_locked_documents_rels" ADD CONSTRAINT "payload_locked_documents_rels_pages_fk" FOREIGN KEY ("pages_id") REFERENCES "public"."pages"("id") ON DELETE cascade ON UPDATE no action;
|
||||||
|
ALTER TABLE "payload_locked_documents_rels" ADD CONSTRAINT "payload_locked_documents_rels_media_fk" FOREIGN KEY ("media_id") REFERENCES "public"."media"("id") ON DELETE cascade ON UPDATE no action;
|
||||||
|
ALTER TABLE "payload_locked_documents_rels" ADD CONSTRAINT "payload_locked_documents_rels_users_fk" FOREIGN KEY ("users_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;
|
||||||
|
ALTER TABLE "payload_preferences_rels" ADD CONSTRAINT "payload_preferences_rels_parent_fk" FOREIGN KEY ("parent_id") REFERENCES "public"."payload_preferences"("id") ON DELETE cascade ON UPDATE no action;
|
||||||
|
ALTER TABLE "payload_preferences_rels" ADD CONSTRAINT "payload_preferences_rels_users_fk" FOREIGN KEY ("users_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;
|
||||||
|
ALTER TABLE "site_settings_social_links" ADD CONSTRAINT "site_settings_social_links_parent_id_fk" FOREIGN KEY ("_parent_id") REFERENCES "public"."site_settings"("id") ON DELETE cascade ON UPDATE no action;
|
||||||
|
CREATE INDEX "products_options_order_idx" ON "products_options" USING btree ("_order");
|
||||||
|
CREATE INDEX "products_options_parent_id_idx" ON "products_options" USING btree ("_parent_id");
|
||||||
|
CREATE UNIQUE INDEX "products_slug_idx" ON "products" USING btree ("slug");
|
||||||
|
CREATE INDEX "products_category_idx" ON "products" USING btree ("category_id");
|
||||||
|
CREATE INDEX "products_seo_seo_og_image_idx" ON "products" USING btree ("seo_og_image_id");
|
||||||
|
CREATE INDEX "products_updated_at_idx" ON "products" USING btree ("updated_at");
|
||||||
|
CREATE INDEX "products_created_at_idx" ON "products" USING btree ("created_at");
|
||||||
|
CREATE INDEX "products_rels_order_idx" ON "products_rels" USING btree ("order");
|
||||||
|
CREATE INDEX "products_rels_parent_idx" ON "products_rels" USING btree ("parent_id");
|
||||||
|
CREATE INDEX "products_rels_path_idx" ON "products_rels" USING btree ("path");
|
||||||
|
CREATE INDEX "products_rels_media_id_idx" ON "products_rels" USING btree ("media_id");
|
||||||
|
CREATE INDEX "products_rels_products_id_idx" ON "products_rels" USING btree ("products_id");
|
||||||
|
CREATE UNIQUE INDEX "categories_slug_idx" ON "categories" USING btree ("slug");
|
||||||
|
CREATE INDEX "categories_parent_idx" ON "categories" USING btree ("parent_id");
|
||||||
|
CREATE INDEX "categories_image_idx" ON "categories" USING btree ("image_id");
|
||||||
|
CREATE INDEX "categories_updated_at_idx" ON "categories" USING btree ("updated_at");
|
||||||
|
CREATE INDEX "categories_created_at_idx" ON "categories" USING btree ("created_at");
|
||||||
|
CREATE INDEX "orders_items_order_idx" ON "orders_items" USING btree ("_order");
|
||||||
|
CREATE INDEX "orders_items_parent_id_idx" ON "orders_items" USING btree ("_parent_id");
|
||||||
|
CREATE INDEX "orders_items_product_idx" ON "orders_items" USING btree ("product_id");
|
||||||
|
CREATE UNIQUE INDEX "orders_order_number_idx" ON "orders" USING btree ("order_number");
|
||||||
|
CREATE INDEX "orders_updated_at_idx" ON "orders" USING btree ("updated_at");
|
||||||
|
CREATE INDEX "orders_created_at_idx" ON "orders" USING btree ("created_at");
|
||||||
|
CREATE UNIQUE INDEX "pages_slug_idx" ON "pages" USING btree ("slug");
|
||||||
|
CREATE INDEX "pages_seo_seo_og_image_idx" ON "pages" USING btree ("seo_og_image_id");
|
||||||
|
CREATE INDEX "pages_updated_at_idx" ON "pages" USING btree ("updated_at");
|
||||||
|
CREATE INDEX "pages_created_at_idx" ON "pages" USING btree ("created_at");
|
||||||
|
CREATE INDEX "media_updated_at_idx" ON "media" USING btree ("updated_at");
|
||||||
|
CREATE INDEX "media_created_at_idx" ON "media" USING btree ("created_at");
|
||||||
|
CREATE UNIQUE INDEX "media_filename_idx" ON "media" USING btree ("filename");
|
||||||
|
CREATE INDEX "media_sizes_thumbnail_sizes_thumbnail_filename_idx" ON "media" USING btree ("sizes_thumbnail_filename");
|
||||||
|
CREATE INDEX "media_sizes_card_sizes_card_filename_idx" ON "media" USING btree ("sizes_card_filename");
|
||||||
|
CREATE INDEX "media_sizes_hero_sizes_hero_filename_idx" ON "media" USING btree ("sizes_hero_filename");
|
||||||
|
CREATE INDEX "users_sessions_order_idx" ON "users_sessions" USING btree ("_order");
|
||||||
|
CREATE INDEX "users_sessions_parent_id_idx" ON "users_sessions" USING btree ("_parent_id");
|
||||||
|
CREATE INDEX "users_updated_at_idx" ON "users" USING btree ("updated_at");
|
||||||
|
CREATE INDEX "users_created_at_idx" ON "users" USING btree ("created_at");
|
||||||
|
CREATE UNIQUE INDEX "users_email_idx" ON "users" USING btree ("email");
|
||||||
|
CREATE UNIQUE INDEX "payload_kv_key_idx" ON "payload_kv" USING btree ("key");
|
||||||
|
CREATE INDEX "payload_locked_documents_global_slug_idx" ON "payload_locked_documents" USING btree ("global_slug");
|
||||||
|
CREATE INDEX "payload_locked_documents_updated_at_idx" ON "payload_locked_documents" USING btree ("updated_at");
|
||||||
|
CREATE INDEX "payload_locked_documents_created_at_idx" ON "payload_locked_documents" USING btree ("created_at");
|
||||||
|
CREATE INDEX "payload_locked_documents_rels_order_idx" ON "payload_locked_documents_rels" USING btree ("order");
|
||||||
|
CREATE INDEX "payload_locked_documents_rels_parent_idx" ON "payload_locked_documents_rels" USING btree ("parent_id");
|
||||||
|
CREATE INDEX "payload_locked_documents_rels_path_idx" ON "payload_locked_documents_rels" USING btree ("path");
|
||||||
|
CREATE INDEX "payload_locked_documents_rels_products_id_idx" ON "payload_locked_documents_rels" USING btree ("products_id");
|
||||||
|
CREATE INDEX "payload_locked_documents_rels_categories_id_idx" ON "payload_locked_documents_rels" USING btree ("categories_id");
|
||||||
|
CREATE INDEX "payload_locked_documents_rels_orders_id_idx" ON "payload_locked_documents_rels" USING btree ("orders_id");
|
||||||
|
CREATE INDEX "payload_locked_documents_rels_pages_id_idx" ON "payload_locked_documents_rels" USING btree ("pages_id");
|
||||||
|
CREATE INDEX "payload_locked_documents_rels_media_id_idx" ON "payload_locked_documents_rels" USING btree ("media_id");
|
||||||
|
CREATE INDEX "payload_locked_documents_rels_users_id_idx" ON "payload_locked_documents_rels" USING btree ("users_id");
|
||||||
|
CREATE INDEX "payload_preferences_key_idx" ON "payload_preferences" USING btree ("key");
|
||||||
|
CREATE INDEX "payload_preferences_updated_at_idx" ON "payload_preferences" USING btree ("updated_at");
|
||||||
|
CREATE INDEX "payload_preferences_created_at_idx" ON "payload_preferences" USING btree ("created_at");
|
||||||
|
CREATE INDEX "payload_preferences_rels_order_idx" ON "payload_preferences_rels" USING btree ("order");
|
||||||
|
CREATE INDEX "payload_preferences_rels_parent_idx" ON "payload_preferences_rels" USING btree ("parent_id");
|
||||||
|
CREATE INDEX "payload_preferences_rels_path_idx" ON "payload_preferences_rels" USING btree ("path");
|
||||||
|
CREATE INDEX "payload_preferences_rels_users_id_idx" ON "payload_preferences_rels" USING btree ("users_id");
|
||||||
|
CREATE INDEX "payload_migrations_updated_at_idx" ON "payload_migrations" USING btree ("updated_at");
|
||||||
|
CREATE INDEX "payload_migrations_created_at_idx" ON "payload_migrations" USING btree ("created_at");
|
||||||
|
CREATE INDEX "site_settings_social_links_order_idx" ON "site_settings_social_links" USING btree ("_order");
|
||||||
|
CREATE INDEX "site_settings_social_links_parent_id_idx" ON "site_settings_social_links" USING btree ("_parent_id");`)
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function down({ db, payload, req }: MigrateDownArgs): Promise<void> {
|
||||||
|
await db.execute(sql`
|
||||||
|
DROP TABLE "products_options" CASCADE;
|
||||||
|
DROP TABLE "products" CASCADE;
|
||||||
|
DROP TABLE "products_rels" CASCADE;
|
||||||
|
DROP TABLE "categories" CASCADE;
|
||||||
|
DROP TABLE "orders_items" CASCADE;
|
||||||
|
DROP TABLE "orders" CASCADE;
|
||||||
|
DROP TABLE "pages" CASCADE;
|
||||||
|
DROP TABLE "media" CASCADE;
|
||||||
|
DROP TABLE "users_sessions" CASCADE;
|
||||||
|
DROP TABLE "users" CASCADE;
|
||||||
|
DROP TABLE "payload_kv" CASCADE;
|
||||||
|
DROP TABLE "payload_locked_documents" CASCADE;
|
||||||
|
DROP TABLE "payload_locked_documents_rels" CASCADE;
|
||||||
|
DROP TABLE "payload_preferences" CASCADE;
|
||||||
|
DROP TABLE "payload_preferences_rels" CASCADE;
|
||||||
|
DROP TABLE "payload_migrations" CASCADE;
|
||||||
|
DROP TABLE "site_settings_social_links" CASCADE;
|
||||||
|
DROP TABLE "site_settings" CASCADE;
|
||||||
|
DROP TYPE "public"."enum_products_brand";
|
||||||
|
DROP TYPE "public"."enum_products_availability";
|
||||||
|
DROP TYPE "public"."enum_products_orientation";
|
||||||
|
DROP TYPE "public"."enum_orders_status";`)
|
||||||
|
}
|
||||||
@ -1 +1,9 @@
|
|||||||
export const migrations = [];
|
import * as migration_20260403_000849 from './20260403_000849';
|
||||||
|
|
||||||
|
export const migrations = [
|
||||||
|
{
|
||||||
|
up: migration_20260403_000849.up,
|
||||||
|
down: migration_20260403_000849.down,
|
||||||
|
name: '20260403_000849'
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user