From 4fb29d9cb7dd1873f1e666658ddbcb543bdf82d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BE=9F=E7=94=B7=E6=97=A5=E8=AE=B0=5Cwww?= Date: Wed, 25 Feb 2026 19:43:02 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B2=BE=E7=AE=80product?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/collections/Precautions.ts | 32 + src/collections/base/ProductBase.ts | 117 + .../{ => products}/PreorderProducts.ts | 8 +- src/collections/{ => products}/Products.ts | 10 +- src/collections/project/Precautions.ts | 128 + src/collections/project/ProjectStatuses.ts | 139 + src/migrations/20260208_171142.json | 1254 ---- src/migrations/20260208_171142.ts | 169 - src/migrations/20260212_193303.json | 3835 ------------ src/migrations/20260212_193303.ts | 370 -- src/migrations/20260212_202303.json | 4563 -------------- src/migrations/20260212_202303.ts | 45 - src/migrations/20260222_170233.json | 5445 ----------------- src/migrations/20260222_170233.ts | 314 - .../20260223_disassembly_refactor.ts | 250 - src/migrations/baseline.ts | 20 + src/migrations/hero_slider_simplify.ts | 22 - src/migrations/index.ts | 47 +- .../product_recommendations_simplify.ts | 18 - src/payload-types.ts | 183 + src/payload.config.ts | 7 +- 21 files changed, 640 insertions(+), 16336 deletions(-) create mode 100644 src/collections/Precautions.ts rename src/collections/{ => products}/PreorderProducts.ts (96%) rename src/collections/{ => products}/Products.ts (92%) create mode 100644 src/collections/project/Precautions.ts create mode 100644 src/collections/project/ProjectStatuses.ts delete mode 100644 src/migrations/20260208_171142.json delete mode 100644 src/migrations/20260208_171142.ts delete mode 100644 src/migrations/20260212_193303.json delete mode 100644 src/migrations/20260212_193303.ts delete mode 100644 src/migrations/20260212_202303.json delete mode 100644 src/migrations/20260212_202303.ts delete mode 100644 src/migrations/20260222_170233.json delete mode 100644 src/migrations/20260222_170233.ts delete mode 100644 src/migrations/20260223_disassembly_refactor.ts create mode 100644 src/migrations/baseline.ts delete mode 100644 src/migrations/hero_slider_simplify.ts delete mode 100644 src/migrations/product_recommendations_simplify.ts diff --git a/src/collections/Precautions.ts b/src/collections/Precautions.ts new file mode 100644 index 0000000..13901e8 --- /dev/null +++ b/src/collections/Precautions.ts @@ -0,0 +1,32 @@ +import type { CollectionConfig } from 'payload' +import { logAfterChange, logAfterDelete } from '../hooks/logAction' +import { PrecautionItemFields } from './base/ProductBase' + +/** + * 通用注意事项集合 + * 与产品内嵌注意事项共用 PrecautionItemFields 结构(title / summary / order) + * Products / PreorderProducts 可通过 sharedPrecautions 关联字段引用 + */ +export const Precautions: CollectionConfig = { + slug: 'precautions', + admin: { + useAsTitle: 'title', + defaultColumns: ['title', 'summary', 'updatedAt'], + description: '管理通用注意事项,可被多个产品复用引用', + pagination: { + defaultLimit: 25, + }, + }, + access: { + read: () => true, + create: ({ req: { user } }) => !!user, + update: ({ req: { user } }) => !!user, + delete: ({ req: { user } }) => !!user, + }, + fields: PrecautionItemFields, + hooks: { + afterChange: [logAfterChange], + afterDelete: [logAfterDelete], + }, + timestamps: true, +} diff --git a/src/collections/base/ProductBase.ts b/src/collections/base/ProductBase.ts index 98ffc29..7ba02f3 100644 --- a/src/collections/base/ProductBase.ts +++ b/src/collections/base/ProductBase.ts @@ -113,6 +113,14 @@ export const ProductBaseFields: Field[] = [ readOnly: true, }, }, + { + name: 'accessPassword', + type: 'text', + admin: { + description: '访问密码(用于保护特定产品页面或内容)', + placeholder: '留空则不限制访问', + }, + }, ] /** @@ -286,3 +294,112 @@ export const RelatedProductsField: Field = { // TaobaoLinksField 已移至独立文件,包含自动解析功能 export { TaobaoLinksField } from './TaobaoLinksField' + +/** + * 项目状态 Tab + * 内嵌数组,可在产品表单中直接添加和编辑,无需跳转新窗口 + */ +export const ProjectStatusesTab: Tab = { + label: '📊 项目状态', + fields: [ + { + name: 'projectStatuses', + type: 'array', + admin: { + description: '产品项目状态列表,可直接在此添加和编辑', + }, + fields: [ + { + name: 'title', + type: 'text', + required: true, + admin: { + description: '状态名称,例如:研发中、众筹中、量产中', + }, + }, + { + name: 'badge', + type: 'text', + admin: { + description: '状态徽章标签(简短文字,展示在产品卡片上)', + placeholder: '例如: 研发中', + }, + }, + { + name: 'description', + type: 'text', + admin: { + description: '状态简介', + placeholder: '请输入状态简介...', + }, + }, + { + name: 'order', + type: 'number', + defaultValue: 0, + admin: { + description: '排序权重(数值越小越靠前)', + }, + }, + ], + }, + ], +} + +/** + * 通用注意事项条目字段结构 + * 同时被 Precautions 集合和产品内嵌数组共用 + */ +export const PrecautionItemFields: Field[] = [ + { + name: 'title', + type: 'text', + required: true, + admin: { + description: '注意事项标题,例如:安装注意事项、使用须知', + }, + }, + { + name: 'summary', + type: 'text', + admin: { + description: '注意事项摘要', + placeholder: '请输入注意事项摘要...', + }, + }, + { + name: 'order', + type: 'number', + defaultValue: 0, + admin: { + description: '排序权重(数值越小越靠前)', + }, + }, +] + +/** + * 注意事项 Tab + * 内嵌数组,可在产品表单中直接添加和编辑,无需跳转新窗口 + */ +export const PrecautionsTab: Tab = { + label: '⚠️ 注意事项', + fields: [ + { + name: 'sharedPrecautions', + type: 'relationship', + relationTo: 'precautions', + hasMany: true, + admin: { + description: '引用通用注意事项(在《通用注意事项》集合中统一管理,可被多个产品复用)', + }, + }, + { + name: 'precautions', + type: 'array', + admin: { + description: '产品专属注意事项,可直接在此添加和编辑', + }, + fields: PrecautionItemFields, + }, + ], +} diff --git a/src/collections/PreorderProducts.ts b/src/collections/products/PreorderProducts.ts similarity index 96% rename from src/collections/PreorderProducts.ts rename to src/collections/products/PreorderProducts.ts index 1249d58..4430ce6 100644 --- a/src/collections/PreorderProducts.ts +++ b/src/collections/products/PreorderProducts.ts @@ -1,7 +1,7 @@ import type { CollectionConfig } from 'payload' -import { logAfterChange, logAfterDelete } from '../hooks/logAction' -import { cacheAfterChange, cacheAfterDelete } from '../hooks/cacheInvalidation' -import { ProductBaseFields, RelatedProductsField, TaobaoLinksField, MedusaAttributesTab } from './base/ProductBase' +import { logAfterChange, logAfterDelete } from '../../hooks/logAction' +import { cacheAfterChange, cacheAfterDelete } from '../../hooks/cacheInvalidation' +import { ProductBaseFields, RelatedProductsField, TaobaoLinksField, MedusaAttributesTab, ProjectStatusesTab, PrecautionsTab } from '../base/ProductBase' import { AlignFeature, BlocksFeature, @@ -240,6 +240,8 @@ export const PreorderProducts: CollectionConfig = { ], }, MedusaAttributesTab, + ProjectStatusesTab, + PrecautionsTab, { label: '🛒 淘宝链接', fields: [ diff --git a/src/collections/Products.ts b/src/collections/products/Products.ts similarity index 92% rename from src/collections/Products.ts rename to src/collections/products/Products.ts index 0feafd9..820a9e6 100644 --- a/src/collections/Products.ts +++ b/src/collections/products/Products.ts @@ -1,8 +1,8 @@ import type { CollectionConfig } from 'payload' -import { logAfterChange, logAfterDelete } from '../hooks/logAction' -import { cacheAfterChange, cacheAfterDelete } from '../hooks/cacheInvalidation' -import { ProductBaseFields, RelatedProductsField, MedusaAttributesTab } from './base/ProductBase' -import { TaobaoLinksField } from './base/TaobaoLinksField' +import { logAfterChange, logAfterDelete } from '../../hooks/logAction' +import { cacheAfterChange, cacheAfterDelete } from '../../hooks/cacheInvalidation' +import { ProductBaseFields, RelatedProductsField, MedusaAttributesTab, ProjectStatusesTab, PrecautionsTab } from '../base/ProductBase' +import { TaobaoLinksField } from '../base/TaobaoLinksField' import { AlignFeature, BlocksFeature, @@ -118,6 +118,8 @@ export const Products: CollectionConfig = { fields: [RelatedProductsField], }, MedusaAttributesTab, + ProjectStatusesTab, + PrecautionsTab, { label: '🛒 淘宝链接', fields: [ diff --git a/src/collections/project/Precautions.ts b/src/collections/project/Precautions.ts new file mode 100644 index 0000000..768fa3d --- /dev/null +++ b/src/collections/project/Precautions.ts @@ -0,0 +1,128 @@ +import type { CollectionConfig } from 'payload' +import { logAfterChange, logAfterDelete } from '../../hooks/logAction' +import { + BoldFeature, + HeadingFeature, + ItalicFeature, + lexicalEditor, + LinkFeature, + OrderedListFeature, + ParagraphFeature, + UnorderedListFeature, + FixedToolbarFeature, + InlineToolbarFeature, + HorizontalRuleFeature, +} from '@payloadcms/richtext-lexical' + +/** + * 注意事项集合 + * 用于描述产品使用、购买、安装等过程中需要注意的事项 + * 可被 Products 和 PreorderProducts 关联引用 + */ +export const Precautions: CollectionConfig = { + slug: 'precautions', + admin: { + useAsTitle: 'title', + defaultColumns: ['title', 'type', 'updatedAt'], + description: '管理产品注意事项,如使用须知、安装注意、购买说明等', + pagination: { + defaultLimit: 25, + }, + }, + access: { + read: () => true, + create: ({ req: { user } }) => !!user, + update: ({ req: { user } }) => !!user, + delete: ({ req: { user } }) => !!user, + }, + fields: [ + { + type: 'tabs', + tabs: [ + { + label: 'ℹ️ 基本信息', + fields: [ + { + type: 'row', + fields: [ + { + name: 'title', + type: 'text', + required: true, + admin: { + description: '注意事项标题,例如:安装注意事项、使用须知', + width: '60%', + }, + }, + { + name: 'type', + type: 'select', + defaultValue: 'general', + admin: { + description: '注意事项类型', + width: '40%', + }, + options: [ + { label: '通用', value: 'general' }, + { label: '安装', value: 'installation' }, + { label: '使用', value: 'usage' }, + { label: '购买', value: 'purchase' }, + { label: '售后', value: 'aftersale' }, + { label: '安全', value: 'safety' }, + ], + }, + ], + }, + { + name: 'summary', + type: 'text', + admin: { + description: '注意事项摘要(纯文本,用于列表展示)', + placeholder: '请输入注意事项摘要...', + }, + }, + { + name: 'order', + type: 'number', + defaultValue: 0, + admin: { + description: '排序权重(数值越小越靠前)', + }, + }, + ], + }, + { + label: '📄 详细内容', + fields: [ + { + name: 'content', + type: 'richText', + editor: lexicalEditor({ + features: [ + ParagraphFeature(), + HeadingFeature({ enabledHeadingSizes: ['h2', 'h3', 'h4'] }), + BoldFeature(), + ItalicFeature(), + UnorderedListFeature(), + OrderedListFeature(), + LinkFeature(), + HorizontalRuleFeature(), + FixedToolbarFeature(), + InlineToolbarFeature(), + ], + }), + admin: { + description: '注意事项详细内容(富文本)', + }, + }, + ], + }, + ], + }, + ], + hooks: { + afterChange: [logAfterChange], + afterDelete: [logAfterDelete], + }, + timestamps: true, +} diff --git a/src/collections/project/ProjectStatuses.ts b/src/collections/project/ProjectStatuses.ts new file mode 100644 index 0000000..61e9728 --- /dev/null +++ b/src/collections/project/ProjectStatuses.ts @@ -0,0 +1,139 @@ +import type { CollectionConfig } from 'payload' +import { logAfterChange, logAfterDelete } from '../../hooks/logAction' +import { + BoldFeature, + HeadingFeature, + ItalicFeature, + lexicalEditor, + LinkFeature, + OrderedListFeature, + ParagraphFeature, + UnorderedListFeature, + FixedToolbarFeature, + InlineToolbarFeature, + HorizontalRuleFeature, +} from '@payloadcms/richtext-lexical' + +/** + * 项目状态集合 + * 用于描述产品的项目进度、研发阶段等状态信息 + * 可被 Products 和 PreorderProducts 关联引用 + */ +export const ProjectStatuses: CollectionConfig = { + slug: 'project-statuses', + admin: { + hidden: true, + useAsTitle: 'title', + defaultColumns: ['title', 'badge', 'color', 'updatedAt'], + description: '管理产品项目状态,如研发中、量产中、已停产等', + pagination: { + defaultLimit: 25, + }, + }, + access: { + read: () => true, + create: ({ req: { user } }) => !!user, + update: ({ req: { user } }) => !!user, + delete: ({ req: { user } }) => !!user, + }, + fields: [ + { + type: 'tabs', + tabs: [ + { + label: 'ℹ️ 基本信息', + fields: [ + { + type: 'row', + fields: [ + { + name: 'title', + type: 'text', + required: true, + admin: { + description: '状态名称,例如:研发中、众筹中、量产中', + width: '50%', + }, + }, + { + name: 'badge', + type: 'text', + admin: { + description: '状态徽章标签(简短文字,展示在产品卡片上)', + placeholder: '例如: 研发中', + width: '25%', + }, + }, + { + name: 'color', + type: 'select', + defaultValue: 'gray', + admin: { + description: '徽章颜色', + width: '25%', + }, + options: [ + { label: '灰色', value: 'gray' }, + { label: '蓝色', value: 'blue' }, + { label: '绿色', value: 'green' }, + { label: '黄色', value: 'yellow' }, + { label: '橙色', value: 'orange' }, + { label: '红色', value: 'red' }, + { label: '紫色', value: 'purple' }, + ], + }, + ], + }, + { + name: 'description', + type: 'text', + admin: { + description: '状态简介(纯文本,用于列表展示)', + placeholder: '请输入状态简介...', + }, + }, + { + name: 'order', + type: 'number', + defaultValue: 0, + admin: { + description: '排序权重(数值越小越靠前)', + }, + }, + ], + }, + { + label: '📄 详细说明', + fields: [ + { + name: 'content', + type: 'richText', + editor: lexicalEditor({ + features: [ + ParagraphFeature(), + HeadingFeature({ enabledHeadingSizes: ['h2', 'h3', 'h4'] }), + BoldFeature(), + ItalicFeature(), + UnorderedListFeature(), + OrderedListFeature(), + LinkFeature(), + HorizontalRuleFeature(), + FixedToolbarFeature(), + InlineToolbarFeature(), + ], + }), + admin: { + description: '状态详细说明(富文本,可包含进度描述、注意事项等)', + }, + }, + ], + }, + ], + }, + ], + hooks: { + afterChange: [logAfterChange], + afterDelete: [logAfterDelete], + }, + timestamps: true, +} diff --git a/src/migrations/20260208_171142.json b/src/migrations/20260208_171142.json deleted file mode 100644 index e9e6a93..0000000 --- a/src/migrations/20260208_171142.json +++ /dev/null @@ -1,1254 +0,0 @@ -{ - "version": "7", - "dialect": "postgresql", - "tables": { - "public.users_sessions": { - "name": "users_sessions", - "schema": "", - "columns": { - "_order": { - "name": "_order", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "_parent_id": { - "name": "_parent_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "users_sessions_order_idx": { - "name": "users_sessions_order_idx", - "columns": [ - { - "expression": "_order", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_sessions_parent_id_idx": { - "name": "users_sessions_parent_id_idx", - "columns": [ - { - "expression": "_parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "users_sessions_parent_id_fk": { - "name": "users_sessions_parent_id_fk", - "tableFrom": "users_sessions", - "tableTo": "users", - "columnsFrom": [ - "_parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.users": { - "name": "users", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "email": { - "name": "email", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "reset_password_token": { - "name": "reset_password_token", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "reset_password_expiration": { - "name": "reset_password_expiration", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "salt": { - "name": "salt", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "hash": { - "name": "hash", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "login_attempts": { - "name": "login_attempts", - "type": "numeric", - "primaryKey": false, - "notNull": false, - "default": 0 - }, - "lock_until": { - "name": "lock_until", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "users_updated_at_idx": { - "name": "users_updated_at_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_created_at_idx": { - "name": "users_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_email_idx": { - "name": "users_email_idx", - "columns": [ - { - "expression": "email", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.media": { - "name": "media", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "alt": { - "name": "alt", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "url": { - "name": "url", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "thumbnail_u_r_l": { - "name": "thumbnail_u_r_l", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "filename": { - "name": "filename", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "mime_type": { - "name": "mime_type", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "filesize": { - "name": "filesize", - "type": "numeric", - "primaryKey": false, - "notNull": false - }, - "width": { - "name": "width", - "type": "numeric", - "primaryKey": false, - "notNull": false - }, - "height": { - "name": "height", - "type": "numeric", - "primaryKey": false, - "notNull": false - }, - "focal_x": { - "name": "focal_x", - "type": "numeric", - "primaryKey": false, - "notNull": false - }, - "focal_y": { - "name": "focal_y", - "type": "numeric", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "media_updated_at_idx": { - "name": "media_updated_at_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "media_created_at_idx": { - "name": "media_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "media_filename_idx": { - "name": "media_filename_idx", - "columns": [ - { - "expression": "filename", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.products": { - "name": "products", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "medusa_id": { - "name": "medusa_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "title": { - "name": "title", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "handle": { - "name": "handle", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "thumbnail": { - "name": "thumbnail", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "enum_products_status", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'draft'" - }, - "last_synced_at": { - "name": "last_synced_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "products_medusa_id_idx": { - "name": "products_medusa_id_idx", - "columns": [ - { - "expression": "medusa_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - }, - "products_updated_at_idx": { - "name": "products_updated_at_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "products_created_at_idx": { - "name": "products_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.products_rels": { - "name": "products_rels", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "order": { - "name": "order", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "parent_id": { - "name": "parent_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "path": { - "name": "path", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "products_id": { - "name": "products_id", - "type": "integer", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "products_rels_order_idx": { - "name": "products_rels_order_idx", - "columns": [ - { - "expression": "order", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "products_rels_parent_idx": { - "name": "products_rels_parent_idx", - "columns": [ - { - "expression": "parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "products_rels_path_idx": { - "name": "products_rels_path_idx", - "columns": [ - { - "expression": "path", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "products_rels_products_id_idx": { - "name": "products_rels_products_id_idx", - "columns": [ - { - "expression": "products_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "products_rels_parent_fk": { - "name": "products_rels_parent_fk", - "tableFrom": "products_rels", - "tableTo": "products", - "columnsFrom": [ - "parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "products_rels_products_fk": { - "name": "products_rels_products_fk", - "tableFrom": "products_rels", - "tableTo": "products", - "columnsFrom": [ - "products_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.payload_kv": { - "name": "payload_kv", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "key": { - "name": "key", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "data": { - "name": "data", - "type": "jsonb", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "payload_kv_key_idx": { - "name": "payload_kv_key_idx", - "columns": [ - { - "expression": "key", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.payload_locked_documents": { - "name": "payload_locked_documents", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "global_slug": { - "name": "global_slug", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "payload_locked_documents_global_slug_idx": { - "name": "payload_locked_documents_global_slug_idx", - "columns": [ - { - "expression": "global_slug", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_locked_documents_updated_at_idx": { - "name": "payload_locked_documents_updated_at_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_locked_documents_created_at_idx": { - "name": "payload_locked_documents_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.payload_locked_documents_rels": { - "name": "payload_locked_documents_rels", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "order": { - "name": "order", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "parent_id": { - "name": "parent_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "path": { - "name": "path", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "users_id": { - "name": "users_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "media_id": { - "name": "media_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "products_id": { - "name": "products_id", - "type": "integer", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "payload_locked_documents_rels_order_idx": { - "name": "payload_locked_documents_rels_order_idx", - "columns": [ - { - "expression": "order", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_locked_documents_rels_parent_idx": { - "name": "payload_locked_documents_rels_parent_idx", - "columns": [ - { - "expression": "parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_locked_documents_rels_path_idx": { - "name": "payload_locked_documents_rels_path_idx", - "columns": [ - { - "expression": "path", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_locked_documents_rels_users_id_idx": { - "name": "payload_locked_documents_rels_users_id_idx", - "columns": [ - { - "expression": "users_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_locked_documents_rels_media_id_idx": { - "name": "payload_locked_documents_rels_media_id_idx", - "columns": [ - { - "expression": "media_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_locked_documents_rels_products_id_idx": { - "name": "payload_locked_documents_rels_products_id_idx", - "columns": [ - { - "expression": "products_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "payload_locked_documents_rels_parent_fk": { - "name": "payload_locked_documents_rels_parent_fk", - "tableFrom": "payload_locked_documents_rels", - "tableTo": "payload_locked_documents", - "columnsFrom": [ - "parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "payload_locked_documents_rels_users_fk": { - "name": "payload_locked_documents_rels_users_fk", - "tableFrom": "payload_locked_documents_rels", - "tableTo": "users", - "columnsFrom": [ - "users_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "payload_locked_documents_rels_media_fk": { - "name": "payload_locked_documents_rels_media_fk", - "tableFrom": "payload_locked_documents_rels", - "tableTo": "media", - "columnsFrom": [ - "media_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "payload_locked_documents_rels_products_fk": { - "name": "payload_locked_documents_rels_products_fk", - "tableFrom": "payload_locked_documents_rels", - "tableTo": "products", - "columnsFrom": [ - "products_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.payload_preferences": { - "name": "payload_preferences", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "key": { - "name": "key", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "value": { - "name": "value", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "payload_preferences_key_idx": { - "name": "payload_preferences_key_idx", - "columns": [ - { - "expression": "key", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_preferences_updated_at_idx": { - "name": "payload_preferences_updated_at_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_preferences_created_at_idx": { - "name": "payload_preferences_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.payload_preferences_rels": { - "name": "payload_preferences_rels", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "order": { - "name": "order", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "parent_id": { - "name": "parent_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "path": { - "name": "path", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "users_id": { - "name": "users_id", - "type": "integer", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "payload_preferences_rels_order_idx": { - "name": "payload_preferences_rels_order_idx", - "columns": [ - { - "expression": "order", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_preferences_rels_parent_idx": { - "name": "payload_preferences_rels_parent_idx", - "columns": [ - { - "expression": "parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_preferences_rels_path_idx": { - "name": "payload_preferences_rels_path_idx", - "columns": [ - { - "expression": "path", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_preferences_rels_users_id_idx": { - "name": "payload_preferences_rels_users_id_idx", - "columns": [ - { - "expression": "users_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "payload_preferences_rels_parent_fk": { - "name": "payload_preferences_rels_parent_fk", - "tableFrom": "payload_preferences_rels", - "tableTo": "payload_preferences", - "columnsFrom": [ - "parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "payload_preferences_rels_users_fk": { - "name": "payload_preferences_rels_users_fk", - "tableFrom": "payload_preferences_rels", - "tableTo": "users", - "columnsFrom": [ - "users_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.payload_migrations": { - "name": "payload_migrations", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "batch": { - "name": "batch", - "type": "numeric", - "primaryKey": false, - "notNull": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "payload_migrations_updated_at_idx": { - "name": "payload_migrations_updated_at_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_migrations_created_at_idx": { - "name": "payload_migrations_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "public.enum_products_status": { - "name": "enum_products_status", - "schema": "public", - "values": [ - "draft", - "published" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "schemas": {}, - "tables": {}, - "columns": {} - }, - "id": "14812669-da54-4cd0-abf6-680b50e27c2f", - "prevId": "00000000-0000-0000-0000-000000000000" -} \ No newline at end of file diff --git a/src/migrations/20260208_171142.ts b/src/migrations/20260208_171142.ts deleted file mode 100644 index 45f5654..0000000 --- a/src/migrations/20260208_171142.ts +++ /dev/null @@ -1,169 +0,0 @@ -import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres' - -export async function up({ db, payload, req }: MigrateUpArgs): Promise { - await db.execute(sql` - CREATE TYPE "public"."enum_products_status" AS ENUM('draft', 'published'); - 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, - "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 "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 - ); - - CREATE TABLE "products" ( - "id" serial PRIMARY KEY NOT NULL, - "medusa_id" varchar NOT NULL, - "title" varchar NOT NULL, - "handle" varchar, - "thumbnail" varchar, - "status" "enum_products_status" DEFAULT 'draft' NOT NULL, - "last_synced_at" timestamp(3) with time zone, - "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, - "products_id" integer - ); - - 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, - "users_id" integer, - "media_id" integer, - "products_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 - ); - - 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 "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_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_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_users_fk" FOREIGN KEY ("users_id") REFERENCES "public"."users"("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_products_fk" FOREIGN KEY ("products_id") REFERENCES "public"."products"("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; - 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 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 UNIQUE INDEX "products_medusa_id_idx" ON "products" USING btree ("medusa_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_products_id_idx" ON "products_rels" USING btree ("products_id"); - 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_users_id_idx" ON "payload_locked_documents_rels" USING btree ("users_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_products_id_idx" ON "payload_locked_documents_rels" USING btree ("products_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");`) -} - -export async function down({ db, payload, req }: MigrateDownArgs): Promise { - await db.execute(sql` - DROP TABLE "users_sessions" CASCADE; - DROP TABLE "users" CASCADE; - DROP TABLE "media" CASCADE; - DROP TABLE "products" CASCADE; - DROP TABLE "products_rels" 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 TYPE "public"."enum_products_status";`) -} diff --git a/src/migrations/20260212_193303.json b/src/migrations/20260212_193303.json deleted file mode 100644 index 54e2c49..0000000 --- a/src/migrations/20260212_193303.json +++ /dev/null @@ -1,3835 +0,0 @@ -{ - "version": "7", - "dialect": "postgresql", - "tables": { - "public.users_roles": { - "name": "users_roles", - "schema": "", - "columns": { - "order": { - "name": "order", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "parent_id": { - "name": "parent_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "value": { - "name": "value", - "type": "enum_users_roles", - "typeSchema": "public", - "primaryKey": false, - "notNull": false - }, - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - } - }, - "indexes": { - "users_roles_order_idx": { - "name": "users_roles_order_idx", - "columns": [ - { - "expression": "order", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_roles_parent_idx": { - "name": "users_roles_parent_idx", - "columns": [ - { - "expression": "parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "users_roles_parent_fk": { - "name": "users_roles_parent_fk", - "tableFrom": "users_roles", - "tableTo": "users", - "columnsFrom": [ - "parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.users_sessions": { - "name": "users_sessions", - "schema": "", - "columns": { - "_order": { - "name": "_order", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "_parent_id": { - "name": "_parent_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "users_sessions_order_idx": { - "name": "users_sessions_order_idx", - "columns": [ - { - "expression": "_order", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_sessions_parent_id_idx": { - "name": "users_sessions_parent_id_idx", - "columns": [ - { - "expression": "_parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "users_sessions_parent_id_fk": { - "name": "users_sessions_parent_id_fk", - "tableFrom": "users_sessions", - "tableTo": "users", - "columnsFrom": [ - "_parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.users": { - "name": "users", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "email": { - "name": "email", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "reset_password_token": { - "name": "reset_password_token", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "reset_password_expiration": { - "name": "reset_password_expiration", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "salt": { - "name": "salt", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "hash": { - "name": "hash", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "login_attempts": { - "name": "login_attempts", - "type": "numeric", - "primaryKey": false, - "notNull": false, - "default": 0 - }, - "lock_until": { - "name": "lock_until", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "users_updated_at_idx": { - "name": "users_updated_at_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_created_at_idx": { - "name": "users_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_email_idx": { - "name": "users_email_idx", - "columns": [ - { - "expression": "email", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.media": { - "name": "media", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "alt": { - "name": "alt", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "url": { - "name": "url", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "thumbnail_u_r_l": { - "name": "thumbnail_u_r_l", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "filename": { - "name": "filename", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "mime_type": { - "name": "mime_type", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "filesize": { - "name": "filesize", - "type": "numeric", - "primaryKey": false, - "notNull": false - }, - "width": { - "name": "width", - "type": "numeric", - "primaryKey": false, - "notNull": false - }, - "height": { - "name": "height", - "type": "numeric", - "primaryKey": false, - "notNull": false - }, - "focal_x": { - "name": "focal_x", - "type": "numeric", - "primaryKey": false, - "notNull": false - }, - "focal_y": { - "name": "focal_y", - "type": "numeric", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "media_updated_at_idx": { - "name": "media_updated_at_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "media_created_at_idx": { - "name": "media_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "media_filename_idx": { - "name": "media_filename_idx", - "columns": [ - { - "expression": "filename", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.products": { - "name": "products", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "medusa_id": { - "name": "medusa_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "enum_products_status", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'draft'" - }, - "title": { - "name": "title", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "handle": { - "name": "handle", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "thumbnail": { - "name": "thumbnail", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "last_synced_at": { - "name": "last_synced_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "content": { - "name": "content", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "products_medusa_id_idx": { - "name": "products_medusa_id_idx", - "columns": [ - { - "expression": "medusa_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - }, - "products_updated_at_idx": { - "name": "products_updated_at_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "products_created_at_idx": { - "name": "products_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.products_rels": { - "name": "products_rels", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "order": { - "name": "order", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "parent_id": { - "name": "parent_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "path": { - "name": "path", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "products_id": { - "name": "products_id", - "type": "integer", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "products_rels_order_idx": { - "name": "products_rels_order_idx", - "columns": [ - { - "expression": "order", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "products_rels_parent_idx": { - "name": "products_rels_parent_idx", - "columns": [ - { - "expression": "parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "products_rels_path_idx": { - "name": "products_rels_path_idx", - "columns": [ - { - "expression": "path", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "products_rels_products_id_idx": { - "name": "products_rels_products_id_idx", - "columns": [ - { - "expression": "products_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "products_rels_parent_fk": { - "name": "products_rels_parent_fk", - "tableFrom": "products_rels", - "tableTo": "products", - "columnsFrom": [ - "parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "products_rels_products_fk": { - "name": "products_rels_products_fk", - "tableFrom": "products_rels", - "tableTo": "products", - "columnsFrom": [ - "products_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.announcements": { - "name": "announcements", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "title": { - "name": "title", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "enum_announcements_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'info'" - }, - "status": { - "name": "status", - "type": "enum_announcements_status", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'draft'" - }, - "priority": { - "name": "priority", - "type": "numeric", - "primaryKey": false, - "notNull": false, - "default": 0 - }, - "summary": { - "name": "summary", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "content": { - "name": "content", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "published_at": { - "name": "published_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "show_on_homepage": { - "name": "show_on_homepage", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "author_id": { - "name": "author_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "announcements_author_idx": { - "name": "announcements_author_idx", - "columns": [ - { - "expression": "author_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "announcements_updated_at_idx": { - "name": "announcements_updated_at_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "announcements_created_at_idx": { - "name": "announcements_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "announcements_author_id_users_id_fk": { - "name": "announcements_author_id_users_id_fk", - "tableFrom": "announcements", - "tableTo": "users", - "columnsFrom": [ - "author_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.articles": { - "name": "articles", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "title": { - "name": "title", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "enum_articles_status", - "typeSchema": "public", - "primaryKey": false, - "notNull": false, - "default": "'draft'" - }, - "slug": { - "name": "slug", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "featured_image_id": { - "name": "featured_image_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "excerpt": { - "name": "excerpt", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "content": { - "name": "content", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "category": { - "name": "category", - "type": "enum_articles_category", - "typeSchema": "public", - "primaryKey": false, - "notNull": false - }, - "featured": { - "name": "featured", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "author_id": { - "name": "author_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "published_at": { - "name": "published_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "meta_title": { - "name": "meta_title", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "meta_description": { - "name": "meta_description", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "_status": { - "name": "_status", - "type": "enum_articles_status", - "typeSchema": "public", - "primaryKey": false, - "notNull": false, - "default": "'draft'" - } - }, - "indexes": { - "articles_slug_idx": { - "name": "articles_slug_idx", - "columns": [ - { - "expression": "slug", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - }, - "articles_featured_image_idx": { - "name": "articles_featured_image_idx", - "columns": [ - { - "expression": "featured_image_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "articles_author_idx": { - "name": "articles_author_idx", - "columns": [ - { - "expression": "author_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "articles_updated_at_idx": { - "name": "articles_updated_at_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "articles_created_at_idx": { - "name": "articles_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "articles__status_idx": { - "name": "articles__status_idx", - "columns": [ - { - "expression": "_status", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "articles_featured_image_id_media_id_fk": { - "name": "articles_featured_image_id_media_id_fk", - "tableFrom": "articles", - "tableTo": "media", - "columnsFrom": [ - "featured_image_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "articles_author_id_users_id_fk": { - "name": "articles_author_id_users_id_fk", - "tableFrom": "articles", - "tableTo": "users", - "columnsFrom": [ - "author_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.articles_texts": { - "name": "articles_texts", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "order": { - "name": "order", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "parent_id": { - "name": "parent_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "path": { - "name": "path", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "text": { - "name": "text", - "type": "varchar", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "articles_texts_order_parent": { - "name": "articles_texts_order_parent", - "columns": [ - { - "expression": "order", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "articles_texts_parent_fk": { - "name": "articles_texts_parent_fk", - "tableFrom": "articles_texts", - "tableTo": "articles", - "columnsFrom": [ - "parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.articles_rels": { - "name": "articles_rels", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "order": { - "name": "order", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "parent_id": { - "name": "parent_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "path": { - "name": "path", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "articles_id": { - "name": "articles_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "products_id": { - "name": "products_id", - "type": "integer", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "articles_rels_order_idx": { - "name": "articles_rels_order_idx", - "columns": [ - { - "expression": "order", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "articles_rels_parent_idx": { - "name": "articles_rels_parent_idx", - "columns": [ - { - "expression": "parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "articles_rels_path_idx": { - "name": "articles_rels_path_idx", - "columns": [ - { - "expression": "path", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "articles_rels_articles_id_idx": { - "name": "articles_rels_articles_id_idx", - "columns": [ - { - "expression": "articles_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "articles_rels_products_id_idx": { - "name": "articles_rels_products_id_idx", - "columns": [ - { - "expression": "products_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "articles_rels_parent_fk": { - "name": "articles_rels_parent_fk", - "tableFrom": "articles_rels", - "tableTo": "articles", - "columnsFrom": [ - "parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "articles_rels_articles_fk": { - "name": "articles_rels_articles_fk", - "tableFrom": "articles_rels", - "tableTo": "articles", - "columnsFrom": [ - "articles_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "articles_rels_products_fk": { - "name": "articles_rels_products_fk", - "tableFrom": "articles_rels", - "tableTo": "products", - "columnsFrom": [ - "products_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public._articles_v": { - "name": "_articles_v", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "parent_id": { - "name": "parent_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "version_title": { - "name": "version_title", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "version_status": { - "name": "version_status", - "type": "enum__articles_v_version_status", - "typeSchema": "public", - "primaryKey": false, - "notNull": false, - "default": "'draft'" - }, - "version_slug": { - "name": "version_slug", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "version_featured_image_id": { - "name": "version_featured_image_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "version_excerpt": { - "name": "version_excerpt", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "version_content": { - "name": "version_content", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "version_category": { - "name": "version_category", - "type": "enum__articles_v_version_category", - "typeSchema": "public", - "primaryKey": false, - "notNull": false - }, - "version_featured": { - "name": "version_featured", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "version_author_id": { - "name": "version_author_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "version_published_at": { - "name": "version_published_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "version_meta_title": { - "name": "version_meta_title", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "version_meta_description": { - "name": "version_meta_description", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "version_updated_at": { - "name": "version_updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "version_created_at": { - "name": "version_created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "version__status": { - "name": "version__status", - "type": "enum__articles_v_version_status", - "typeSchema": "public", - "primaryKey": false, - "notNull": false, - "default": "'draft'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "latest": { - "name": "latest", - "type": "boolean", - "primaryKey": false, - "notNull": false - }, - "autosave": { - "name": "autosave", - "type": "boolean", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "_articles_v_parent_idx": { - "name": "_articles_v_parent_idx", - "columns": [ - { - "expression": "parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "_articles_v_version_version_slug_idx": { - "name": "_articles_v_version_version_slug_idx", - "columns": [ - { - "expression": "version_slug", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "_articles_v_version_version_featured_image_idx": { - "name": "_articles_v_version_version_featured_image_idx", - "columns": [ - { - "expression": "version_featured_image_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "_articles_v_version_version_author_idx": { - "name": "_articles_v_version_version_author_idx", - "columns": [ - { - "expression": "version_author_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "_articles_v_version_version_updated_at_idx": { - "name": "_articles_v_version_version_updated_at_idx", - "columns": [ - { - "expression": "version_updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "_articles_v_version_version_created_at_idx": { - "name": "_articles_v_version_version_created_at_idx", - "columns": [ - { - "expression": "version_created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "_articles_v_version_version__status_idx": { - "name": "_articles_v_version_version__status_idx", - "columns": [ - { - "expression": "version__status", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "_articles_v_created_at_idx": { - "name": "_articles_v_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "_articles_v_updated_at_idx": { - "name": "_articles_v_updated_at_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "_articles_v_latest_idx": { - "name": "_articles_v_latest_idx", - "columns": [ - { - "expression": "latest", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "_articles_v_autosave_idx": { - "name": "_articles_v_autosave_idx", - "columns": [ - { - "expression": "autosave", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "_articles_v_parent_id_articles_id_fk": { - "name": "_articles_v_parent_id_articles_id_fk", - "tableFrom": "_articles_v", - "tableTo": "articles", - "columnsFrom": [ - "parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "_articles_v_version_featured_image_id_media_id_fk": { - "name": "_articles_v_version_featured_image_id_media_id_fk", - "tableFrom": "_articles_v", - "tableTo": "media", - "columnsFrom": [ - "version_featured_image_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "_articles_v_version_author_id_users_id_fk": { - "name": "_articles_v_version_author_id_users_id_fk", - "tableFrom": "_articles_v", - "tableTo": "users", - "columnsFrom": [ - "version_author_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public._articles_v_texts": { - "name": "_articles_v_texts", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "order": { - "name": "order", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "parent_id": { - "name": "parent_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "path": { - "name": "path", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "text": { - "name": "text", - "type": "varchar", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "_articles_v_texts_order_parent": { - "name": "_articles_v_texts_order_parent", - "columns": [ - { - "expression": "order", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "_articles_v_texts_parent_fk": { - "name": "_articles_v_texts_parent_fk", - "tableFrom": "_articles_v_texts", - "tableTo": "_articles_v", - "columnsFrom": [ - "parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public._articles_v_rels": { - "name": "_articles_v_rels", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "order": { - "name": "order", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "parent_id": { - "name": "parent_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "path": { - "name": "path", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "articles_id": { - "name": "articles_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "products_id": { - "name": "products_id", - "type": "integer", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "_articles_v_rels_order_idx": { - "name": "_articles_v_rels_order_idx", - "columns": [ - { - "expression": "order", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "_articles_v_rels_parent_idx": { - "name": "_articles_v_rels_parent_idx", - "columns": [ - { - "expression": "parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "_articles_v_rels_path_idx": { - "name": "_articles_v_rels_path_idx", - "columns": [ - { - "expression": "path", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "_articles_v_rels_articles_id_idx": { - "name": "_articles_v_rels_articles_id_idx", - "columns": [ - { - "expression": "articles_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "_articles_v_rels_products_id_idx": { - "name": "_articles_v_rels_products_id_idx", - "columns": [ - { - "expression": "products_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "_articles_v_rels_parent_fk": { - "name": "_articles_v_rels_parent_fk", - "tableFrom": "_articles_v_rels", - "tableTo": "_articles_v", - "columnsFrom": [ - "parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "_articles_v_rels_articles_fk": { - "name": "_articles_v_rels_articles_fk", - "tableFrom": "_articles_v_rels", - "tableTo": "articles", - "columnsFrom": [ - "articles_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "_articles_v_rels_products_fk": { - "name": "_articles_v_rels_products_fk", - "tableFrom": "_articles_v_rels", - "tableTo": "products", - "columnsFrom": [ - "products_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.logs": { - "name": "logs", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "action": { - "name": "action", - "type": "enum_logs_action", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "collection": { - "name": "collection", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "document_id": { - "name": "document_id", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "document_title": { - "name": "document_title", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "user_id": { - "name": "user_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "changes": { - "name": "changes", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "ip": { - "name": "ip", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "user_agent": { - "name": "user_agent", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "logs_collection_idx": { - "name": "logs_collection_idx", - "columns": [ - { - "expression": "collection", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "logs_document_id_idx": { - "name": "logs_document_id_idx", - "columns": [ - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "logs_user_idx": { - "name": "logs_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "logs_updated_at_idx": { - "name": "logs_updated_at_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "logs_created_at_idx": { - "name": "logs_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "logs_user_id_users_id_fk": { - "name": "logs_user_id_users_id_fk", - "tableFrom": "logs", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.payload_kv": { - "name": "payload_kv", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "key": { - "name": "key", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "data": { - "name": "data", - "type": "jsonb", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "payload_kv_key_idx": { - "name": "payload_kv_key_idx", - "columns": [ - { - "expression": "key", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.payload_jobs_log": { - "name": "payload_jobs_log", - "schema": "", - "columns": { - "_order": { - "name": "_order", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "_parent_id": { - "name": "_parent_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "executed_at": { - "name": "executed_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true - }, - "task_slug": { - "name": "task_slug", - "type": "enum_payload_jobs_log_task_slug", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "task_i_d": { - "name": "task_i_d", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "input": { - "name": "input", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "output": { - "name": "output", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "state": { - "name": "state", - "type": "enum_payload_jobs_log_state", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "error": { - "name": "error", - "type": "jsonb", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "payload_jobs_log_order_idx": { - "name": "payload_jobs_log_order_idx", - "columns": [ - { - "expression": "_order", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_jobs_log_parent_id_idx": { - "name": "payload_jobs_log_parent_id_idx", - "columns": [ - { - "expression": "_parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "payload_jobs_log_parent_id_fk": { - "name": "payload_jobs_log_parent_id_fk", - "tableFrom": "payload_jobs_log", - "tableTo": "payload_jobs", - "columnsFrom": [ - "_parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.payload_jobs": { - "name": "payload_jobs", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "input": { - "name": "input", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "total_tried": { - "name": "total_tried", - "type": "numeric", - "primaryKey": false, - "notNull": false, - "default": 0 - }, - "has_error": { - "name": "has_error", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "error": { - "name": "error", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "task_slug": { - "name": "task_slug", - "type": "enum_payload_jobs_task_slug", - "typeSchema": "public", - "primaryKey": false, - "notNull": false - }, - "queue": { - "name": "queue", - "type": "varchar", - "primaryKey": false, - "notNull": false, - "default": "'default'" - }, - "wait_until": { - "name": "wait_until", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "processing": { - "name": "processing", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "payload_jobs_completed_at_idx": { - "name": "payload_jobs_completed_at_idx", - "columns": [ - { - "expression": "completed_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_jobs_total_tried_idx": { - "name": "payload_jobs_total_tried_idx", - "columns": [ - { - "expression": "total_tried", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_jobs_has_error_idx": { - "name": "payload_jobs_has_error_idx", - "columns": [ - { - "expression": "has_error", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_jobs_task_slug_idx": { - "name": "payload_jobs_task_slug_idx", - "columns": [ - { - "expression": "task_slug", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_jobs_queue_idx": { - "name": "payload_jobs_queue_idx", - "columns": [ - { - "expression": "queue", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_jobs_wait_until_idx": { - "name": "payload_jobs_wait_until_idx", - "columns": [ - { - "expression": "wait_until", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_jobs_processing_idx": { - "name": "payload_jobs_processing_idx", - "columns": [ - { - "expression": "processing", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_jobs_updated_at_idx": { - "name": "payload_jobs_updated_at_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_jobs_created_at_idx": { - "name": "payload_jobs_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.payload_locked_documents": { - "name": "payload_locked_documents", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "global_slug": { - "name": "global_slug", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "payload_locked_documents_global_slug_idx": { - "name": "payload_locked_documents_global_slug_idx", - "columns": [ - { - "expression": "global_slug", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_locked_documents_updated_at_idx": { - "name": "payload_locked_documents_updated_at_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_locked_documents_created_at_idx": { - "name": "payload_locked_documents_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.payload_locked_documents_rels": { - "name": "payload_locked_documents_rels", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "order": { - "name": "order", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "parent_id": { - "name": "parent_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "path": { - "name": "path", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "users_id": { - "name": "users_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "media_id": { - "name": "media_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "products_id": { - "name": "products_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "announcements_id": { - "name": "announcements_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "articles_id": { - "name": "articles_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "logs_id": { - "name": "logs_id", - "type": "integer", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "payload_locked_documents_rels_order_idx": { - "name": "payload_locked_documents_rels_order_idx", - "columns": [ - { - "expression": "order", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_locked_documents_rels_parent_idx": { - "name": "payload_locked_documents_rels_parent_idx", - "columns": [ - { - "expression": "parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_locked_documents_rels_path_idx": { - "name": "payload_locked_documents_rels_path_idx", - "columns": [ - { - "expression": "path", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_locked_documents_rels_users_id_idx": { - "name": "payload_locked_documents_rels_users_id_idx", - "columns": [ - { - "expression": "users_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_locked_documents_rels_media_id_idx": { - "name": "payload_locked_documents_rels_media_id_idx", - "columns": [ - { - "expression": "media_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_locked_documents_rels_products_id_idx": { - "name": "payload_locked_documents_rels_products_id_idx", - "columns": [ - { - "expression": "products_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_locked_documents_rels_announcements_id_idx": { - "name": "payload_locked_documents_rels_announcements_id_idx", - "columns": [ - { - "expression": "announcements_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_locked_documents_rels_articles_id_idx": { - "name": "payload_locked_documents_rels_articles_id_idx", - "columns": [ - { - "expression": "articles_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_locked_documents_rels_logs_id_idx": { - "name": "payload_locked_documents_rels_logs_id_idx", - "columns": [ - { - "expression": "logs_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "payload_locked_documents_rels_parent_fk": { - "name": "payload_locked_documents_rels_parent_fk", - "tableFrom": "payload_locked_documents_rels", - "tableTo": "payload_locked_documents", - "columnsFrom": [ - "parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "payload_locked_documents_rels_users_fk": { - "name": "payload_locked_documents_rels_users_fk", - "tableFrom": "payload_locked_documents_rels", - "tableTo": "users", - "columnsFrom": [ - "users_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "payload_locked_documents_rels_media_fk": { - "name": "payload_locked_documents_rels_media_fk", - "tableFrom": "payload_locked_documents_rels", - "tableTo": "media", - "columnsFrom": [ - "media_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "payload_locked_documents_rels_products_fk": { - "name": "payload_locked_documents_rels_products_fk", - "tableFrom": "payload_locked_documents_rels", - "tableTo": "products", - "columnsFrom": [ - "products_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "payload_locked_documents_rels_announcements_fk": { - "name": "payload_locked_documents_rels_announcements_fk", - "tableFrom": "payload_locked_documents_rels", - "tableTo": "announcements", - "columnsFrom": [ - "announcements_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "payload_locked_documents_rels_articles_fk": { - "name": "payload_locked_documents_rels_articles_fk", - "tableFrom": "payload_locked_documents_rels", - "tableTo": "articles", - "columnsFrom": [ - "articles_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "payload_locked_documents_rels_logs_fk": { - "name": "payload_locked_documents_rels_logs_fk", - "tableFrom": "payload_locked_documents_rels", - "tableTo": "logs", - "columnsFrom": [ - "logs_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.payload_preferences": { - "name": "payload_preferences", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "key": { - "name": "key", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "value": { - "name": "value", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "payload_preferences_key_idx": { - "name": "payload_preferences_key_idx", - "columns": [ - { - "expression": "key", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_preferences_updated_at_idx": { - "name": "payload_preferences_updated_at_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_preferences_created_at_idx": { - "name": "payload_preferences_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.payload_preferences_rels": { - "name": "payload_preferences_rels", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "order": { - "name": "order", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "parent_id": { - "name": "parent_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "path": { - "name": "path", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "users_id": { - "name": "users_id", - "type": "integer", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "payload_preferences_rels_order_idx": { - "name": "payload_preferences_rels_order_idx", - "columns": [ - { - "expression": "order", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_preferences_rels_parent_idx": { - "name": "payload_preferences_rels_parent_idx", - "columns": [ - { - "expression": "parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_preferences_rels_path_idx": { - "name": "payload_preferences_rels_path_idx", - "columns": [ - { - "expression": "path", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_preferences_rels_users_id_idx": { - "name": "payload_preferences_rels_users_id_idx", - "columns": [ - { - "expression": "users_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "payload_preferences_rels_parent_fk": { - "name": "payload_preferences_rels_parent_fk", - "tableFrom": "payload_preferences_rels", - "tableTo": "payload_preferences", - "columnsFrom": [ - "parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "payload_preferences_rels_users_fk": { - "name": "payload_preferences_rels_users_fk", - "tableFrom": "payload_preferences_rels", - "tableTo": "users", - "columnsFrom": [ - "users_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.payload_migrations": { - "name": "payload_migrations", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "batch": { - "name": "batch", - "type": "numeric", - "primaryKey": false, - "notNull": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "payload_migrations_updated_at_idx": { - "name": "payload_migrations_updated_at_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_migrations_created_at_idx": { - "name": "payload_migrations_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.admin_settings": { - "name": "admin_settings", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "title": { - "name": "title", - "type": "varchar", - "primaryKey": false, - "notNull": false, - "default": "'管理员设置'" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.logs_manager": { - "name": "logs_manager", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "placeholder": { - "name": "placeholder", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.hero_slider_slides": { - "name": "hero_slider_slides", - "schema": "", - "columns": { - "_order": { - "name": "_order", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "_parent_id": { - "name": "_parent_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "title": { - "name": "title", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "subtitle": { - "name": "subtitle", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "image_id": { - "name": "image_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "image_mobile_id": { - "name": "image_mobile_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "link": { - "name": "link", - "type": "varchar", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "hero_slider_slides_order_idx": { - "name": "hero_slider_slides_order_idx", - "columns": [ - { - "expression": "_order", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "hero_slider_slides_parent_id_idx": { - "name": "hero_slider_slides_parent_id_idx", - "columns": [ - { - "expression": "_parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "hero_slider_slides_image_idx": { - "name": "hero_slider_slides_image_idx", - "columns": [ - { - "expression": "image_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "hero_slider_slides_image_mobile_idx": { - "name": "hero_slider_slides_image_mobile_idx", - "columns": [ - { - "expression": "image_mobile_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "hero_slider_slides_image_id_media_id_fk": { - "name": "hero_slider_slides_image_id_media_id_fk", - "tableFrom": "hero_slider_slides", - "tableTo": "media", - "columnsFrom": [ - "image_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "hero_slider_slides_image_mobile_id_media_id_fk": { - "name": "hero_slider_slides_image_mobile_id_media_id_fk", - "tableFrom": "hero_slider_slides", - "tableTo": "media", - "columnsFrom": [ - "image_mobile_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "hero_slider_slides_parent_id_fk": { - "name": "hero_slider_slides_parent_id_fk", - "tableFrom": "hero_slider_slides", - "tableTo": "hero_slider", - "columnsFrom": [ - "_parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.hero_slider": { - "name": "hero_slider", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.product_recommendations_lists": { - "name": "product_recommendations_lists", - "schema": "", - "columns": { - "_order": { - "name": "_order", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "_parent_id": { - "name": "_parent_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "title": { - "name": "title", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "subtitle": { - "name": "subtitle", - "type": "varchar", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "product_recommendations_lists_order_idx": { - "name": "product_recommendations_lists_order_idx", - "columns": [ - { - "expression": "_order", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "product_recommendations_lists_parent_id_idx": { - "name": "product_recommendations_lists_parent_id_idx", - "columns": [ - { - "expression": "_parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "product_recommendations_lists_parent_id_fk": { - "name": "product_recommendations_lists_parent_id_fk", - "tableFrom": "product_recommendations_lists", - "tableTo": "product_recommendations", - "columnsFrom": [ - "_parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.product_recommendations": { - "name": "product_recommendations", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "enabled": { - "name": "enabled", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": true - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.product_recommendations_rels": { - "name": "product_recommendations_rels", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "order": { - "name": "order", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "parent_id": { - "name": "parent_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "path": { - "name": "path", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "products_id": { - "name": "products_id", - "type": "integer", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "product_recommendations_rels_order_idx": { - "name": "product_recommendations_rels_order_idx", - "columns": [ - { - "expression": "order", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "product_recommendations_rels_parent_idx": { - "name": "product_recommendations_rels_parent_idx", - "columns": [ - { - "expression": "parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "product_recommendations_rels_path_idx": { - "name": "product_recommendations_rels_path_idx", - "columns": [ - { - "expression": "path", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "product_recommendations_rels_products_id_idx": { - "name": "product_recommendations_rels_products_id_idx", - "columns": [ - { - "expression": "products_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "product_recommendations_rels_parent_fk": { - "name": "product_recommendations_rels_parent_fk", - "tableFrom": "product_recommendations_rels", - "tableTo": "product_recommendations", - "columnsFrom": [ - "parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "product_recommendations_rels_products_fk": { - "name": "product_recommendations_rels_products_fk", - "tableFrom": "product_recommendations_rels", - "tableTo": "products", - "columnsFrom": [ - "products_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "public.enum_users_roles": { - "name": "enum_users_roles", - "schema": "public", - "values": [ - "admin", - "editor", - "user" - ] - }, - "public.enum_products_status": { - "name": "enum_products_status", - "schema": "public", - "values": [ - "draft", - "published" - ] - }, - "public.enum_announcements_type": { - "name": "enum_announcements_type", - "schema": "public", - "values": [ - "info", - "warning", - "important", - "urgent" - ] - }, - "public.enum_announcements_status": { - "name": "enum_announcements_status", - "schema": "public", - "values": [ - "draft", - "published", - "archived" - ] - }, - "public.enum_articles_status": { - "name": "enum_articles_status", - "schema": "public", - "values": [ - "draft", - "published" - ] - }, - "public.enum_articles_category": { - "name": "enum_articles_category", - "schema": "public", - "values": [ - "news", - "tutorial", - "tech", - "review", - "industry", - "other" - ] - }, - "public.enum__articles_v_version_status": { - "name": "enum__articles_v_version_status", - "schema": "public", - "values": [ - "draft", - "published" - ] - }, - "public.enum__articles_v_version_category": { - "name": "enum__articles_v_version_category", - "schema": "public", - "values": [ - "news", - "tutorial", - "tech", - "review", - "industry", - "other" - ] - }, - "public.enum_logs_action": { - "name": "enum_logs_action", - "schema": "public", - "values": [ - "create", - "update", - "delete", - "sync", - "login", - "logout" - ] - }, - "public.enum_payload_jobs_log_task_slug": { - "name": "enum_payload_jobs_log_task_slug", - "schema": "public", - "values": [ - "inline", - "schedulePublish" - ] - }, - "public.enum_payload_jobs_log_state": { - "name": "enum_payload_jobs_log_state", - "schema": "public", - "values": [ - "failed", - "succeeded" - ] - }, - "public.enum_payload_jobs_task_slug": { - "name": "enum_payload_jobs_task_slug", - "schema": "public", - "values": [ - "inline", - "schedulePublish" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "schemas": {}, - "tables": {}, - "columns": {} - }, - "id": "198f576a-c5d0-4f07-998b-9c04b7f3b5b9", - "prevId": "00000000-0000-0000-0000-000000000000" -} \ No newline at end of file diff --git a/src/migrations/20260212_193303.ts b/src/migrations/20260212_193303.ts deleted file mode 100644 index 91aa70f..0000000 --- a/src/migrations/20260212_193303.ts +++ /dev/null @@ -1,370 +0,0 @@ -import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres' - -export async function up({ db, payload, req }: MigrateUpArgs): Promise { - await db.execute(sql` - CREATE TYPE "public"."enum_users_roles" AS ENUM('admin', 'editor', 'user'); - CREATE TYPE "public"."enum_announcements_type" AS ENUM('info', 'warning', 'important', 'urgent'); - CREATE TYPE "public"."enum_announcements_status" AS ENUM('draft', 'published', 'archived'); - CREATE TYPE "public"."enum_articles_status" AS ENUM('draft', 'published'); - CREATE TYPE "public"."enum_articles_category" AS ENUM('news', 'tutorial', 'tech', 'review', 'industry', 'other'); - CREATE TYPE "public"."enum__articles_v_version_status" AS ENUM('draft', 'published'); - CREATE TYPE "public"."enum__articles_v_version_category" AS ENUM('news', 'tutorial', 'tech', 'review', 'industry', 'other'); - CREATE TYPE "public"."enum_logs_action" AS ENUM('create', 'update', 'delete', 'sync', 'login', 'logout'); - CREATE TYPE "public"."enum_payload_jobs_log_task_slug" AS ENUM('inline', 'schedulePublish'); - CREATE TYPE "public"."enum_payload_jobs_log_state" AS ENUM('failed', 'succeeded'); - CREATE TYPE "public"."enum_payload_jobs_task_slug" AS ENUM('inline', 'schedulePublish'); - CREATE TABLE "users_roles" ( - "order" integer NOT NULL, - "parent_id" integer NOT NULL, - "value" "enum_users_roles", - "id" serial PRIMARY KEY NOT NULL - ); - - CREATE TABLE "announcements" ( - "id" serial PRIMARY KEY NOT NULL, - "title" varchar NOT NULL, - "type" "enum_announcements_type" DEFAULT 'info' NOT NULL, - "status" "enum_announcements_status" DEFAULT 'draft' NOT NULL, - "priority" numeric DEFAULT 0, - "summary" varchar, - "content" jsonb NOT NULL, - "published_at" timestamp(3) with time zone, - "expires_at" timestamp(3) with time zone, - "show_on_homepage" boolean DEFAULT false, - "author_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 "articles" ( - "id" serial PRIMARY KEY NOT NULL, - "title" varchar, - "status" "enum_articles_status" DEFAULT 'draft', - "slug" varchar, - "featured_image_id" integer, - "excerpt" varchar, - "content" jsonb, - "category" "enum_articles_category", - "featured" boolean DEFAULT false, - "author_id" integer, - "published_at" timestamp(3) with time zone, - "meta_title" varchar, - "meta_description" varchar, - "updated_at" timestamp(3) with time zone DEFAULT now() NOT NULL, - "created_at" timestamp(3) with time zone DEFAULT now() NOT NULL, - "_status" "enum_articles_status" DEFAULT 'draft' - ); - - CREATE TABLE "articles_texts" ( - "id" serial PRIMARY KEY NOT NULL, - "order" integer NOT NULL, - "parent_id" integer NOT NULL, - "path" varchar NOT NULL, - "text" varchar - ); - - CREATE TABLE "articles_rels" ( - "id" serial PRIMARY KEY NOT NULL, - "order" integer, - "parent_id" integer NOT NULL, - "path" varchar NOT NULL, - "articles_id" integer, - "products_id" integer - ); - - CREATE TABLE "_articles_v" ( - "id" serial PRIMARY KEY NOT NULL, - "parent_id" integer, - "version_title" varchar, - "version_status" "enum__articles_v_version_status" DEFAULT 'draft', - "version_slug" varchar, - "version_featured_image_id" integer, - "version_excerpt" varchar, - "version_content" jsonb, - "version_category" "enum__articles_v_version_category", - "version_featured" boolean DEFAULT false, - "version_author_id" integer, - "version_published_at" timestamp(3) with time zone, - "version_meta_title" varchar, - "version_meta_description" varchar, - "version_updated_at" timestamp(3) with time zone, - "version_created_at" timestamp(3) with time zone, - "version__status" "enum__articles_v_version_status" DEFAULT 'draft', - "created_at" timestamp(3) with time zone DEFAULT now() NOT NULL, - "updated_at" timestamp(3) with time zone DEFAULT now() NOT NULL, - "latest" boolean, - "autosave" boolean - ); - - CREATE TABLE "_articles_v_texts" ( - "id" serial PRIMARY KEY NOT NULL, - "order" integer NOT NULL, - "parent_id" integer NOT NULL, - "path" varchar NOT NULL, - "text" varchar - ); - - CREATE TABLE "_articles_v_rels" ( - "id" serial PRIMARY KEY NOT NULL, - "order" integer, - "parent_id" integer NOT NULL, - "path" varchar NOT NULL, - "articles_id" integer, - "products_id" integer - ); - - CREATE TABLE "logs" ( - "id" serial PRIMARY KEY NOT NULL, - "action" "enum_logs_action" NOT NULL, - "collection" varchar NOT NULL, - "document_id" varchar, - "document_title" varchar, - "user_id" integer NOT NULL, - "changes" jsonb, - "ip" varchar, - "user_agent" 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_jobs_log" ( - "_order" integer NOT NULL, - "_parent_id" integer NOT NULL, - "id" varchar PRIMARY KEY NOT NULL, - "executed_at" timestamp(3) with time zone NOT NULL, - "completed_at" timestamp(3) with time zone NOT NULL, - "task_slug" "enum_payload_jobs_log_task_slug" NOT NULL, - "task_i_d" varchar NOT NULL, - "input" jsonb, - "output" jsonb, - "state" "enum_payload_jobs_log_state" NOT NULL, - "error" jsonb - ); - - CREATE TABLE "payload_jobs" ( - "id" serial PRIMARY KEY NOT NULL, - "input" jsonb, - "completed_at" timestamp(3) with time zone, - "total_tried" numeric DEFAULT 0, - "has_error" boolean DEFAULT false, - "error" jsonb, - "task_slug" "enum_payload_jobs_task_slug", - "queue" varchar DEFAULT 'default', - "wait_until" timestamp(3) with time zone, - "processing" boolean DEFAULT false, - "updated_at" timestamp(3) with time zone DEFAULT now() NOT NULL, - "created_at" timestamp(3) with time zone DEFAULT now() NOT NULL - ); - - CREATE TABLE "admin_settings" ( - "id" serial PRIMARY KEY NOT NULL, - "title" varchar DEFAULT '管理员设置', - "updated_at" timestamp(3) with time zone, - "created_at" timestamp(3) with time zone - ); - - CREATE TABLE "logs_manager" ( - "id" serial PRIMARY KEY NOT NULL, - "placeholder" varchar, - "updated_at" timestamp(3) with time zone, - "created_at" timestamp(3) with time zone - ); - - CREATE TABLE "hero_slider_slides" ( - "_order" integer NOT NULL, - "_parent_id" integer NOT NULL, - "id" varchar PRIMARY KEY NOT NULL, - "title" varchar NOT NULL, - "subtitle" varchar, - "image_id" integer NOT NULL, - "image_mobile_id" integer, - "link" varchar - ); - - CREATE TABLE "hero_slider" ( - "id" serial PRIMARY KEY NOT NULL, - "updated_at" timestamp(3) with time zone, - "created_at" timestamp(3) with time zone - ); - - CREATE TABLE "product_recommendations_lists" ( - "_order" integer NOT NULL, - "_parent_id" integer NOT NULL, - "id" varchar PRIMARY KEY NOT NULL, - "title" varchar NOT NULL, - "subtitle" varchar - ); - - CREATE TABLE "product_recommendations" ( - "id" serial PRIMARY KEY NOT NULL, - "enabled" boolean DEFAULT true, - "updated_at" timestamp(3) with time zone, - "created_at" timestamp(3) with time zone - ); - - CREATE TABLE "product_recommendations_rels" ( - "id" serial PRIMARY KEY NOT NULL, - "order" integer, - "parent_id" integer NOT NULL, - "path" varchar NOT NULL, - "products_id" integer - ); - - ALTER TABLE "products" ADD COLUMN "content" jsonb; - ALTER TABLE "payload_locked_documents_rels" ADD COLUMN "announcements_id" integer; - ALTER TABLE "payload_locked_documents_rels" ADD COLUMN "articles_id" integer; - ALTER TABLE "payload_locked_documents_rels" ADD COLUMN "logs_id" integer; - ALTER TABLE "users_roles" ADD CONSTRAINT "users_roles_parent_fk" FOREIGN KEY ("parent_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action; - ALTER TABLE "announcements" ADD CONSTRAINT "announcements_author_id_users_id_fk" FOREIGN KEY ("author_id") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action; - ALTER TABLE "articles" ADD CONSTRAINT "articles_featured_image_id_media_id_fk" FOREIGN KEY ("featured_image_id") REFERENCES "public"."media"("id") ON DELETE set null ON UPDATE no action; - ALTER TABLE "articles" ADD CONSTRAINT "articles_author_id_users_id_fk" FOREIGN KEY ("author_id") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action; - ALTER TABLE "articles_texts" ADD CONSTRAINT "articles_texts_parent_fk" FOREIGN KEY ("parent_id") REFERENCES "public"."articles"("id") ON DELETE cascade ON UPDATE no action; - ALTER TABLE "articles_rels" ADD CONSTRAINT "articles_rels_parent_fk" FOREIGN KEY ("parent_id") REFERENCES "public"."articles"("id") ON DELETE cascade ON UPDATE no action; - ALTER TABLE "articles_rels" ADD CONSTRAINT "articles_rels_articles_fk" FOREIGN KEY ("articles_id") REFERENCES "public"."articles"("id") ON DELETE cascade ON UPDATE no action; - ALTER TABLE "articles_rels" ADD CONSTRAINT "articles_rels_products_fk" FOREIGN KEY ("products_id") REFERENCES "public"."products"("id") ON DELETE cascade ON UPDATE no action; - ALTER TABLE "_articles_v" ADD CONSTRAINT "_articles_v_parent_id_articles_id_fk" FOREIGN KEY ("parent_id") REFERENCES "public"."articles"("id") ON DELETE set null ON UPDATE no action; - ALTER TABLE "_articles_v" ADD CONSTRAINT "_articles_v_version_featured_image_id_media_id_fk" FOREIGN KEY ("version_featured_image_id") REFERENCES "public"."media"("id") ON DELETE set null ON UPDATE no action; - ALTER TABLE "_articles_v" ADD CONSTRAINT "_articles_v_version_author_id_users_id_fk" FOREIGN KEY ("version_author_id") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action; - ALTER TABLE "_articles_v_texts" ADD CONSTRAINT "_articles_v_texts_parent_fk" FOREIGN KEY ("parent_id") REFERENCES "public"."_articles_v"("id") ON DELETE cascade ON UPDATE no action; - ALTER TABLE "_articles_v_rels" ADD CONSTRAINT "_articles_v_rels_parent_fk" FOREIGN KEY ("parent_id") REFERENCES "public"."_articles_v"("id") ON DELETE cascade ON UPDATE no action; - ALTER TABLE "_articles_v_rels" ADD CONSTRAINT "_articles_v_rels_articles_fk" FOREIGN KEY ("articles_id") REFERENCES "public"."articles"("id") ON DELETE cascade ON UPDATE no action; - ALTER TABLE "_articles_v_rels" ADD CONSTRAINT "_articles_v_rels_products_fk" FOREIGN KEY ("products_id") REFERENCES "public"."products"("id") ON DELETE cascade ON UPDATE no action; - ALTER TABLE "logs" ADD CONSTRAINT "logs_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE set null ON UPDATE no action; - ALTER TABLE "payload_jobs_log" ADD CONSTRAINT "payload_jobs_log_parent_id_fk" FOREIGN KEY ("_parent_id") REFERENCES "public"."payload_jobs"("id") ON DELETE cascade ON UPDATE no action; - ALTER TABLE "hero_slider_slides" ADD CONSTRAINT "hero_slider_slides_image_id_media_id_fk" FOREIGN KEY ("image_id") REFERENCES "public"."media"("id") ON DELETE set null ON UPDATE no action; - ALTER TABLE "hero_slider_slides" ADD CONSTRAINT "hero_slider_slides_image_mobile_id_media_id_fk" FOREIGN KEY ("image_mobile_id") REFERENCES "public"."media"("id") ON DELETE set null ON UPDATE no action; - ALTER TABLE "hero_slider_slides" ADD CONSTRAINT "hero_slider_slides_parent_id_fk" FOREIGN KEY ("_parent_id") REFERENCES "public"."hero_slider"("id") ON DELETE cascade ON UPDATE no action; - ALTER TABLE "product_recommendations_lists" ADD CONSTRAINT "product_recommendations_lists_parent_id_fk" FOREIGN KEY ("_parent_id") REFERENCES "public"."product_recommendations"("id") ON DELETE cascade ON UPDATE no action; - ALTER TABLE "product_recommendations_rels" ADD CONSTRAINT "product_recommendations_rels_parent_fk" FOREIGN KEY ("parent_id") REFERENCES "public"."product_recommendations"("id") ON DELETE cascade ON UPDATE no action; - ALTER TABLE "product_recommendations_rels" ADD CONSTRAINT "product_recommendations_rels_products_fk" FOREIGN KEY ("products_id") REFERENCES "public"."products"("id") ON DELETE cascade ON UPDATE no action; - CREATE INDEX "users_roles_order_idx" ON "users_roles" USING btree ("order"); - CREATE INDEX "users_roles_parent_idx" ON "users_roles" USING btree ("parent_id"); - CREATE INDEX "announcements_author_idx" ON "announcements" USING btree ("author_id"); - CREATE INDEX "announcements_updated_at_idx" ON "announcements" USING btree ("updated_at"); - CREATE INDEX "announcements_created_at_idx" ON "announcements" USING btree ("created_at"); - CREATE UNIQUE INDEX "articles_slug_idx" ON "articles" USING btree ("slug"); - CREATE INDEX "articles_featured_image_idx" ON "articles" USING btree ("featured_image_id"); - CREATE INDEX "articles_author_idx" ON "articles" USING btree ("author_id"); - CREATE INDEX "articles_updated_at_idx" ON "articles" USING btree ("updated_at"); - CREATE INDEX "articles_created_at_idx" ON "articles" USING btree ("created_at"); - CREATE INDEX "articles__status_idx" ON "articles" USING btree ("_status"); - CREATE INDEX "articles_texts_order_parent" ON "articles_texts" USING btree ("order","parent_id"); - CREATE INDEX "articles_rels_order_idx" ON "articles_rels" USING btree ("order"); - CREATE INDEX "articles_rels_parent_idx" ON "articles_rels" USING btree ("parent_id"); - CREATE INDEX "articles_rels_path_idx" ON "articles_rels" USING btree ("path"); - CREATE INDEX "articles_rels_articles_id_idx" ON "articles_rels" USING btree ("articles_id"); - CREATE INDEX "articles_rels_products_id_idx" ON "articles_rels" USING btree ("products_id"); - CREATE INDEX "_articles_v_parent_idx" ON "_articles_v" USING btree ("parent_id"); - CREATE INDEX "_articles_v_version_version_slug_idx" ON "_articles_v" USING btree ("version_slug"); - CREATE INDEX "_articles_v_version_version_featured_image_idx" ON "_articles_v" USING btree ("version_featured_image_id"); - CREATE INDEX "_articles_v_version_version_author_idx" ON "_articles_v" USING btree ("version_author_id"); - CREATE INDEX "_articles_v_version_version_updated_at_idx" ON "_articles_v" USING btree ("version_updated_at"); - CREATE INDEX "_articles_v_version_version_created_at_idx" ON "_articles_v" USING btree ("version_created_at"); - CREATE INDEX "_articles_v_version_version__status_idx" ON "_articles_v" USING btree ("version__status"); - CREATE INDEX "_articles_v_created_at_idx" ON "_articles_v" USING btree ("created_at"); - CREATE INDEX "_articles_v_updated_at_idx" ON "_articles_v" USING btree ("updated_at"); - CREATE INDEX "_articles_v_latest_idx" ON "_articles_v" USING btree ("latest"); - CREATE INDEX "_articles_v_autosave_idx" ON "_articles_v" USING btree ("autosave"); - CREATE INDEX "_articles_v_texts_order_parent" ON "_articles_v_texts" USING btree ("order","parent_id"); - CREATE INDEX "_articles_v_rels_order_idx" ON "_articles_v_rels" USING btree ("order"); - CREATE INDEX "_articles_v_rels_parent_idx" ON "_articles_v_rels" USING btree ("parent_id"); - CREATE INDEX "_articles_v_rels_path_idx" ON "_articles_v_rels" USING btree ("path"); - CREATE INDEX "_articles_v_rels_articles_id_idx" ON "_articles_v_rels" USING btree ("articles_id"); - CREATE INDEX "_articles_v_rels_products_id_idx" ON "_articles_v_rels" USING btree ("products_id"); - CREATE INDEX "logs_collection_idx" ON "logs" USING btree ("collection"); - CREATE INDEX "logs_document_id_idx" ON "logs" USING btree ("document_id"); - CREATE INDEX "logs_user_idx" ON "logs" USING btree ("user_id"); - CREATE INDEX "logs_updated_at_idx" ON "logs" USING btree ("updated_at"); - CREATE INDEX "logs_created_at_idx" ON "logs" USING btree ("created_at"); - CREATE INDEX "payload_jobs_log_order_idx" ON "payload_jobs_log" USING btree ("_order"); - CREATE INDEX "payload_jobs_log_parent_id_idx" ON "payload_jobs_log" USING btree ("_parent_id"); - CREATE INDEX "payload_jobs_completed_at_idx" ON "payload_jobs" USING btree ("completed_at"); - CREATE INDEX "payload_jobs_total_tried_idx" ON "payload_jobs" USING btree ("total_tried"); - CREATE INDEX "payload_jobs_has_error_idx" ON "payload_jobs" USING btree ("has_error"); - CREATE INDEX "payload_jobs_task_slug_idx" ON "payload_jobs" USING btree ("task_slug"); - CREATE INDEX "payload_jobs_queue_idx" ON "payload_jobs" USING btree ("queue"); - CREATE INDEX "payload_jobs_wait_until_idx" ON "payload_jobs" USING btree ("wait_until"); - CREATE INDEX "payload_jobs_processing_idx" ON "payload_jobs" USING btree ("processing"); - CREATE INDEX "payload_jobs_updated_at_idx" ON "payload_jobs" USING btree ("updated_at"); - CREATE INDEX "payload_jobs_created_at_idx" ON "payload_jobs" USING btree ("created_at"); - CREATE INDEX "hero_slider_slides_order_idx" ON "hero_slider_slides" USING btree ("_order"); - CREATE INDEX "hero_slider_slides_parent_id_idx" ON "hero_slider_slides" USING btree ("_parent_id"); - CREATE INDEX "hero_slider_slides_image_idx" ON "hero_slider_slides" USING btree ("image_id"); - CREATE INDEX "hero_slider_slides_image_mobile_idx" ON "hero_slider_slides" USING btree ("image_mobile_id"); - CREATE INDEX "product_recommendations_lists_order_idx" ON "product_recommendations_lists" USING btree ("_order"); - CREATE INDEX "product_recommendations_lists_parent_id_idx" ON "product_recommendations_lists" USING btree ("_parent_id"); - CREATE INDEX "product_recommendations_rels_order_idx" ON "product_recommendations_rels" USING btree ("order"); - CREATE INDEX "product_recommendations_rels_parent_idx" ON "product_recommendations_rels" USING btree ("parent_id"); - CREATE INDEX "product_recommendations_rels_path_idx" ON "product_recommendations_rels" USING btree ("path"); - CREATE INDEX "product_recommendations_rels_products_id_idx" ON "product_recommendations_rels" USING btree ("products_id"); - ALTER TABLE "payload_locked_documents_rels" ADD CONSTRAINT "payload_locked_documents_rels_announcements_fk" FOREIGN KEY ("announcements_id") REFERENCES "public"."announcements"("id") ON DELETE cascade ON UPDATE no action; - ALTER TABLE "payload_locked_documents_rels" ADD CONSTRAINT "payload_locked_documents_rels_articles_fk" FOREIGN KEY ("articles_id") REFERENCES "public"."articles"("id") ON DELETE cascade ON UPDATE no action; - ALTER TABLE "payload_locked_documents_rels" ADD CONSTRAINT "payload_locked_documents_rels_logs_fk" FOREIGN KEY ("logs_id") REFERENCES "public"."logs"("id") ON DELETE cascade ON UPDATE no action; - CREATE INDEX "payload_locked_documents_rels_announcements_id_idx" ON "payload_locked_documents_rels" USING btree ("announcements_id"); - CREATE INDEX "payload_locked_documents_rels_articles_id_idx" ON "payload_locked_documents_rels" USING btree ("articles_id"); - CREATE INDEX "payload_locked_documents_rels_logs_id_idx" ON "payload_locked_documents_rels" USING btree ("logs_id");`) -} - -export async function down({ db, payload, req }: MigrateDownArgs): Promise { - await db.execute(sql` - ALTER TABLE "users_roles" DISABLE ROW LEVEL SECURITY; - ALTER TABLE "announcements" DISABLE ROW LEVEL SECURITY; - ALTER TABLE "articles" DISABLE ROW LEVEL SECURITY; - ALTER TABLE "articles_texts" DISABLE ROW LEVEL SECURITY; - ALTER TABLE "articles_rels" DISABLE ROW LEVEL SECURITY; - ALTER TABLE "_articles_v" DISABLE ROW LEVEL SECURITY; - ALTER TABLE "_articles_v_texts" DISABLE ROW LEVEL SECURITY; - ALTER TABLE "_articles_v_rels" DISABLE ROW LEVEL SECURITY; - ALTER TABLE "logs" DISABLE ROW LEVEL SECURITY; - ALTER TABLE "payload_jobs_log" DISABLE ROW LEVEL SECURITY; - ALTER TABLE "payload_jobs" DISABLE ROW LEVEL SECURITY; - ALTER TABLE "admin_settings" DISABLE ROW LEVEL SECURITY; - ALTER TABLE "logs_manager" DISABLE ROW LEVEL SECURITY; - ALTER TABLE "hero_slider_slides" DISABLE ROW LEVEL SECURITY; - ALTER TABLE "hero_slider" DISABLE ROW LEVEL SECURITY; - ALTER TABLE "product_recommendations_lists" DISABLE ROW LEVEL SECURITY; - ALTER TABLE "product_recommendations" DISABLE ROW LEVEL SECURITY; - ALTER TABLE "product_recommendations_rels" DISABLE ROW LEVEL SECURITY; - DROP TABLE "users_roles" CASCADE; - DROP TABLE "announcements" CASCADE; - DROP TABLE "articles" CASCADE; - DROP TABLE "articles_texts" CASCADE; - DROP TABLE "articles_rels" CASCADE; - DROP TABLE "_articles_v" CASCADE; - DROP TABLE "_articles_v_texts" CASCADE; - DROP TABLE "_articles_v_rels" CASCADE; - DROP TABLE "logs" CASCADE; - DROP TABLE "payload_jobs_log" CASCADE; - DROP TABLE "payload_jobs" CASCADE; - DROP TABLE "admin_settings" CASCADE; - DROP TABLE "logs_manager" CASCADE; - DROP TABLE "hero_slider_slides" CASCADE; - DROP TABLE "hero_slider" CASCADE; - DROP TABLE "product_recommendations_lists" CASCADE; - DROP TABLE "product_recommendations" CASCADE; - DROP TABLE "product_recommendations_rels" CASCADE; - ALTER TABLE "payload_locked_documents_rels" DROP CONSTRAINT "payload_locked_documents_rels_announcements_fk"; - - ALTER TABLE "payload_locked_documents_rels" DROP CONSTRAINT "payload_locked_documents_rels_articles_fk"; - - ALTER TABLE "payload_locked_documents_rels" DROP CONSTRAINT "payload_locked_documents_rels_logs_fk"; - - DROP INDEX "payload_locked_documents_rels_announcements_id_idx"; - DROP INDEX "payload_locked_documents_rels_articles_id_idx"; - DROP INDEX "payload_locked_documents_rels_logs_id_idx"; - ALTER TABLE "products" DROP COLUMN "content"; - ALTER TABLE "payload_locked_documents_rels" DROP COLUMN "announcements_id"; - ALTER TABLE "payload_locked_documents_rels" DROP COLUMN "articles_id"; - ALTER TABLE "payload_locked_documents_rels" DROP COLUMN "logs_id"; - DROP TYPE "public"."enum_users_roles"; - DROP TYPE "public"."enum_announcements_type"; - DROP TYPE "public"."enum_announcements_status"; - DROP TYPE "public"."enum_articles_status"; - DROP TYPE "public"."enum_articles_category"; - DROP TYPE "public"."enum__articles_v_version_status"; - DROP TYPE "public"."enum__articles_v_version_category"; - DROP TYPE "public"."enum_logs_action"; - DROP TYPE "public"."enum_payload_jobs_log_task_slug"; - DROP TYPE "public"."enum_payload_jobs_log_state"; - DROP TYPE "public"."enum_payload_jobs_task_slug";`) -} diff --git a/src/migrations/20260212_202303.json b/src/migrations/20260212_202303.json deleted file mode 100644 index 6e71348..0000000 --- a/src/migrations/20260212_202303.json +++ /dev/null @@ -1,4563 +0,0 @@ -{ - "version": "7", - "dialect": "postgresql", - "tables": { - "public.users_roles": { - "name": "users_roles", - "schema": "", - "columns": { - "order": { - "name": "order", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "parent_id": { - "name": "parent_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "value": { - "name": "value", - "type": "enum_users_roles", - "typeSchema": "public", - "primaryKey": false, - "notNull": false - }, - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - } - }, - "indexes": { - "users_roles_order_idx": { - "name": "users_roles_order_idx", - "columns": [ - { - "expression": "order", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_roles_parent_idx": { - "name": "users_roles_parent_idx", - "columns": [ - { - "expression": "parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "users_roles_parent_fk": { - "name": "users_roles_parent_fk", - "tableFrom": "users_roles", - "tableTo": "users", - "columnsFrom": [ - "parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.users_sessions": { - "name": "users_sessions", - "schema": "", - "columns": { - "_order": { - "name": "_order", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "_parent_id": { - "name": "_parent_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "users_sessions_order_idx": { - "name": "users_sessions_order_idx", - "columns": [ - { - "expression": "_order", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_sessions_parent_id_idx": { - "name": "users_sessions_parent_id_idx", - "columns": [ - { - "expression": "_parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "users_sessions_parent_id_fk": { - "name": "users_sessions_parent_id_fk", - "tableFrom": "users_sessions", - "tableTo": "users", - "columnsFrom": [ - "_parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.users": { - "name": "users", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "email": { - "name": "email", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "reset_password_token": { - "name": "reset_password_token", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "reset_password_expiration": { - "name": "reset_password_expiration", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "salt": { - "name": "salt", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "hash": { - "name": "hash", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "login_attempts": { - "name": "login_attempts", - "type": "numeric", - "primaryKey": false, - "notNull": false, - "default": 0 - }, - "lock_until": { - "name": "lock_until", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "users_updated_at_idx": { - "name": "users_updated_at_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_created_at_idx": { - "name": "users_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_email_idx": { - "name": "users_email_idx", - "columns": [ - { - "expression": "email", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.media": { - "name": "media", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "alt": { - "name": "alt", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "url": { - "name": "url", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "thumbnail_u_r_l": { - "name": "thumbnail_u_r_l", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "filename": { - "name": "filename", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "mime_type": { - "name": "mime_type", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "filesize": { - "name": "filesize", - "type": "numeric", - "primaryKey": false, - "notNull": false - }, - "width": { - "name": "width", - "type": "numeric", - "primaryKey": false, - "notNull": false - }, - "height": { - "name": "height", - "type": "numeric", - "primaryKey": false, - "notNull": false - }, - "focal_x": { - "name": "focal_x", - "type": "numeric", - "primaryKey": false, - "notNull": false - }, - "focal_y": { - "name": "focal_y", - "type": "numeric", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "media_updated_at_idx": { - "name": "media_updated_at_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "media_created_at_idx": { - "name": "media_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "media_filename_idx": { - "name": "media_filename_idx", - "columns": [ - { - "expression": "filename", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.products": { - "name": "products", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "medusa_id": { - "name": "medusa_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "enum_products_status", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'draft'" - }, - "title": { - "name": "title", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "handle": { - "name": "handle", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "thumbnail": { - "name": "thumbnail", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "last_synced_at": { - "name": "last_synced_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "content": { - "name": "content", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "products_medusa_id_idx": { - "name": "products_medusa_id_idx", - "columns": [ - { - "expression": "medusa_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - }, - "products_updated_at_idx": { - "name": "products_updated_at_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "products_created_at_idx": { - "name": "products_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.products_rels": { - "name": "products_rels", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "order": { - "name": "order", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "parent_id": { - "name": "parent_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "path": { - "name": "path", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "products_id": { - "name": "products_id", - "type": "integer", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "products_rels_order_idx": { - "name": "products_rels_order_idx", - "columns": [ - { - "expression": "order", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "products_rels_parent_idx": { - "name": "products_rels_parent_idx", - "columns": [ - { - "expression": "parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "products_rels_path_idx": { - "name": "products_rels_path_idx", - "columns": [ - { - "expression": "path", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "products_rels_products_id_idx": { - "name": "products_rels_products_id_idx", - "columns": [ - { - "expression": "products_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "products_rels_parent_fk": { - "name": "products_rels_parent_fk", - "tableFrom": "products_rels", - "tableTo": "products", - "columnsFrom": [ - "parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "products_rels_products_fk": { - "name": "products_rels_products_fk", - "tableFrom": "products_rels", - "tableTo": "products", - "columnsFrom": [ - "products_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.preorder_products": { - "name": "preorder_products", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "medusa_id": { - "name": "medusa_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "enum_preorder_products_status", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'draft'" - }, - "title": { - "name": "title", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "handle": { - "name": "handle", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "thumbnail": { - "name": "thumbnail", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "last_synced_at": { - "name": "last_synced_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "description": { - "name": "description", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "preorder_products_medusa_id_idx": { - "name": "preorder_products_medusa_id_idx", - "columns": [ - { - "expression": "medusa_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - }, - "preorder_products_updated_at_idx": { - "name": "preorder_products_updated_at_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "preorder_products_created_at_idx": { - "name": "preorder_products_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.preorder_products_rels": { - "name": "preorder_products_rels", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "order": { - "name": "order", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "parent_id": { - "name": "parent_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "path": { - "name": "path", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "preorder_products_id": { - "name": "preorder_products_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "order_products_id": { - "name": "order_products_id", - "type": "integer", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "preorder_products_rels_order_idx": { - "name": "preorder_products_rels_order_idx", - "columns": [ - { - "expression": "order", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "preorder_products_rels_parent_idx": { - "name": "preorder_products_rels_parent_idx", - "columns": [ - { - "expression": "parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "preorder_products_rels_path_idx": { - "name": "preorder_products_rels_path_idx", - "columns": [ - { - "expression": "path", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "preorder_products_rels_preorder_products_id_idx": { - "name": "preorder_products_rels_preorder_products_id_idx", - "columns": [ - { - "expression": "preorder_products_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "preorder_products_rels_order_products_id_idx": { - "name": "preorder_products_rels_order_products_id_idx", - "columns": [ - { - "expression": "order_products_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "preorder_products_rels_parent_fk": { - "name": "preorder_products_rels_parent_fk", - "tableFrom": "preorder_products_rels", - "tableTo": "preorder_products", - "columnsFrom": [ - "parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "preorder_products_rels_preorder_products_fk": { - "name": "preorder_products_rels_preorder_products_fk", - "tableFrom": "preorder_products_rels", - "tableTo": "preorder_products", - "columnsFrom": [ - "preorder_products_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "preorder_products_rels_order_products_fk": { - "name": "preorder_products_rels_order_products_fk", - "tableFrom": "preorder_products_rels", - "tableTo": "order_products", - "columnsFrom": [ - "order_products_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.order_products": { - "name": "order_products", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "medusa_id": { - "name": "medusa_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "status": { - "name": "status", - "type": "enum_order_products_status", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'draft'" - }, - "title": { - "name": "title", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "handle": { - "name": "handle", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "thumbnail": { - "name": "thumbnail", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "last_synced_at": { - "name": "last_synced_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "description": { - "name": "description", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "order_products_medusa_id_idx": { - "name": "order_products_medusa_id_idx", - "columns": [ - { - "expression": "medusa_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - }, - "order_products_updated_at_idx": { - "name": "order_products_updated_at_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "order_products_created_at_idx": { - "name": "order_products_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.order_products_rels": { - "name": "order_products_rels", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "order": { - "name": "order", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "parent_id": { - "name": "parent_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "path": { - "name": "path", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "preorder_products_id": { - "name": "preorder_products_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "order_products_id": { - "name": "order_products_id", - "type": "integer", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "order_products_rels_order_idx": { - "name": "order_products_rels_order_idx", - "columns": [ - { - "expression": "order", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "order_products_rels_parent_idx": { - "name": "order_products_rels_parent_idx", - "columns": [ - { - "expression": "parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "order_products_rels_path_idx": { - "name": "order_products_rels_path_idx", - "columns": [ - { - "expression": "path", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "order_products_rels_preorder_products_id_idx": { - "name": "order_products_rels_preorder_products_id_idx", - "columns": [ - { - "expression": "preorder_products_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "order_products_rels_order_products_id_idx": { - "name": "order_products_rels_order_products_id_idx", - "columns": [ - { - "expression": "order_products_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "order_products_rels_parent_fk": { - "name": "order_products_rels_parent_fk", - "tableFrom": "order_products_rels", - "tableTo": "order_products", - "columnsFrom": [ - "parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "order_products_rels_preorder_products_fk": { - "name": "order_products_rels_preorder_products_fk", - "tableFrom": "order_products_rels", - "tableTo": "preorder_products", - "columnsFrom": [ - "preorder_products_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "order_products_rels_order_products_fk": { - "name": "order_products_rels_order_products_fk", - "tableFrom": "order_products_rels", - "tableTo": "order_products", - "columnsFrom": [ - "order_products_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.announcements": { - "name": "announcements", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "title": { - "name": "title", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "enum_announcements_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'info'" - }, - "status": { - "name": "status", - "type": "enum_announcements_status", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'draft'" - }, - "priority": { - "name": "priority", - "type": "numeric", - "primaryKey": false, - "notNull": false, - "default": 0 - }, - "summary": { - "name": "summary", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "content": { - "name": "content", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "published_at": { - "name": "published_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "show_on_homepage": { - "name": "show_on_homepage", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "author_id": { - "name": "author_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "announcements_author_idx": { - "name": "announcements_author_idx", - "columns": [ - { - "expression": "author_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "announcements_updated_at_idx": { - "name": "announcements_updated_at_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "announcements_created_at_idx": { - "name": "announcements_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "announcements_author_id_users_id_fk": { - "name": "announcements_author_id_users_id_fk", - "tableFrom": "announcements", - "tableTo": "users", - "columnsFrom": [ - "author_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.articles": { - "name": "articles", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "title": { - "name": "title", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "enum_articles_status", - "typeSchema": "public", - "primaryKey": false, - "notNull": false, - "default": "'draft'" - }, - "slug": { - "name": "slug", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "featured_image_id": { - "name": "featured_image_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "excerpt": { - "name": "excerpt", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "content": { - "name": "content", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "category": { - "name": "category", - "type": "enum_articles_category", - "typeSchema": "public", - "primaryKey": false, - "notNull": false - }, - "featured": { - "name": "featured", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "author_id": { - "name": "author_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "published_at": { - "name": "published_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "meta_title": { - "name": "meta_title", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "meta_description": { - "name": "meta_description", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "_status": { - "name": "_status", - "type": "enum_articles_status", - "typeSchema": "public", - "primaryKey": false, - "notNull": false, - "default": "'draft'" - } - }, - "indexes": { - "articles_slug_idx": { - "name": "articles_slug_idx", - "columns": [ - { - "expression": "slug", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - }, - "articles_featured_image_idx": { - "name": "articles_featured_image_idx", - "columns": [ - { - "expression": "featured_image_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "articles_author_idx": { - "name": "articles_author_idx", - "columns": [ - { - "expression": "author_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "articles_updated_at_idx": { - "name": "articles_updated_at_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "articles_created_at_idx": { - "name": "articles_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "articles__status_idx": { - "name": "articles__status_idx", - "columns": [ - { - "expression": "_status", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "articles_featured_image_id_media_id_fk": { - "name": "articles_featured_image_id_media_id_fk", - "tableFrom": "articles", - "tableTo": "media", - "columnsFrom": [ - "featured_image_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "articles_author_id_users_id_fk": { - "name": "articles_author_id_users_id_fk", - "tableFrom": "articles", - "tableTo": "users", - "columnsFrom": [ - "author_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.articles_texts": { - "name": "articles_texts", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "order": { - "name": "order", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "parent_id": { - "name": "parent_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "path": { - "name": "path", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "text": { - "name": "text", - "type": "varchar", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "articles_texts_order_parent": { - "name": "articles_texts_order_parent", - "columns": [ - { - "expression": "order", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "articles_texts_parent_fk": { - "name": "articles_texts_parent_fk", - "tableFrom": "articles_texts", - "tableTo": "articles", - "columnsFrom": [ - "parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.articles_rels": { - "name": "articles_rels", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "order": { - "name": "order", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "parent_id": { - "name": "parent_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "path": { - "name": "path", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "articles_id": { - "name": "articles_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "products_id": { - "name": "products_id", - "type": "integer", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "articles_rels_order_idx": { - "name": "articles_rels_order_idx", - "columns": [ - { - "expression": "order", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "articles_rels_parent_idx": { - "name": "articles_rels_parent_idx", - "columns": [ - { - "expression": "parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "articles_rels_path_idx": { - "name": "articles_rels_path_idx", - "columns": [ - { - "expression": "path", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "articles_rels_articles_id_idx": { - "name": "articles_rels_articles_id_idx", - "columns": [ - { - "expression": "articles_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "articles_rels_products_id_idx": { - "name": "articles_rels_products_id_idx", - "columns": [ - { - "expression": "products_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "articles_rels_parent_fk": { - "name": "articles_rels_parent_fk", - "tableFrom": "articles_rels", - "tableTo": "articles", - "columnsFrom": [ - "parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "articles_rels_articles_fk": { - "name": "articles_rels_articles_fk", - "tableFrom": "articles_rels", - "tableTo": "articles", - "columnsFrom": [ - "articles_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "articles_rels_products_fk": { - "name": "articles_rels_products_fk", - "tableFrom": "articles_rels", - "tableTo": "products", - "columnsFrom": [ - "products_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public._articles_v": { - "name": "_articles_v", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "parent_id": { - "name": "parent_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "version_title": { - "name": "version_title", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "version_status": { - "name": "version_status", - "type": "enum__articles_v_version_status", - "typeSchema": "public", - "primaryKey": false, - "notNull": false, - "default": "'draft'" - }, - "version_slug": { - "name": "version_slug", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "version_featured_image_id": { - "name": "version_featured_image_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "version_excerpt": { - "name": "version_excerpt", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "version_content": { - "name": "version_content", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "version_category": { - "name": "version_category", - "type": "enum__articles_v_version_category", - "typeSchema": "public", - "primaryKey": false, - "notNull": false - }, - "version_featured": { - "name": "version_featured", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "version_author_id": { - "name": "version_author_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "version_published_at": { - "name": "version_published_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "version_meta_title": { - "name": "version_meta_title", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "version_meta_description": { - "name": "version_meta_description", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "version_updated_at": { - "name": "version_updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "version_created_at": { - "name": "version_created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "version__status": { - "name": "version__status", - "type": "enum__articles_v_version_status", - "typeSchema": "public", - "primaryKey": false, - "notNull": false, - "default": "'draft'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "latest": { - "name": "latest", - "type": "boolean", - "primaryKey": false, - "notNull": false - }, - "autosave": { - "name": "autosave", - "type": "boolean", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "_articles_v_parent_idx": { - "name": "_articles_v_parent_idx", - "columns": [ - { - "expression": "parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "_articles_v_version_version_slug_idx": { - "name": "_articles_v_version_version_slug_idx", - "columns": [ - { - "expression": "version_slug", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "_articles_v_version_version_featured_image_idx": { - "name": "_articles_v_version_version_featured_image_idx", - "columns": [ - { - "expression": "version_featured_image_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "_articles_v_version_version_author_idx": { - "name": "_articles_v_version_version_author_idx", - "columns": [ - { - "expression": "version_author_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "_articles_v_version_version_updated_at_idx": { - "name": "_articles_v_version_version_updated_at_idx", - "columns": [ - { - "expression": "version_updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "_articles_v_version_version_created_at_idx": { - "name": "_articles_v_version_version_created_at_idx", - "columns": [ - { - "expression": "version_created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "_articles_v_version_version__status_idx": { - "name": "_articles_v_version_version__status_idx", - "columns": [ - { - "expression": "version__status", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "_articles_v_created_at_idx": { - "name": "_articles_v_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "_articles_v_updated_at_idx": { - "name": "_articles_v_updated_at_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "_articles_v_latest_idx": { - "name": "_articles_v_latest_idx", - "columns": [ - { - "expression": "latest", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "_articles_v_autosave_idx": { - "name": "_articles_v_autosave_idx", - "columns": [ - { - "expression": "autosave", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "_articles_v_parent_id_articles_id_fk": { - "name": "_articles_v_parent_id_articles_id_fk", - "tableFrom": "_articles_v", - "tableTo": "articles", - "columnsFrom": [ - "parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "_articles_v_version_featured_image_id_media_id_fk": { - "name": "_articles_v_version_featured_image_id_media_id_fk", - "tableFrom": "_articles_v", - "tableTo": "media", - "columnsFrom": [ - "version_featured_image_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "_articles_v_version_author_id_users_id_fk": { - "name": "_articles_v_version_author_id_users_id_fk", - "tableFrom": "_articles_v", - "tableTo": "users", - "columnsFrom": [ - "version_author_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public._articles_v_texts": { - "name": "_articles_v_texts", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "order": { - "name": "order", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "parent_id": { - "name": "parent_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "path": { - "name": "path", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "text": { - "name": "text", - "type": "varchar", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "_articles_v_texts_order_parent": { - "name": "_articles_v_texts_order_parent", - "columns": [ - { - "expression": "order", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "_articles_v_texts_parent_fk": { - "name": "_articles_v_texts_parent_fk", - "tableFrom": "_articles_v_texts", - "tableTo": "_articles_v", - "columnsFrom": [ - "parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public._articles_v_rels": { - "name": "_articles_v_rels", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "order": { - "name": "order", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "parent_id": { - "name": "parent_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "path": { - "name": "path", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "articles_id": { - "name": "articles_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "products_id": { - "name": "products_id", - "type": "integer", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "_articles_v_rels_order_idx": { - "name": "_articles_v_rels_order_idx", - "columns": [ - { - "expression": "order", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "_articles_v_rels_parent_idx": { - "name": "_articles_v_rels_parent_idx", - "columns": [ - { - "expression": "parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "_articles_v_rels_path_idx": { - "name": "_articles_v_rels_path_idx", - "columns": [ - { - "expression": "path", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "_articles_v_rels_articles_id_idx": { - "name": "_articles_v_rels_articles_id_idx", - "columns": [ - { - "expression": "articles_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "_articles_v_rels_products_id_idx": { - "name": "_articles_v_rels_products_id_idx", - "columns": [ - { - "expression": "products_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "_articles_v_rels_parent_fk": { - "name": "_articles_v_rels_parent_fk", - "tableFrom": "_articles_v_rels", - "tableTo": "_articles_v", - "columnsFrom": [ - "parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "_articles_v_rels_articles_fk": { - "name": "_articles_v_rels_articles_fk", - "tableFrom": "_articles_v_rels", - "tableTo": "articles", - "columnsFrom": [ - "articles_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "_articles_v_rels_products_fk": { - "name": "_articles_v_rels_products_fk", - "tableFrom": "_articles_v_rels", - "tableTo": "products", - "columnsFrom": [ - "products_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.logs": { - "name": "logs", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "action": { - "name": "action", - "type": "enum_logs_action", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "collection": { - "name": "collection", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "document_id": { - "name": "document_id", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "document_title": { - "name": "document_title", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "user_id": { - "name": "user_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "changes": { - "name": "changes", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "ip": { - "name": "ip", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "user_agent": { - "name": "user_agent", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "logs_collection_idx": { - "name": "logs_collection_idx", - "columns": [ - { - "expression": "collection", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "logs_document_id_idx": { - "name": "logs_document_id_idx", - "columns": [ - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "logs_user_idx": { - "name": "logs_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "logs_updated_at_idx": { - "name": "logs_updated_at_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "logs_created_at_idx": { - "name": "logs_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "logs_user_id_users_id_fk": { - "name": "logs_user_id_users_id_fk", - "tableFrom": "logs", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.payload_kv": { - "name": "payload_kv", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "key": { - "name": "key", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "data": { - "name": "data", - "type": "jsonb", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "payload_kv_key_idx": { - "name": "payload_kv_key_idx", - "columns": [ - { - "expression": "key", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.payload_jobs_log": { - "name": "payload_jobs_log", - "schema": "", - "columns": { - "_order": { - "name": "_order", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "_parent_id": { - "name": "_parent_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "executed_at": { - "name": "executed_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true - }, - "task_slug": { - "name": "task_slug", - "type": "enum_payload_jobs_log_task_slug", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "task_i_d": { - "name": "task_i_d", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "input": { - "name": "input", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "output": { - "name": "output", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "state": { - "name": "state", - "type": "enum_payload_jobs_log_state", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "error": { - "name": "error", - "type": "jsonb", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "payload_jobs_log_order_idx": { - "name": "payload_jobs_log_order_idx", - "columns": [ - { - "expression": "_order", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_jobs_log_parent_id_idx": { - "name": "payload_jobs_log_parent_id_idx", - "columns": [ - { - "expression": "_parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "payload_jobs_log_parent_id_fk": { - "name": "payload_jobs_log_parent_id_fk", - "tableFrom": "payload_jobs_log", - "tableTo": "payload_jobs", - "columnsFrom": [ - "_parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.payload_jobs": { - "name": "payload_jobs", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "input": { - "name": "input", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "total_tried": { - "name": "total_tried", - "type": "numeric", - "primaryKey": false, - "notNull": false, - "default": 0 - }, - "has_error": { - "name": "has_error", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "error": { - "name": "error", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "task_slug": { - "name": "task_slug", - "type": "enum_payload_jobs_task_slug", - "typeSchema": "public", - "primaryKey": false, - "notNull": false - }, - "queue": { - "name": "queue", - "type": "varchar", - "primaryKey": false, - "notNull": false, - "default": "'default'" - }, - "wait_until": { - "name": "wait_until", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "processing": { - "name": "processing", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "payload_jobs_completed_at_idx": { - "name": "payload_jobs_completed_at_idx", - "columns": [ - { - "expression": "completed_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_jobs_total_tried_idx": { - "name": "payload_jobs_total_tried_idx", - "columns": [ - { - "expression": "total_tried", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_jobs_has_error_idx": { - "name": "payload_jobs_has_error_idx", - "columns": [ - { - "expression": "has_error", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_jobs_task_slug_idx": { - "name": "payload_jobs_task_slug_idx", - "columns": [ - { - "expression": "task_slug", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_jobs_queue_idx": { - "name": "payload_jobs_queue_idx", - "columns": [ - { - "expression": "queue", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_jobs_wait_until_idx": { - "name": "payload_jobs_wait_until_idx", - "columns": [ - { - "expression": "wait_until", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_jobs_processing_idx": { - "name": "payload_jobs_processing_idx", - "columns": [ - { - "expression": "processing", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_jobs_updated_at_idx": { - "name": "payload_jobs_updated_at_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_jobs_created_at_idx": { - "name": "payload_jobs_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.payload_locked_documents": { - "name": "payload_locked_documents", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "global_slug": { - "name": "global_slug", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "payload_locked_documents_global_slug_idx": { - "name": "payload_locked_documents_global_slug_idx", - "columns": [ - { - "expression": "global_slug", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_locked_documents_updated_at_idx": { - "name": "payload_locked_documents_updated_at_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_locked_documents_created_at_idx": { - "name": "payload_locked_documents_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.payload_locked_documents_rels": { - "name": "payload_locked_documents_rels", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "order": { - "name": "order", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "parent_id": { - "name": "parent_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "path": { - "name": "path", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "users_id": { - "name": "users_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "media_id": { - "name": "media_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "products_id": { - "name": "products_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "preorder_products_id": { - "name": "preorder_products_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "order_products_id": { - "name": "order_products_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "announcements_id": { - "name": "announcements_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "articles_id": { - "name": "articles_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "logs_id": { - "name": "logs_id", - "type": "integer", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "payload_locked_documents_rels_order_idx": { - "name": "payload_locked_documents_rels_order_idx", - "columns": [ - { - "expression": "order", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_locked_documents_rels_parent_idx": { - "name": "payload_locked_documents_rels_parent_idx", - "columns": [ - { - "expression": "parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_locked_documents_rels_path_idx": { - "name": "payload_locked_documents_rels_path_idx", - "columns": [ - { - "expression": "path", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_locked_documents_rels_users_id_idx": { - "name": "payload_locked_documents_rels_users_id_idx", - "columns": [ - { - "expression": "users_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_locked_documents_rels_media_id_idx": { - "name": "payload_locked_documents_rels_media_id_idx", - "columns": [ - { - "expression": "media_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_locked_documents_rels_products_id_idx": { - "name": "payload_locked_documents_rels_products_id_idx", - "columns": [ - { - "expression": "products_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_locked_documents_rels_preorder_products_id_idx": { - "name": "payload_locked_documents_rels_preorder_products_id_idx", - "columns": [ - { - "expression": "preorder_products_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_locked_documents_rels_order_products_id_idx": { - "name": "payload_locked_documents_rels_order_products_id_idx", - "columns": [ - { - "expression": "order_products_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_locked_documents_rels_announcements_id_idx": { - "name": "payload_locked_documents_rels_announcements_id_idx", - "columns": [ - { - "expression": "announcements_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_locked_documents_rels_articles_id_idx": { - "name": "payload_locked_documents_rels_articles_id_idx", - "columns": [ - { - "expression": "articles_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_locked_documents_rels_logs_id_idx": { - "name": "payload_locked_documents_rels_logs_id_idx", - "columns": [ - { - "expression": "logs_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "payload_locked_documents_rels_parent_fk": { - "name": "payload_locked_documents_rels_parent_fk", - "tableFrom": "payload_locked_documents_rels", - "tableTo": "payload_locked_documents", - "columnsFrom": [ - "parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "payload_locked_documents_rels_users_fk": { - "name": "payload_locked_documents_rels_users_fk", - "tableFrom": "payload_locked_documents_rels", - "tableTo": "users", - "columnsFrom": [ - "users_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "payload_locked_documents_rels_media_fk": { - "name": "payload_locked_documents_rels_media_fk", - "tableFrom": "payload_locked_documents_rels", - "tableTo": "media", - "columnsFrom": [ - "media_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "payload_locked_documents_rels_products_fk": { - "name": "payload_locked_documents_rels_products_fk", - "tableFrom": "payload_locked_documents_rels", - "tableTo": "products", - "columnsFrom": [ - "products_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "payload_locked_documents_rels_preorder_products_fk": { - "name": "payload_locked_documents_rels_preorder_products_fk", - "tableFrom": "payload_locked_documents_rels", - "tableTo": "preorder_products", - "columnsFrom": [ - "preorder_products_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "payload_locked_documents_rels_order_products_fk": { - "name": "payload_locked_documents_rels_order_products_fk", - "tableFrom": "payload_locked_documents_rels", - "tableTo": "order_products", - "columnsFrom": [ - "order_products_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "payload_locked_documents_rels_announcements_fk": { - "name": "payload_locked_documents_rels_announcements_fk", - "tableFrom": "payload_locked_documents_rels", - "tableTo": "announcements", - "columnsFrom": [ - "announcements_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "payload_locked_documents_rels_articles_fk": { - "name": "payload_locked_documents_rels_articles_fk", - "tableFrom": "payload_locked_documents_rels", - "tableTo": "articles", - "columnsFrom": [ - "articles_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "payload_locked_documents_rels_logs_fk": { - "name": "payload_locked_documents_rels_logs_fk", - "tableFrom": "payload_locked_documents_rels", - "tableTo": "logs", - "columnsFrom": [ - "logs_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.payload_preferences": { - "name": "payload_preferences", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "key": { - "name": "key", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "value": { - "name": "value", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "payload_preferences_key_idx": { - "name": "payload_preferences_key_idx", - "columns": [ - { - "expression": "key", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_preferences_updated_at_idx": { - "name": "payload_preferences_updated_at_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_preferences_created_at_idx": { - "name": "payload_preferences_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.payload_preferences_rels": { - "name": "payload_preferences_rels", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "order": { - "name": "order", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "parent_id": { - "name": "parent_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "path": { - "name": "path", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "users_id": { - "name": "users_id", - "type": "integer", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "payload_preferences_rels_order_idx": { - "name": "payload_preferences_rels_order_idx", - "columns": [ - { - "expression": "order", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_preferences_rels_parent_idx": { - "name": "payload_preferences_rels_parent_idx", - "columns": [ - { - "expression": "parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_preferences_rels_path_idx": { - "name": "payload_preferences_rels_path_idx", - "columns": [ - { - "expression": "path", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_preferences_rels_users_id_idx": { - "name": "payload_preferences_rels_users_id_idx", - "columns": [ - { - "expression": "users_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "payload_preferences_rels_parent_fk": { - "name": "payload_preferences_rels_parent_fk", - "tableFrom": "payload_preferences_rels", - "tableTo": "payload_preferences", - "columnsFrom": [ - "parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "payload_preferences_rels_users_fk": { - "name": "payload_preferences_rels_users_fk", - "tableFrom": "payload_preferences_rels", - "tableTo": "users", - "columnsFrom": [ - "users_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.payload_migrations": { - "name": "payload_migrations", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "batch": { - "name": "batch", - "type": "numeric", - "primaryKey": false, - "notNull": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "payload_migrations_updated_at_idx": { - "name": "payload_migrations_updated_at_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_migrations_created_at_idx": { - "name": "payload_migrations_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.admin_settings": { - "name": "admin_settings", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "title": { - "name": "title", - "type": "varchar", - "primaryKey": false, - "notNull": false, - "default": "'管理员设置'" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.logs_manager": { - "name": "logs_manager", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "placeholder": { - "name": "placeholder", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.hero_slider_slides": { - "name": "hero_slider_slides", - "schema": "", - "columns": { - "_order": { - "name": "_order", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "_parent_id": { - "name": "_parent_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "title": { - "name": "title", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "subtitle": { - "name": "subtitle", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "image_id": { - "name": "image_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "image_mobile_id": { - "name": "image_mobile_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "link": { - "name": "link", - "type": "varchar", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "hero_slider_slides_order_idx": { - "name": "hero_slider_slides_order_idx", - "columns": [ - { - "expression": "_order", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "hero_slider_slides_parent_id_idx": { - "name": "hero_slider_slides_parent_id_idx", - "columns": [ - { - "expression": "_parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "hero_slider_slides_image_idx": { - "name": "hero_slider_slides_image_idx", - "columns": [ - { - "expression": "image_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "hero_slider_slides_image_mobile_idx": { - "name": "hero_slider_slides_image_mobile_idx", - "columns": [ - { - "expression": "image_mobile_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "hero_slider_slides_image_id_media_id_fk": { - "name": "hero_slider_slides_image_id_media_id_fk", - "tableFrom": "hero_slider_slides", - "tableTo": "media", - "columnsFrom": [ - "image_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "hero_slider_slides_image_mobile_id_media_id_fk": { - "name": "hero_slider_slides_image_mobile_id_media_id_fk", - "tableFrom": "hero_slider_slides", - "tableTo": "media", - "columnsFrom": [ - "image_mobile_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "hero_slider_slides_parent_id_fk": { - "name": "hero_slider_slides_parent_id_fk", - "tableFrom": "hero_slider_slides", - "tableTo": "hero_slider", - "columnsFrom": [ - "_parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.hero_slider": { - "name": "hero_slider", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.product_recommendations_lists": { - "name": "product_recommendations_lists", - "schema": "", - "columns": { - "_order": { - "name": "_order", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "_parent_id": { - "name": "_parent_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "title": { - "name": "title", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "subtitle": { - "name": "subtitle", - "type": "varchar", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "product_recommendations_lists_order_idx": { - "name": "product_recommendations_lists_order_idx", - "columns": [ - { - "expression": "_order", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "product_recommendations_lists_parent_id_idx": { - "name": "product_recommendations_lists_parent_id_idx", - "columns": [ - { - "expression": "_parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "product_recommendations_lists_parent_id_fk": { - "name": "product_recommendations_lists_parent_id_fk", - "tableFrom": "product_recommendations_lists", - "tableTo": "product_recommendations", - "columnsFrom": [ - "_parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.product_recommendations": { - "name": "product_recommendations", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "enabled": { - "name": "enabled", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": true - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.product_recommendations_rels": { - "name": "product_recommendations_rels", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "order": { - "name": "order", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "parent_id": { - "name": "parent_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "path": { - "name": "path", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "products_id": { - "name": "products_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "preorder_products_id": { - "name": "preorder_products_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "order_products_id": { - "name": "order_products_id", - "type": "integer", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "product_recommendations_rels_order_idx": { - "name": "product_recommendations_rels_order_idx", - "columns": [ - { - "expression": "order", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "product_recommendations_rels_parent_idx": { - "name": "product_recommendations_rels_parent_idx", - "columns": [ - { - "expression": "parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "product_recommendations_rels_path_idx": { - "name": "product_recommendations_rels_path_idx", - "columns": [ - { - "expression": "path", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "product_recommendations_rels_products_id_idx": { - "name": "product_recommendations_rels_products_id_idx", - "columns": [ - { - "expression": "products_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "product_recommendations_rels_preorder_products_id_idx": { - "name": "product_recommendations_rels_preorder_products_id_idx", - "columns": [ - { - "expression": "preorder_products_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "product_recommendations_rels_order_products_id_idx": { - "name": "product_recommendations_rels_order_products_id_idx", - "columns": [ - { - "expression": "order_products_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "product_recommendations_rels_parent_fk": { - "name": "product_recommendations_rels_parent_fk", - "tableFrom": "product_recommendations_rels", - "tableTo": "product_recommendations", - "columnsFrom": [ - "parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "product_recommendations_rels_products_fk": { - "name": "product_recommendations_rels_products_fk", - "tableFrom": "product_recommendations_rels", - "tableTo": "products", - "columnsFrom": [ - "products_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "product_recommendations_rels_preorder_products_fk": { - "name": "product_recommendations_rels_preorder_products_fk", - "tableFrom": "product_recommendations_rels", - "tableTo": "preorder_products", - "columnsFrom": [ - "preorder_products_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "product_recommendations_rels_order_products_fk": { - "name": "product_recommendations_rels_order_products_fk", - "tableFrom": "product_recommendations_rels", - "tableTo": "order_products", - "columnsFrom": [ - "order_products_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "public.enum_users_roles": { - "name": "enum_users_roles", - "schema": "public", - "values": [ - "admin", - "editor", - "user" - ] - }, - "public.enum_products_status": { - "name": "enum_products_status", - "schema": "public", - "values": [ - "draft", - "published" - ] - }, - "public.enum_preorder_products_status": { - "name": "enum_preorder_products_status", - "schema": "public", - "values": [ - "draft", - "published" - ] - }, - "public.enum_order_products_status": { - "name": "enum_order_products_status", - "schema": "public", - "values": [ - "draft", - "published" - ] - }, - "public.enum_announcements_type": { - "name": "enum_announcements_type", - "schema": "public", - "values": [ - "info", - "warning", - "important", - "urgent" - ] - }, - "public.enum_announcements_status": { - "name": "enum_announcements_status", - "schema": "public", - "values": [ - "draft", - "published", - "archived" - ] - }, - "public.enum_articles_status": { - "name": "enum_articles_status", - "schema": "public", - "values": [ - "draft", - "published" - ] - }, - "public.enum_articles_category": { - "name": "enum_articles_category", - "schema": "public", - "values": [ - "news", - "tutorial", - "tech", - "review", - "industry", - "other" - ] - }, - "public.enum__articles_v_version_status": { - "name": "enum__articles_v_version_status", - "schema": "public", - "values": [ - "draft", - "published" - ] - }, - "public.enum__articles_v_version_category": { - "name": "enum__articles_v_version_category", - "schema": "public", - "values": [ - "news", - "tutorial", - "tech", - "review", - "industry", - "other" - ] - }, - "public.enum_logs_action": { - "name": "enum_logs_action", - "schema": "public", - "values": [ - "create", - "update", - "delete", - "sync", - "login", - "logout" - ] - }, - "public.enum_payload_jobs_log_task_slug": { - "name": "enum_payload_jobs_log_task_slug", - "schema": "public", - "values": [ - "inline", - "schedulePublish" - ] - }, - "public.enum_payload_jobs_log_state": { - "name": "enum_payload_jobs_log_state", - "schema": "public", - "values": [ - "failed", - "succeeded" - ] - }, - "public.enum_payload_jobs_task_slug": { - "name": "enum_payload_jobs_task_slug", - "schema": "public", - "values": [ - "inline", - "schedulePublish" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "schemas": {}, - "tables": {}, - "columns": {} - }, - "id": "28ae48ea-5a75-4ab3-ba32-9b336be535f1", - "prevId": "00000000-0000-0000-0000-000000000000" -} \ No newline at end of file diff --git a/src/migrations/20260212_202303.ts b/src/migrations/20260212_202303.ts deleted file mode 100644 index 9986926..0000000 --- a/src/migrations/20260212_202303.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { MigrateUpArgs, sql } from '@payloadcms/db-postgres' - -export async function up({ db }: MigrateUpArgs): Promise { - await db.execute(sql` - CREATE TYPE "public"."enum_preorder_products_status" AS ENUM('draft', 'published'); - CREATE TABLE "preorder_products" ( - "id" serial PRIMARY KEY NOT NULL, - "medusa_id" varchar NOT NULL, - "status" "enum_preorder_products_status" DEFAULT 'draft' NOT NULL, - "title" varchar NOT NULL, - "handle" varchar, - "thumbnail" varchar, - "last_synced_at" timestamp(3) with time zone, - "description" 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 "preorder_products_rels" ( - "id" serial PRIMARY KEY NOT NULL, - "order" integer, - "parent_id" integer NOT NULL, - "path" varchar NOT NULL, - "preorder_products_id" integer, - "products_id" integer - ); - - ALTER TABLE "payload_locked_documents_rels" ADD COLUMN "preorder_products_id" integer; - ALTER TABLE "product_recommendations_rels" ADD COLUMN "preorder_products_id" integer; - ALTER TABLE "preorder_products_rels" ADD CONSTRAINT "preorder_products_rels_parent_fk" FOREIGN KEY ("parent_id") REFERENCES "public"."preorder_products"("id") ON DELETE cascade ON UPDATE no action; - ALTER TABLE "preorder_products_rels" ADD CONSTRAINT "preorder_products_rels_preorder_products_fk" FOREIGN KEY ("preorder_products_id") REFERENCES "public"."preorder_products"("id") ON DELETE cascade ON UPDATE no action; - ALTER TABLE "preorder_products_rels" ADD CONSTRAINT "preorder_products_rels_products_fk" FOREIGN KEY ("products_id") REFERENCES "public"."products"("id") ON DELETE cascade ON UPDATE no action; - CREATE UNIQUE INDEX "preorder_products_medusa_id_idx" ON "preorder_products" USING btree ("medusa_id"); - CREATE INDEX "preorder_products_updated_at_idx" ON "preorder_products" USING btree ("updated_at"); - CREATE INDEX "preorder_products_created_at_idx" ON "preorder_products" USING btree ("created_at"); - CREATE INDEX "preorder_products_rels_order_idx" ON "preorder_products_rels" USING btree ("order"); - CREATE INDEX "preorder_products_rels_parent_idx" ON "preorder_products_rels" USING btree ("parent_id"); - CREATE INDEX "preorder_products_rels_path_idx" ON "preorder_products_rels" USING btree ("path"); - CREATE INDEX "preorder_products_rels_preorder_products_id_idx" ON "preorder_products_rels" USING btree ("preorder_products_id"); - CREATE INDEX "preorder_products_rels_products_id_idx" ON "preorder_products_rels" USING btree ("products_id"); - ALTER TABLE "payload_locked_documents_rels" ADD CONSTRAINT "payload_locked_documents_rels_preorder_products_fk" FOREIGN KEY ("preorder_products_id") REFERENCES "public"."preorder_products"("id") ON DELETE cascade ON UPDATE no action; - ALTER TABLE "product_recommendations_rels" ADD CONSTRAINT "product_recommendations_rels_preorder_products_fk" FOREIGN KEY ("preorder_products_id") REFERENCES "public"."preorder_products"("id") ON DELETE cascade ON UPDATE no action; - CREATE INDEX "payload_locked_documents_rels_preorder_products_id_idx" ON "payload_locked_documents_rels" USING btree ("preorder_products_id"); - CREATE INDEX "product_recommendations_rels_preorder_products_id_idx" ON "product_recommendations_rels" USING btree ("preorder_products_id");`) -} diff --git a/src/migrations/20260222_170233.json b/src/migrations/20260222_170233.json deleted file mode 100644 index 1ca01c1..0000000 --- a/src/migrations/20260222_170233.json +++ /dev/null @@ -1,5445 +0,0 @@ -{ - "version": "7", - "dialect": "postgresql", - "tables": { - "public.users_roles": { - "name": "users_roles", - "schema": "", - "columns": { - "order": { - "name": "order", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "parent_id": { - "name": "parent_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "value": { - "name": "value", - "type": "enum_users_roles", - "typeSchema": "public", - "primaryKey": false, - "notNull": false - }, - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - } - }, - "indexes": { - "users_roles_order_idx": { - "name": "users_roles_order_idx", - "columns": [ - { - "expression": "order", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_roles_parent_idx": { - "name": "users_roles_parent_idx", - "columns": [ - { - "expression": "parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "users_roles_parent_fk": { - "name": "users_roles_parent_fk", - "tableFrom": "users_roles", - "tableTo": "users", - "columnsFrom": [ - "parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.users_sessions": { - "name": "users_sessions", - "schema": "", - "columns": { - "_order": { - "name": "_order", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "_parent_id": { - "name": "_parent_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "users_sessions_order_idx": { - "name": "users_sessions_order_idx", - "columns": [ - { - "expression": "_order", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_sessions_parent_id_idx": { - "name": "users_sessions_parent_id_idx", - "columns": [ - { - "expression": "_parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "users_sessions_parent_id_fk": { - "name": "users_sessions_parent_id_fk", - "tableFrom": "users_sessions", - "tableTo": "users", - "columnsFrom": [ - "_parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.users": { - "name": "users", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "email": { - "name": "email", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "reset_password_token": { - "name": "reset_password_token", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "reset_password_expiration": { - "name": "reset_password_expiration", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "salt": { - "name": "salt", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "hash": { - "name": "hash", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "login_attempts": { - "name": "login_attempts", - "type": "numeric", - "primaryKey": false, - "notNull": false, - "default": 0 - }, - "lock_until": { - "name": "lock_until", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "users_updated_at_idx": { - "name": "users_updated_at_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_created_at_idx": { - "name": "users_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "users_email_idx": { - "name": "users_email_idx", - "columns": [ - { - "expression": "email", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.media": { - "name": "media", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "alt": { - "name": "alt", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "url": { - "name": "url", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "thumbnail_u_r_l": { - "name": "thumbnail_u_r_l", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "filename": { - "name": "filename", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "mime_type": { - "name": "mime_type", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "filesize": { - "name": "filesize", - "type": "numeric", - "primaryKey": false, - "notNull": false - }, - "width": { - "name": "width", - "type": "numeric", - "primaryKey": false, - "notNull": false - }, - "height": { - "name": "height", - "type": "numeric", - "primaryKey": false, - "notNull": false - }, - "focal_x": { - "name": "focal_x", - "type": "numeric", - "primaryKey": false, - "notNull": false - }, - "focal_y": { - "name": "focal_y", - "type": "numeric", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "media_updated_at_idx": { - "name": "media_updated_at_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "media_created_at_idx": { - "name": "media_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "media_filename_idx": { - "name": "media_filename_idx", - "columns": [ - { - "expression": "filename", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.products_taobao_links": { - "name": "products_taobao_links", - "schema": "", - "columns": { - "_order": { - "name": "_order", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "_parent_id": { - "name": "_parent_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "url": { - "name": "url", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "title": { - "name": "title", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "thumbnail": { - "name": "thumbnail", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "note": { - "name": "note", - "type": "varchar", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "products_taobao_links_order_idx": { - "name": "products_taobao_links_order_idx", - "columns": [ - { - "expression": "_order", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "products_taobao_links_parent_id_idx": { - "name": "products_taobao_links_parent_id_idx", - "columns": [ - { - "expression": "_parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "products_taobao_links_parent_id_fk": { - "name": "products_taobao_links_parent_id_fk", - "tableFrom": "products_taobao_links", - "tableTo": "products", - "columnsFrom": [ - "_parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.products": { - "name": "products", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "medusa_id": { - "name": "medusa_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "handle": { - "name": "handle", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "enum_products_status", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'draft'" - }, - "seed_id": { - "name": "seed_id", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "title": { - "name": "title", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "thumbnail": { - "name": "thumbnail", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "start_price": { - "name": "start_price", - "type": "numeric", - "primaryKey": false, - "notNull": false - }, - "last_synced_at": { - "name": "last_synced_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "description": { - "name": "description", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "content": { - "name": "content", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "tags": { - "name": "tags", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "type": { - "name": "type", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "collection": { - "name": "collection", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "category": { - "name": "category", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "height": { - "name": "height", - "type": "numeric", - "primaryKey": false, - "notNull": false - }, - "width": { - "name": "width", - "type": "numeric", - "primaryKey": false, - "notNull": false - }, - "length": { - "name": "length", - "type": "numeric", - "primaryKey": false, - "notNull": false - }, - "weight": { - "name": "weight", - "type": "numeric", - "primaryKey": false, - "notNull": false - }, - "mid_code": { - "name": "mid_code", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "hs_code": { - "name": "hs_code", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "country_of_origin": { - "name": "country_of_origin", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "products_medusa_id_idx": { - "name": "products_medusa_id_idx", - "columns": [ - { - "expression": "medusa_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - }, - "products_handle_idx": { - "name": "products_handle_idx", - "columns": [ - { - "expression": "handle", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "products_seed_id_idx": { - "name": "products_seed_id_idx", - "columns": [ - { - "expression": "seed_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - }, - "products_updated_at_idx": { - "name": "products_updated_at_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "products_created_at_idx": { - "name": "products_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.products_rels": { - "name": "products_rels", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "order": { - "name": "order", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "parent_id": { - "name": "parent_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "path": { - "name": "path", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "products_id": { - "name": "products_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "preorder_products_id": { - "name": "preorder_products_id", - "type": "integer", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "products_rels_order_idx": { - "name": "products_rels_order_idx", - "columns": [ - { - "expression": "order", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "products_rels_parent_idx": { - "name": "products_rels_parent_idx", - "columns": [ - { - "expression": "parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "products_rels_path_idx": { - "name": "products_rels_path_idx", - "columns": [ - { - "expression": "path", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "products_rels_products_id_idx": { - "name": "products_rels_products_id_idx", - "columns": [ - { - "expression": "products_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "products_rels_preorder_products_id_idx": { - "name": "products_rels_preorder_products_id_idx", - "columns": [ - { - "expression": "preorder_products_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "products_rels_parent_fk": { - "name": "products_rels_parent_fk", - "tableFrom": "products_rels", - "tableTo": "products", - "columnsFrom": [ - "parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "products_rels_products_fk": { - "name": "products_rels_products_fk", - "tableFrom": "products_rels", - "tableTo": "products", - "columnsFrom": [ - "products_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "products_rels_preorder_products_fk": { - "name": "products_rels_preorder_products_fk", - "tableFrom": "products_rels", - "tableTo": "preorder_products", - "columnsFrom": [ - "preorder_products_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.preorder_products_taobao_links": { - "name": "preorder_products_taobao_links", - "schema": "", - "columns": { - "_order": { - "name": "_order", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "_parent_id": { - "name": "_parent_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "url": { - "name": "url", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "title": { - "name": "title", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "thumbnail": { - "name": "thumbnail", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "note": { - "name": "note", - "type": "varchar", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "preorder_products_taobao_links_order_idx": { - "name": "preorder_products_taobao_links_order_idx", - "columns": [ - { - "expression": "_order", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "preorder_products_taobao_links_parent_id_idx": { - "name": "preorder_products_taobao_links_parent_id_idx", - "columns": [ - { - "expression": "_parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "preorder_products_taobao_links_parent_id_fk": { - "name": "preorder_products_taobao_links_parent_id_fk", - "tableFrom": "preorder_products_taobao_links", - "tableTo": "preorder_products", - "columnsFrom": [ - "_parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.preorder_products": { - "name": "preorder_products", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "medusa_id": { - "name": "medusa_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "handle": { - "name": "handle", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "enum_preorder_products_status", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'draft'" - }, - "seed_id": { - "name": "seed_id", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "title": { - "name": "title", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "thumbnail": { - "name": "thumbnail", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "start_price": { - "name": "start_price", - "type": "numeric", - "primaryKey": false, - "notNull": false - }, - "last_synced_at": { - "name": "last_synced_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "description": { - "name": "description", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "preorder_type": { - "name": "preorder_type", - "type": "enum_preorder_products_preorder_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'standard'" - }, - "funding_goal": { - "name": "funding_goal", - "type": "numeric", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "preorder_start_date": { - "name": "preorder_start_date", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "preorder_end_date": { - "name": "preorder_end_date", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "order_count": { - "name": "order_count", - "type": "numeric", - "primaryKey": false, - "notNull": false, - "default": 0 - }, - "fake_order_count": { - "name": "fake_order_count", - "type": "numeric", - "primaryKey": false, - "notNull": false, - "default": 0 - }, - "content": { - "name": "content", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "tags": { - "name": "tags", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "type": { - "name": "type", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "collection": { - "name": "collection", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "category": { - "name": "category", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "height": { - "name": "height", - "type": "numeric", - "primaryKey": false, - "notNull": false - }, - "width": { - "name": "width", - "type": "numeric", - "primaryKey": false, - "notNull": false - }, - "length": { - "name": "length", - "type": "numeric", - "primaryKey": false, - "notNull": false - }, - "weight": { - "name": "weight", - "type": "numeric", - "primaryKey": false, - "notNull": false - }, - "mid_code": { - "name": "mid_code", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "hs_code": { - "name": "hs_code", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "country_of_origin": { - "name": "country_of_origin", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "preorder_products_medusa_id_idx": { - "name": "preorder_products_medusa_id_idx", - "columns": [ - { - "expression": "medusa_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - }, - "preorder_products_handle_idx": { - "name": "preorder_products_handle_idx", - "columns": [ - { - "expression": "handle", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "preorder_products_seed_id_idx": { - "name": "preorder_products_seed_id_idx", - "columns": [ - { - "expression": "seed_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - }, - "preorder_products_updated_at_idx": { - "name": "preorder_products_updated_at_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "preorder_products_created_at_idx": { - "name": "preorder_products_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.preorder_products_rels": { - "name": "preorder_products_rels", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "order": { - "name": "order", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "parent_id": { - "name": "parent_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "path": { - "name": "path", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "products_id": { - "name": "products_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "preorder_products_id": { - "name": "preorder_products_id", - "type": "integer", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "preorder_products_rels_order_idx": { - "name": "preorder_products_rels_order_idx", - "columns": [ - { - "expression": "order", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "preorder_products_rels_parent_idx": { - "name": "preorder_products_rels_parent_idx", - "columns": [ - { - "expression": "parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "preorder_products_rels_path_idx": { - "name": "preorder_products_rels_path_idx", - "columns": [ - { - "expression": "path", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "preorder_products_rels_products_id_idx": { - "name": "preorder_products_rels_products_id_idx", - "columns": [ - { - "expression": "products_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "preorder_products_rels_preorder_products_id_idx": { - "name": "preorder_products_rels_preorder_products_id_idx", - "columns": [ - { - "expression": "preorder_products_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "preorder_products_rels_parent_fk": { - "name": "preorder_products_rels_parent_fk", - "tableFrom": "preorder_products_rels", - "tableTo": "preorder_products", - "columnsFrom": [ - "parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "preorder_products_rels_products_fk": { - "name": "preorder_products_rels_products_fk", - "tableFrom": "preorder_products_rels", - "tableTo": "products", - "columnsFrom": [ - "products_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "preorder_products_rels_preorder_products_fk": { - "name": "preorder_products_rels_preorder_products_fk", - "tableFrom": "preorder_products_rels", - "tableTo": "preorder_products", - "columnsFrom": [ - "preorder_products_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.announcements": { - "name": "announcements", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "title": { - "name": "title", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "type": { - "name": "type", - "type": "enum_announcements_type", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'info'" - }, - "status": { - "name": "status", - "type": "enum_announcements_status", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'draft'" - }, - "priority": { - "name": "priority", - "type": "numeric", - "primaryKey": false, - "notNull": false, - "default": 0 - }, - "summary": { - "name": "summary", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "content": { - "name": "content", - "type": "jsonb", - "primaryKey": false, - "notNull": true - }, - "published_at": { - "name": "published_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "expires_at": { - "name": "expires_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "show_on_homepage": { - "name": "show_on_homepage", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "author_id": { - "name": "author_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "announcements_author_idx": { - "name": "announcements_author_idx", - "columns": [ - { - "expression": "author_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "announcements_updated_at_idx": { - "name": "announcements_updated_at_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "announcements_created_at_idx": { - "name": "announcements_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "announcements_author_id_users_id_fk": { - "name": "announcements_author_id_users_id_fk", - "tableFrom": "announcements", - "tableTo": "users", - "columnsFrom": [ - "author_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.articles": { - "name": "articles", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "title": { - "name": "title", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "status": { - "name": "status", - "type": "enum_articles_status", - "typeSchema": "public", - "primaryKey": false, - "notNull": false, - "default": "'draft'" - }, - "slug": { - "name": "slug", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "featured_image_id": { - "name": "featured_image_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "excerpt": { - "name": "excerpt", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "content": { - "name": "content", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "category": { - "name": "category", - "type": "enum_articles_category", - "typeSchema": "public", - "primaryKey": false, - "notNull": false - }, - "featured": { - "name": "featured", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "author_id": { - "name": "author_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "published_at": { - "name": "published_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "meta_title": { - "name": "meta_title", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "meta_description": { - "name": "meta_description", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "_status": { - "name": "_status", - "type": "enum_articles_status", - "typeSchema": "public", - "primaryKey": false, - "notNull": false, - "default": "'draft'" - } - }, - "indexes": { - "articles_slug_idx": { - "name": "articles_slug_idx", - "columns": [ - { - "expression": "slug", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - }, - "articles_featured_image_idx": { - "name": "articles_featured_image_idx", - "columns": [ - { - "expression": "featured_image_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "articles_author_idx": { - "name": "articles_author_idx", - "columns": [ - { - "expression": "author_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "articles_updated_at_idx": { - "name": "articles_updated_at_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "articles_created_at_idx": { - "name": "articles_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "articles__status_idx": { - "name": "articles__status_idx", - "columns": [ - { - "expression": "_status", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "articles_featured_image_id_media_id_fk": { - "name": "articles_featured_image_id_media_id_fk", - "tableFrom": "articles", - "tableTo": "media", - "columnsFrom": [ - "featured_image_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "articles_author_id_users_id_fk": { - "name": "articles_author_id_users_id_fk", - "tableFrom": "articles", - "tableTo": "users", - "columnsFrom": [ - "author_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.articles_texts": { - "name": "articles_texts", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "order": { - "name": "order", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "parent_id": { - "name": "parent_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "path": { - "name": "path", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "text": { - "name": "text", - "type": "varchar", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "articles_texts_order_parent": { - "name": "articles_texts_order_parent", - "columns": [ - { - "expression": "order", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "articles_texts_parent_fk": { - "name": "articles_texts_parent_fk", - "tableFrom": "articles_texts", - "tableTo": "articles", - "columnsFrom": [ - "parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.articles_rels": { - "name": "articles_rels", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "order": { - "name": "order", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "parent_id": { - "name": "parent_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "path": { - "name": "path", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "articles_id": { - "name": "articles_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "products_id": { - "name": "products_id", - "type": "integer", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "articles_rels_order_idx": { - "name": "articles_rels_order_idx", - "columns": [ - { - "expression": "order", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "articles_rels_parent_idx": { - "name": "articles_rels_parent_idx", - "columns": [ - { - "expression": "parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "articles_rels_path_idx": { - "name": "articles_rels_path_idx", - "columns": [ - { - "expression": "path", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "articles_rels_articles_id_idx": { - "name": "articles_rels_articles_id_idx", - "columns": [ - { - "expression": "articles_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "articles_rels_products_id_idx": { - "name": "articles_rels_products_id_idx", - "columns": [ - { - "expression": "products_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "articles_rels_parent_fk": { - "name": "articles_rels_parent_fk", - "tableFrom": "articles_rels", - "tableTo": "articles", - "columnsFrom": [ - "parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "articles_rels_articles_fk": { - "name": "articles_rels_articles_fk", - "tableFrom": "articles_rels", - "tableTo": "articles", - "columnsFrom": [ - "articles_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "articles_rels_products_fk": { - "name": "articles_rels_products_fk", - "tableFrom": "articles_rels", - "tableTo": "products", - "columnsFrom": [ - "products_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public._articles_v": { - "name": "_articles_v", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "parent_id": { - "name": "parent_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "version_title": { - "name": "version_title", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "version_status": { - "name": "version_status", - "type": "enum__articles_v_version_status", - "typeSchema": "public", - "primaryKey": false, - "notNull": false, - "default": "'draft'" - }, - "version_slug": { - "name": "version_slug", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "version_featured_image_id": { - "name": "version_featured_image_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "version_excerpt": { - "name": "version_excerpt", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "version_content": { - "name": "version_content", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "version_category": { - "name": "version_category", - "type": "enum__articles_v_version_category", - "typeSchema": "public", - "primaryKey": false, - "notNull": false - }, - "version_featured": { - "name": "version_featured", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "version_author_id": { - "name": "version_author_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "version_published_at": { - "name": "version_published_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "version_meta_title": { - "name": "version_meta_title", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "version_meta_description": { - "name": "version_meta_description", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "version_updated_at": { - "name": "version_updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "version_created_at": { - "name": "version_created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "version__status": { - "name": "version__status", - "type": "enum__articles_v_version_status", - "typeSchema": "public", - "primaryKey": false, - "notNull": false, - "default": "'draft'" - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "latest": { - "name": "latest", - "type": "boolean", - "primaryKey": false, - "notNull": false - }, - "autosave": { - "name": "autosave", - "type": "boolean", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "_articles_v_parent_idx": { - "name": "_articles_v_parent_idx", - "columns": [ - { - "expression": "parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "_articles_v_version_version_slug_idx": { - "name": "_articles_v_version_version_slug_idx", - "columns": [ - { - "expression": "version_slug", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "_articles_v_version_version_featured_image_idx": { - "name": "_articles_v_version_version_featured_image_idx", - "columns": [ - { - "expression": "version_featured_image_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "_articles_v_version_version_author_idx": { - "name": "_articles_v_version_version_author_idx", - "columns": [ - { - "expression": "version_author_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "_articles_v_version_version_updated_at_idx": { - "name": "_articles_v_version_version_updated_at_idx", - "columns": [ - { - "expression": "version_updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "_articles_v_version_version_created_at_idx": { - "name": "_articles_v_version_version_created_at_idx", - "columns": [ - { - "expression": "version_created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "_articles_v_version_version__status_idx": { - "name": "_articles_v_version_version__status_idx", - "columns": [ - { - "expression": "version__status", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "_articles_v_created_at_idx": { - "name": "_articles_v_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "_articles_v_updated_at_idx": { - "name": "_articles_v_updated_at_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "_articles_v_latest_idx": { - "name": "_articles_v_latest_idx", - "columns": [ - { - "expression": "latest", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "_articles_v_autosave_idx": { - "name": "_articles_v_autosave_idx", - "columns": [ - { - "expression": "autosave", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "_articles_v_parent_id_articles_id_fk": { - "name": "_articles_v_parent_id_articles_id_fk", - "tableFrom": "_articles_v", - "tableTo": "articles", - "columnsFrom": [ - "parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "_articles_v_version_featured_image_id_media_id_fk": { - "name": "_articles_v_version_featured_image_id_media_id_fk", - "tableFrom": "_articles_v", - "tableTo": "media", - "columnsFrom": [ - "version_featured_image_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "_articles_v_version_author_id_users_id_fk": { - "name": "_articles_v_version_author_id_users_id_fk", - "tableFrom": "_articles_v", - "tableTo": "users", - "columnsFrom": [ - "version_author_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public._articles_v_texts": { - "name": "_articles_v_texts", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "order": { - "name": "order", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "parent_id": { - "name": "parent_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "path": { - "name": "path", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "text": { - "name": "text", - "type": "varchar", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "_articles_v_texts_order_parent": { - "name": "_articles_v_texts_order_parent", - "columns": [ - { - "expression": "order", - "isExpression": false, - "asc": true, - "nulls": "last" - }, - { - "expression": "parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "_articles_v_texts_parent_fk": { - "name": "_articles_v_texts_parent_fk", - "tableFrom": "_articles_v_texts", - "tableTo": "_articles_v", - "columnsFrom": [ - "parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public._articles_v_rels": { - "name": "_articles_v_rels", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "order": { - "name": "order", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "parent_id": { - "name": "parent_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "path": { - "name": "path", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "articles_id": { - "name": "articles_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "products_id": { - "name": "products_id", - "type": "integer", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "_articles_v_rels_order_idx": { - "name": "_articles_v_rels_order_idx", - "columns": [ - { - "expression": "order", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "_articles_v_rels_parent_idx": { - "name": "_articles_v_rels_parent_idx", - "columns": [ - { - "expression": "parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "_articles_v_rels_path_idx": { - "name": "_articles_v_rels_path_idx", - "columns": [ - { - "expression": "path", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "_articles_v_rels_articles_id_idx": { - "name": "_articles_v_rels_articles_id_idx", - "columns": [ - { - "expression": "articles_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "_articles_v_rels_products_id_idx": { - "name": "_articles_v_rels_products_id_idx", - "columns": [ - { - "expression": "products_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "_articles_v_rels_parent_fk": { - "name": "_articles_v_rels_parent_fk", - "tableFrom": "_articles_v_rels", - "tableTo": "_articles_v", - "columnsFrom": [ - "parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "_articles_v_rels_articles_fk": { - "name": "_articles_v_rels_articles_fk", - "tableFrom": "_articles_v_rels", - "tableTo": "articles", - "columnsFrom": [ - "articles_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "_articles_v_rels_products_fk": { - "name": "_articles_v_rels_products_fk", - "tableFrom": "_articles_v_rels", - "tableTo": "products", - "columnsFrom": [ - "products_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.logs": { - "name": "logs", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "action": { - "name": "action", - "type": "enum_logs_action", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "collection": { - "name": "collection", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "document_id": { - "name": "document_id", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "document_title": { - "name": "document_title", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "user_id": { - "name": "user_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "changes": { - "name": "changes", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "ip": { - "name": "ip", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "user_agent": { - "name": "user_agent", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "logs_collection_idx": { - "name": "logs_collection_idx", - "columns": [ - { - "expression": "collection", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "logs_document_id_idx": { - "name": "logs_document_id_idx", - "columns": [ - { - "expression": "document_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "logs_user_idx": { - "name": "logs_user_idx", - "columns": [ - { - "expression": "user_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "logs_updated_at_idx": { - "name": "logs_updated_at_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "logs_created_at_idx": { - "name": "logs_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "logs_user_id_users_id_fk": { - "name": "logs_user_id_users_id_fk", - "tableFrom": "logs", - "tableTo": "users", - "columnsFrom": [ - "user_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.disassembly_pages_components_linked_products": { - "name": "disassembly_pages_components_linked_products", - "schema": "", - "columns": { - "_order": { - "name": "_order", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "_parent_id": { - "name": "_parent_id", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "coordinate_x": { - "name": "coordinate_x", - "type": "numeric", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "coordinate_y": { - "name": "coordinate_y", - "type": "numeric", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "product_name": { - "name": "product_name", - "type": "varchar", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "disassembly_pages_components_linked_products_order_idx": { - "name": "disassembly_pages_components_linked_products_order_idx", - "columns": [ - { - "expression": "_order", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "disassembly_pages_components_linked_products_parent_id_idx": { - "name": "disassembly_pages_components_linked_products_parent_id_idx", - "columns": [ - { - "expression": "_parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "disassembly_pages_components_linked_products_parent_id_fk": { - "name": "disassembly_pages_components_linked_products_parent_id_fk", - "tableFrom": "disassembly_pages_components_linked_products", - "tableTo": "disassembly_pages_components", - "columnsFrom": [ - "_parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.disassembly_pages_components": { - "name": "disassembly_pages_components", - "schema": "", - "columns": { - "_order": { - "name": "_order", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "_parent_id": { - "name": "_parent_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "label": { - "name": "label", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "start_coordinate_x": { - "name": "start_coordinate_x", - "type": "numeric", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "start_coordinate_y": { - "name": "start_coordinate_y", - "type": "numeric", - "primaryKey": false, - "notNull": true, - "default": 0 - }, - "start_radius": { - "name": "start_radius", - "type": "numeric", - "primaryKey": false, - "notNull": true, - "default": 20 - } - }, - "indexes": { - "disassembly_pages_components_order_idx": { - "name": "disassembly_pages_components_order_idx", - "columns": [ - { - "expression": "_order", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "disassembly_pages_components_parent_id_idx": { - "name": "disassembly_pages_components_parent_id_idx", - "columns": [ - { - "expression": "_parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "disassembly_pages_components_parent_id_fk": { - "name": "disassembly_pages_components_parent_id_fk", - "tableFrom": "disassembly_pages_components", - "tableTo": "disassembly_pages", - "columnsFrom": [ - "_parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.disassembly_pages": { - "name": "disassembly_pages", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "main_image_id": { - "name": "main_image_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "name": { - "name": "name", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "url": { - "name": "url", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "disassembly_pages_main_image_idx": { - "name": "disassembly_pages_main_image_idx", - "columns": [ - { - "expression": "main_image_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "disassembly_pages_updated_at_idx": { - "name": "disassembly_pages_updated_at_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "disassembly_pages_created_at_idx": { - "name": "disassembly_pages_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "disassembly_pages_main_image_id_media_id_fk": { - "name": "disassembly_pages_main_image_id_media_id_fk", - "tableFrom": "disassembly_pages", - "tableTo": "media", - "columnsFrom": [ - "main_image_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.disassembly_pages_rels": { - "name": "disassembly_pages_rels", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "order": { - "name": "order", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "parent_id": { - "name": "parent_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "path": { - "name": "path", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "products_id": { - "name": "products_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "preorder_products_id": { - "name": "preorder_products_id", - "type": "integer", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "disassembly_pages_rels_order_idx": { - "name": "disassembly_pages_rels_order_idx", - "columns": [ - { - "expression": "order", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "disassembly_pages_rels_parent_idx": { - "name": "disassembly_pages_rels_parent_idx", - "columns": [ - { - "expression": "parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "disassembly_pages_rels_path_idx": { - "name": "disassembly_pages_rels_path_idx", - "columns": [ - { - "expression": "path", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "disassembly_pages_rels_products_id_idx": { - "name": "disassembly_pages_rels_products_id_idx", - "columns": [ - { - "expression": "products_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "disassembly_pages_rels_preorder_products_id_idx": { - "name": "disassembly_pages_rels_preorder_products_id_idx", - "columns": [ - { - "expression": "preorder_products_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "disassembly_pages_rels_parent_fk": { - "name": "disassembly_pages_rels_parent_fk", - "tableFrom": "disassembly_pages_rels", - "tableTo": "disassembly_pages", - "columnsFrom": [ - "parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "disassembly_pages_rels_products_fk": { - "name": "disassembly_pages_rels_products_fk", - "tableFrom": "disassembly_pages_rels", - "tableTo": "products", - "columnsFrom": [ - "products_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "disassembly_pages_rels_preorder_products_fk": { - "name": "disassembly_pages_rels_preorder_products_fk", - "tableFrom": "disassembly_pages_rels", - "tableTo": "preorder_products", - "columnsFrom": [ - "preorder_products_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.payload_kv": { - "name": "payload_kv", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "key": { - "name": "key", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "data": { - "name": "data", - "type": "jsonb", - "primaryKey": false, - "notNull": true - } - }, - "indexes": { - "payload_kv_key_idx": { - "name": "payload_kv_key_idx", - "columns": [ - { - "expression": "key", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": true, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.payload_jobs_log": { - "name": "payload_jobs_log", - "schema": "", - "columns": { - "_order": { - "name": "_order", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "_parent_id": { - "name": "_parent_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "executed_at": { - "name": "executed_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true - }, - "task_slug": { - "name": "task_slug", - "type": "enum_payload_jobs_log_task_slug", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "task_i_d": { - "name": "task_i_d", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "input": { - "name": "input", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "output": { - "name": "output", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "state": { - "name": "state", - "type": "enum_payload_jobs_log_state", - "typeSchema": "public", - "primaryKey": false, - "notNull": true - }, - "error": { - "name": "error", - "type": "jsonb", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "payload_jobs_log_order_idx": { - "name": "payload_jobs_log_order_idx", - "columns": [ - { - "expression": "_order", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_jobs_log_parent_id_idx": { - "name": "payload_jobs_log_parent_id_idx", - "columns": [ - { - "expression": "_parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "payload_jobs_log_parent_id_fk": { - "name": "payload_jobs_log_parent_id_fk", - "tableFrom": "payload_jobs_log", - "tableTo": "payload_jobs", - "columnsFrom": [ - "_parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.payload_jobs": { - "name": "payload_jobs", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "input": { - "name": "input", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "completed_at": { - "name": "completed_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "total_tried": { - "name": "total_tried", - "type": "numeric", - "primaryKey": false, - "notNull": false, - "default": 0 - }, - "has_error": { - "name": "has_error", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "error": { - "name": "error", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "task_slug": { - "name": "task_slug", - "type": "enum_payload_jobs_task_slug", - "typeSchema": "public", - "primaryKey": false, - "notNull": false - }, - "queue": { - "name": "queue", - "type": "varchar", - "primaryKey": false, - "notNull": false, - "default": "'default'" - }, - "wait_until": { - "name": "wait_until", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "processing": { - "name": "processing", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "payload_jobs_completed_at_idx": { - "name": "payload_jobs_completed_at_idx", - "columns": [ - { - "expression": "completed_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_jobs_total_tried_idx": { - "name": "payload_jobs_total_tried_idx", - "columns": [ - { - "expression": "total_tried", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_jobs_has_error_idx": { - "name": "payload_jobs_has_error_idx", - "columns": [ - { - "expression": "has_error", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_jobs_task_slug_idx": { - "name": "payload_jobs_task_slug_idx", - "columns": [ - { - "expression": "task_slug", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_jobs_queue_idx": { - "name": "payload_jobs_queue_idx", - "columns": [ - { - "expression": "queue", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_jobs_wait_until_idx": { - "name": "payload_jobs_wait_until_idx", - "columns": [ - { - "expression": "wait_until", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_jobs_processing_idx": { - "name": "payload_jobs_processing_idx", - "columns": [ - { - "expression": "processing", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_jobs_updated_at_idx": { - "name": "payload_jobs_updated_at_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_jobs_created_at_idx": { - "name": "payload_jobs_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.payload_locked_documents": { - "name": "payload_locked_documents", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "global_slug": { - "name": "global_slug", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "payload_locked_documents_global_slug_idx": { - "name": "payload_locked_documents_global_slug_idx", - "columns": [ - { - "expression": "global_slug", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_locked_documents_updated_at_idx": { - "name": "payload_locked_documents_updated_at_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_locked_documents_created_at_idx": { - "name": "payload_locked_documents_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.payload_locked_documents_rels": { - "name": "payload_locked_documents_rels", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "order": { - "name": "order", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "parent_id": { - "name": "parent_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "path": { - "name": "path", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "users_id": { - "name": "users_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "media_id": { - "name": "media_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "products_id": { - "name": "products_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "preorder_products_id": { - "name": "preorder_products_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "announcements_id": { - "name": "announcements_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "articles_id": { - "name": "articles_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "logs_id": { - "name": "logs_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "disassembly_pages_id": { - "name": "disassembly_pages_id", - "type": "integer", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "payload_locked_documents_rels_order_idx": { - "name": "payload_locked_documents_rels_order_idx", - "columns": [ - { - "expression": "order", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_locked_documents_rels_parent_idx": { - "name": "payload_locked_documents_rels_parent_idx", - "columns": [ - { - "expression": "parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_locked_documents_rels_path_idx": { - "name": "payload_locked_documents_rels_path_idx", - "columns": [ - { - "expression": "path", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_locked_documents_rels_users_id_idx": { - "name": "payload_locked_documents_rels_users_id_idx", - "columns": [ - { - "expression": "users_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_locked_documents_rels_media_id_idx": { - "name": "payload_locked_documents_rels_media_id_idx", - "columns": [ - { - "expression": "media_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_locked_documents_rels_products_id_idx": { - "name": "payload_locked_documents_rels_products_id_idx", - "columns": [ - { - "expression": "products_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_locked_documents_rels_preorder_products_id_idx": { - "name": "payload_locked_documents_rels_preorder_products_id_idx", - "columns": [ - { - "expression": "preorder_products_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_locked_documents_rels_announcements_id_idx": { - "name": "payload_locked_documents_rels_announcements_id_idx", - "columns": [ - { - "expression": "announcements_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_locked_documents_rels_articles_id_idx": { - "name": "payload_locked_documents_rels_articles_id_idx", - "columns": [ - { - "expression": "articles_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_locked_documents_rels_logs_id_idx": { - "name": "payload_locked_documents_rels_logs_id_idx", - "columns": [ - { - "expression": "logs_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_locked_documents_rels_disassembly_pages_id_idx": { - "name": "payload_locked_documents_rels_disassembly_pages_id_idx", - "columns": [ - { - "expression": "disassembly_pages_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "payload_locked_documents_rels_parent_fk": { - "name": "payload_locked_documents_rels_parent_fk", - "tableFrom": "payload_locked_documents_rels", - "tableTo": "payload_locked_documents", - "columnsFrom": [ - "parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "payload_locked_documents_rels_users_fk": { - "name": "payload_locked_documents_rels_users_fk", - "tableFrom": "payload_locked_documents_rels", - "tableTo": "users", - "columnsFrom": [ - "users_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "payload_locked_documents_rels_media_fk": { - "name": "payload_locked_documents_rels_media_fk", - "tableFrom": "payload_locked_documents_rels", - "tableTo": "media", - "columnsFrom": [ - "media_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "payload_locked_documents_rels_products_fk": { - "name": "payload_locked_documents_rels_products_fk", - "tableFrom": "payload_locked_documents_rels", - "tableTo": "products", - "columnsFrom": [ - "products_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "payload_locked_documents_rels_preorder_products_fk": { - "name": "payload_locked_documents_rels_preorder_products_fk", - "tableFrom": "payload_locked_documents_rels", - "tableTo": "preorder_products", - "columnsFrom": [ - "preorder_products_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "payload_locked_documents_rels_announcements_fk": { - "name": "payload_locked_documents_rels_announcements_fk", - "tableFrom": "payload_locked_documents_rels", - "tableTo": "announcements", - "columnsFrom": [ - "announcements_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "payload_locked_documents_rels_articles_fk": { - "name": "payload_locked_documents_rels_articles_fk", - "tableFrom": "payload_locked_documents_rels", - "tableTo": "articles", - "columnsFrom": [ - "articles_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "payload_locked_documents_rels_logs_fk": { - "name": "payload_locked_documents_rels_logs_fk", - "tableFrom": "payload_locked_documents_rels", - "tableTo": "logs", - "columnsFrom": [ - "logs_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "payload_locked_documents_rels_disassembly_pages_fk": { - "name": "payload_locked_documents_rels_disassembly_pages_fk", - "tableFrom": "payload_locked_documents_rels", - "tableTo": "disassembly_pages", - "columnsFrom": [ - "disassembly_pages_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.payload_preferences": { - "name": "payload_preferences", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "key": { - "name": "key", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "value": { - "name": "value", - "type": "jsonb", - "primaryKey": false, - "notNull": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "payload_preferences_key_idx": { - "name": "payload_preferences_key_idx", - "columns": [ - { - "expression": "key", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_preferences_updated_at_idx": { - "name": "payload_preferences_updated_at_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_preferences_created_at_idx": { - "name": "payload_preferences_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.payload_preferences_rels": { - "name": "payload_preferences_rels", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "order": { - "name": "order", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "parent_id": { - "name": "parent_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "path": { - "name": "path", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "users_id": { - "name": "users_id", - "type": "integer", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "payload_preferences_rels_order_idx": { - "name": "payload_preferences_rels_order_idx", - "columns": [ - { - "expression": "order", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_preferences_rels_parent_idx": { - "name": "payload_preferences_rels_parent_idx", - "columns": [ - { - "expression": "parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_preferences_rels_path_idx": { - "name": "payload_preferences_rels_path_idx", - "columns": [ - { - "expression": "path", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_preferences_rels_users_id_idx": { - "name": "payload_preferences_rels_users_id_idx", - "columns": [ - { - "expression": "users_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "payload_preferences_rels_parent_fk": { - "name": "payload_preferences_rels_parent_fk", - "tableFrom": "payload_preferences_rels", - "tableTo": "payload_preferences", - "columnsFrom": [ - "parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "payload_preferences_rels_users_fk": { - "name": "payload_preferences_rels_users_fk", - "tableFrom": "payload_preferences_rels", - "tableTo": "users", - "columnsFrom": [ - "users_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.payload_migrations": { - "name": "payload_migrations", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "name": { - "name": "name", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "batch": { - "name": "batch", - "type": "numeric", - "primaryKey": false, - "notNull": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": true, - "default": "now()" - } - }, - "indexes": { - "payload_migrations_updated_at_idx": { - "name": "payload_migrations_updated_at_idx", - "columns": [ - { - "expression": "updated_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "payload_migrations_created_at_idx": { - "name": "payload_migrations_created_at_idx", - "columns": [ - { - "expression": "created_at", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.admin_settings": { - "name": "admin_settings", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "title": { - "name": "title", - "type": "varchar", - "primaryKey": false, - "notNull": false, - "default": "'管理员设置'" - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.logs_manager": { - "name": "logs_manager", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "placeholder": { - "name": "placeholder", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.hero_slider_slides": { - "name": "hero_slider_slides", - "schema": "", - "columns": { - "_order": { - "name": "_order", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "_parent_id": { - "name": "_parent_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "title": { - "name": "title", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "subtitle": { - "name": "subtitle", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "desc": { - "name": "desc", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "image_id": { - "name": "image_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "layout": { - "name": "layout", - "type": "enum_hero_slider_slides_layout", - "typeSchema": "public", - "primaryKey": false, - "notNull": true, - "default": "'left'" - }, - "show_focus_circle": { - "name": "show_focus_circle", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - }, - "price": { - "name": "price", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "link": { - "name": "link", - "type": "varchar", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "hero_slider_slides_order_idx": { - "name": "hero_slider_slides_order_idx", - "columns": [ - { - "expression": "_order", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "hero_slider_slides_parent_id_idx": { - "name": "hero_slider_slides_parent_id_idx", - "columns": [ - { - "expression": "_parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "hero_slider_slides_image_idx": { - "name": "hero_slider_slides_image_idx", - "columns": [ - { - "expression": "image_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "hero_slider_slides_image_id_media_id_fk": { - "name": "hero_slider_slides_image_id_media_id_fk", - "tableFrom": "hero_slider_slides", - "tableTo": "media", - "columnsFrom": [ - "image_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "set null", - "onUpdate": "no action" - }, - "hero_slider_slides_parent_id_fk": { - "name": "hero_slider_slides_parent_id_fk", - "tableFrom": "hero_slider_slides", - "tableTo": "hero_slider", - "columnsFrom": [ - "_parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.hero_slider": { - "name": "hero_slider", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.hero_slider_rels": { - "name": "hero_slider_rels", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "order": { - "name": "order", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "parent_id": { - "name": "parent_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "path": { - "name": "path", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "products_id": { - "name": "products_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "preorder_products_id": { - "name": "preorder_products_id", - "type": "integer", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "hero_slider_rels_order_idx": { - "name": "hero_slider_rels_order_idx", - "columns": [ - { - "expression": "order", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "hero_slider_rels_parent_idx": { - "name": "hero_slider_rels_parent_idx", - "columns": [ - { - "expression": "parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "hero_slider_rels_path_idx": { - "name": "hero_slider_rels_path_idx", - "columns": [ - { - "expression": "path", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "hero_slider_rels_products_id_idx": { - "name": "hero_slider_rels_products_id_idx", - "columns": [ - { - "expression": "products_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "hero_slider_rels_preorder_products_id_idx": { - "name": "hero_slider_rels_preorder_products_id_idx", - "columns": [ - { - "expression": "preorder_products_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "hero_slider_rels_parent_fk": { - "name": "hero_slider_rels_parent_fk", - "tableFrom": "hero_slider_rels", - "tableTo": "hero_slider", - "columnsFrom": [ - "parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "hero_slider_rels_products_fk": { - "name": "hero_slider_rels_products_fk", - "tableFrom": "hero_slider_rels", - "tableTo": "products", - "columnsFrom": [ - "products_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "hero_slider_rels_preorder_products_fk": { - "name": "hero_slider_rels_preorder_products_fk", - "tableFrom": "hero_slider_rels", - "tableTo": "preorder_products", - "columnsFrom": [ - "preorder_products_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.product_recommendations_lists": { - "name": "product_recommendations_lists", - "schema": "", - "columns": { - "_order": { - "name": "_order", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "_parent_id": { - "name": "_parent_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "id": { - "name": "id", - "type": "varchar", - "primaryKey": true, - "notNull": true - }, - "title": { - "name": "title", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "subtitle": { - "name": "subtitle", - "type": "varchar", - "primaryKey": false, - "notNull": false - }, - "preorder": { - "name": "preorder", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": false - } - }, - "indexes": { - "product_recommendations_lists_order_idx": { - "name": "product_recommendations_lists_order_idx", - "columns": [ - { - "expression": "_order", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "product_recommendations_lists_parent_id_idx": { - "name": "product_recommendations_lists_parent_id_idx", - "columns": [ - { - "expression": "_parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "product_recommendations_lists_parent_id_fk": { - "name": "product_recommendations_lists_parent_id_fk", - "tableFrom": "product_recommendations_lists", - "tableTo": "product_recommendations", - "columnsFrom": [ - "_parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.product_recommendations": { - "name": "product_recommendations", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "enabled": { - "name": "enabled", - "type": "boolean", - "primaryKey": false, - "notNull": false, - "default": true - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.product_recommendations_rels": { - "name": "product_recommendations_rels", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "order": { - "name": "order", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "parent_id": { - "name": "parent_id", - "type": "integer", - "primaryKey": false, - "notNull": true - }, - "path": { - "name": "path", - "type": "varchar", - "primaryKey": false, - "notNull": true - }, - "products_id": { - "name": "products_id", - "type": "integer", - "primaryKey": false, - "notNull": false - }, - "preorder_products_id": { - "name": "preorder_products_id", - "type": "integer", - "primaryKey": false, - "notNull": false - } - }, - "indexes": { - "product_recommendations_rels_order_idx": { - "name": "product_recommendations_rels_order_idx", - "columns": [ - { - "expression": "order", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "product_recommendations_rels_parent_idx": { - "name": "product_recommendations_rels_parent_idx", - "columns": [ - { - "expression": "parent_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "product_recommendations_rels_path_idx": { - "name": "product_recommendations_rels_path_idx", - "columns": [ - { - "expression": "path", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "product_recommendations_rels_products_id_idx": { - "name": "product_recommendations_rels_products_id_idx", - "columns": [ - { - "expression": "products_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - }, - "product_recommendations_rels_preorder_products_id_idx": { - "name": "product_recommendations_rels_preorder_products_id_idx", - "columns": [ - { - "expression": "preorder_products_id", - "isExpression": false, - "asc": true, - "nulls": "last" - } - ], - "isUnique": false, - "concurrently": false, - "method": "btree", - "with": {} - } - }, - "foreignKeys": { - "product_recommendations_rels_parent_fk": { - "name": "product_recommendations_rels_parent_fk", - "tableFrom": "product_recommendations_rels", - "tableTo": "product_recommendations", - "columnsFrom": [ - "parent_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "product_recommendations_rels_products_fk": { - "name": "product_recommendations_rels_products_fk", - "tableFrom": "product_recommendations_rels", - "tableTo": "products", - "columnsFrom": [ - "products_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - }, - "product_recommendations_rels_preorder_products_fk": { - "name": "product_recommendations_rels_preorder_products_fk", - "tableFrom": "product_recommendations_rels", - "tableTo": "preorder_products", - "columnsFrom": [ - "preorder_products_id" - ], - "columnsTo": [ - "id" - ], - "onDelete": "cascade", - "onUpdate": "no action" - } - }, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - }, - "public.site_access": { - "name": "site_access", - "schema": "", - "columns": { - "id": { - "name": "id", - "type": "serial", - "primaryKey": true, - "notNull": true - }, - "is_accessible": { - "name": "is_accessible", - "type": "boolean", - "primaryKey": false, - "notNull": true, - "default": true - }, - "maintenance_message": { - "name": "maintenance_message", - "type": "varchar", - "primaryKey": false, - "notNull": true, - "default": "'The site is currently under maintenance. Please check back later.'" - }, - "estimated_restore_time": { - "name": "estimated_restore_time", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "updated_at": { - "name": "updated_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - }, - "created_at": { - "name": "created_at", - "type": "timestamp(3) with time zone", - "primaryKey": false, - "notNull": false - } - }, - "indexes": {}, - "foreignKeys": {}, - "compositePrimaryKeys": {}, - "uniqueConstraints": {}, - "policies": {}, - "checkConstraints": {}, - "isRLSEnabled": false - } - }, - "enums": { - "public.enum_users_roles": { - "name": "enum_users_roles", - "schema": "public", - "values": [ - "admin", - "editor", - "user" - ] - }, - "public.enum_products_status": { - "name": "enum_products_status", - "schema": "public", - "values": [ - "draft", - "published" - ] - }, - "public.enum_preorder_products_status": { - "name": "enum_preorder_products_status", - "schema": "public", - "values": [ - "draft", - "published" - ] - }, - "public.enum_preorder_products_preorder_type": { - "name": "enum_preorder_products_preorder_type", - "schema": "public", - "values": [ - "standard", - "crowdfunding", - "limited" - ] - }, - "public.enum_announcements_type": { - "name": "enum_announcements_type", - "schema": "public", - "values": [ - "info", - "warning", - "important", - "urgent" - ] - }, - "public.enum_announcements_status": { - "name": "enum_announcements_status", - "schema": "public", - "values": [ - "draft", - "published", - "archived" - ] - }, - "public.enum_articles_status": { - "name": "enum_articles_status", - "schema": "public", - "values": [ - "draft", - "published" - ] - }, - "public.enum_articles_category": { - "name": "enum_articles_category", - "schema": "public", - "values": [ - "news", - "tutorial", - "tech", - "review", - "industry", - "other" - ] - }, - "public.enum__articles_v_version_status": { - "name": "enum__articles_v_version_status", - "schema": "public", - "values": [ - "draft", - "published" - ] - }, - "public.enum__articles_v_version_category": { - "name": "enum__articles_v_version_category", - "schema": "public", - "values": [ - "news", - "tutorial", - "tech", - "review", - "industry", - "other" - ] - }, - "public.enum_logs_action": { - "name": "enum_logs_action", - "schema": "public", - "values": [ - "create", - "update", - "delete", - "sync", - "login", - "logout" - ] - }, - "public.enum_payload_jobs_log_task_slug": { - "name": "enum_payload_jobs_log_task_slug", - "schema": "public", - "values": [ - "inline", - "schedulePublish" - ] - }, - "public.enum_payload_jobs_log_state": { - "name": "enum_payload_jobs_log_state", - "schema": "public", - "values": [ - "failed", - "succeeded" - ] - }, - "public.enum_payload_jobs_task_slug": { - "name": "enum_payload_jobs_task_slug", - "schema": "public", - "values": [ - "inline", - "schedulePublish" - ] - }, - "public.enum_hero_slider_slides_layout": { - "name": "enum_hero_slider_slides_layout", - "schema": "public", - "values": [ - "left", - "right", - "center" - ] - } - }, - "schemas": {}, - "sequences": {}, - "roles": {}, - "policies": {}, - "views": {}, - "_meta": { - "schemas": {}, - "tables": {}, - "columns": {} - }, - "id": "96d223f3-995a-47b2-8e70-c4ccf3483b2f", - "prevId": "00000000-0000-0000-0000-000000000000" -} \ No newline at end of file diff --git a/src/migrations/20260222_170233.ts b/src/migrations/20260222_170233.ts deleted file mode 100644 index 56226b4..0000000 --- a/src/migrations/20260222_170233.ts +++ /dev/null @@ -1,314 +0,0 @@ -import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres' - -export async function up({ db, payload, req }: MigrateUpArgs): Promise { - await db.execute(sql` - CREATE TYPE "public"."enum_preorder_products_preorder_type" AS ENUM('standard', 'crowdfunding', 'limited'); - CREATE TYPE "public"."enum_hero_slider_slides_layout" AS ENUM('left', 'right', 'center'); - CREATE TABLE "products_taobao_links" ( - "_order" integer NOT NULL, - "_parent_id" integer NOT NULL, - "id" varchar PRIMARY KEY NOT NULL, - "url" varchar NOT NULL, - "title" varchar, - "thumbnail" varchar, - "note" varchar - ); - - CREATE TABLE "preorder_products_taobao_links" ( - "_order" integer NOT NULL, - "_parent_id" integer NOT NULL, - "id" varchar PRIMARY KEY NOT NULL, - "url" varchar NOT NULL, - "title" varchar, - "thumbnail" varchar, - "note" varchar - ); - - CREATE TABLE "disassembly_pages_components_linked_products" ( - "_order" integer NOT NULL, - "_parent_id" varchar NOT NULL, - "id" varchar PRIMARY KEY NOT NULL, - "coordinate_x" numeric DEFAULT 0 NOT NULL, - "coordinate_y" numeric DEFAULT 0 NOT NULL, - "product_name" varchar - ); - - CREATE TABLE "disassembly_pages_components" ( - "_order" integer NOT NULL, - "_parent_id" integer NOT NULL, - "id" varchar PRIMARY KEY NOT NULL, - "label" varchar, - "start_coordinate_x" numeric DEFAULT 0 NOT NULL, - "start_coordinate_y" numeric DEFAULT 0 NOT NULL, - "start_radius" numeric DEFAULT 20 NOT NULL - ); - - CREATE TABLE "disassembly_pages" ( - "id" serial PRIMARY KEY NOT NULL, - "main_image_id" integer NOT NULL, - "name" varchar NOT NULL, - "url" 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 "disassembly_pages_rels" ( - "id" serial PRIMARY KEY NOT NULL, - "order" integer, - "parent_id" integer NOT NULL, - "path" varchar NOT NULL, - "products_id" integer, - "preorder_products_id" integer - ); - - CREATE TABLE "hero_slider_rels" ( - "id" serial PRIMARY KEY NOT NULL, - "order" integer, - "parent_id" integer NOT NULL, - "path" varchar NOT NULL, - "products_id" integer, - "preorder_products_id" integer - ); - - CREATE TABLE "site_access" ( - "id" serial PRIMARY KEY NOT NULL, - "is_accessible" boolean DEFAULT true NOT NULL, - "maintenance_message" varchar DEFAULT 'The site is currently under maintenance. Please check back later.' NOT NULL, - "estimated_restore_time" timestamp(3) with time zone, - "updated_at" timestamp(3) with time zone, - "created_at" timestamp(3) with time zone - ); - - ALTER TABLE "order_products" DISABLE ROW LEVEL SECURITY; - ALTER TABLE "order_products_rels" DISABLE ROW LEVEL SECURITY; - DROP TABLE "order_products" CASCADE; - DROP TABLE "order_products_rels" CASCADE; - ALTER TABLE "preorder_products_rels" DROP CONSTRAINT "preorder_products_rels_order_products_fk"; - - ALTER TABLE "payload_locked_documents_rels" DROP CONSTRAINT "payload_locked_documents_rels_order_products_fk"; - - ALTER TABLE "hero_slider_slides" DROP CONSTRAINT "hero_slider_slides_image_mobile_id_media_id_fk"; - - ALTER TABLE "product_recommendations_rels" DROP CONSTRAINT "product_recommendations_rels_order_products_fk"; - - DROP INDEX "preorder_products_rels_order_products_id_idx"; - DROP INDEX "payload_locked_documents_rels_order_products_id_idx"; - DROP INDEX "hero_slider_slides_image_mobile_idx"; - DROP INDEX "product_recommendations_rels_order_products_id_idx"; - ALTER TABLE "preorder_products" ALTER COLUMN "description" SET DATA TYPE varchar; - ALTER TABLE "hero_slider_slides" ALTER COLUMN "subtitle" SET NOT NULL; - ALTER TABLE "products" ADD COLUMN "seed_id" varchar; - ALTER TABLE "products" ADD COLUMN "start_price" numeric; - ALTER TABLE "products" ADD COLUMN "description" varchar; - ALTER TABLE "products" ADD COLUMN "tags" varchar; - ALTER TABLE "products" ADD COLUMN "type" varchar; - ALTER TABLE "products" ADD COLUMN "collection" varchar; - ALTER TABLE "products" ADD COLUMN "category" varchar; - ALTER TABLE "products" ADD COLUMN "height" numeric; - ALTER TABLE "products" ADD COLUMN "width" numeric; - ALTER TABLE "products" ADD COLUMN "length" numeric; - ALTER TABLE "products" ADD COLUMN "weight" numeric; - ALTER TABLE "products" ADD COLUMN "mid_code" varchar; - ALTER TABLE "products" ADD COLUMN "hs_code" varchar; - ALTER TABLE "products" ADD COLUMN "country_of_origin" varchar; - ALTER TABLE "products_rels" ADD COLUMN "preorder_products_id" integer; - ALTER TABLE "preorder_products" ADD COLUMN "seed_id" varchar; - ALTER TABLE "preorder_products" ADD COLUMN "start_price" numeric; - ALTER TABLE "preorder_products" ADD COLUMN "preorder_type" "enum_preorder_products_preorder_type" DEFAULT 'standard' NOT NULL; - ALTER TABLE "preorder_products" ADD COLUMN "funding_goal" numeric DEFAULT 0 NOT NULL; - ALTER TABLE "preorder_products" ADD COLUMN "preorder_start_date" timestamp(3) with time zone; - ALTER TABLE "preorder_products" ADD COLUMN "preorder_end_date" timestamp(3) with time zone; - ALTER TABLE "preorder_products" ADD COLUMN "order_count" numeric DEFAULT 0; - ALTER TABLE "preorder_products" ADD COLUMN "fake_order_count" numeric DEFAULT 0; - ALTER TABLE "preorder_products" ADD COLUMN "content" jsonb; - ALTER TABLE "preorder_products" ADD COLUMN "tags" varchar; - ALTER TABLE "preorder_products" ADD COLUMN "type" varchar; - ALTER TABLE "preorder_products" ADD COLUMN "collection" varchar; - ALTER TABLE "preorder_products" ADD COLUMN "category" varchar; - ALTER TABLE "preorder_products" ADD COLUMN "height" numeric; - ALTER TABLE "preorder_products" ADD COLUMN "width" numeric; - ALTER TABLE "preorder_products" ADD COLUMN "length" numeric; - ALTER TABLE "preorder_products" ADD COLUMN "weight" numeric; - ALTER TABLE "preorder_products" ADD COLUMN "mid_code" varchar; - ALTER TABLE "preorder_products" ADD COLUMN "hs_code" varchar; - ALTER TABLE "preorder_products" ADD COLUMN "country_of_origin" varchar; - ALTER TABLE "preorder_products_rels" ADD COLUMN "products_id" integer; - ALTER TABLE "payload_locked_documents_rels" ADD COLUMN "disassembly_pages_id" integer; - ALTER TABLE "hero_slider_slides" ADD COLUMN "desc" varchar NOT NULL; - ALTER TABLE "hero_slider_slides" ADD COLUMN "layout" "enum_hero_slider_slides_layout" DEFAULT 'left' NOT NULL; - ALTER TABLE "hero_slider_slides" ADD COLUMN "show_focus_circle" boolean DEFAULT false; - ALTER TABLE "hero_slider_slides" ADD COLUMN "price" varchar NOT NULL; - ALTER TABLE "product_recommendations_lists" ADD COLUMN "preorder" boolean DEFAULT false; - ALTER TABLE "products_taobao_links" ADD CONSTRAINT "products_taobao_links_parent_id_fk" FOREIGN KEY ("_parent_id") REFERENCES "public"."products"("id") ON DELETE cascade ON UPDATE no action; - ALTER TABLE "preorder_products_taobao_links" ADD CONSTRAINT "preorder_products_taobao_links_parent_id_fk" FOREIGN KEY ("_parent_id") REFERENCES "public"."preorder_products"("id") ON DELETE cascade ON UPDATE no action; - ALTER TABLE "disassembly_pages_components_linked_products" ADD CONSTRAINT "disassembly_pages_components_linked_products_parent_id_fk" FOREIGN KEY ("_parent_id") REFERENCES "public"."disassembly_pages_components"("id") ON DELETE cascade ON UPDATE no action; - ALTER TABLE "disassembly_pages_components" ADD CONSTRAINT "disassembly_pages_components_parent_id_fk" FOREIGN KEY ("_parent_id") REFERENCES "public"."disassembly_pages"("id") ON DELETE cascade ON UPDATE no action; - ALTER TABLE "disassembly_pages" ADD CONSTRAINT "disassembly_pages_main_image_id_media_id_fk" FOREIGN KEY ("main_image_id") REFERENCES "public"."media"("id") ON DELETE set null ON UPDATE no action; - ALTER TABLE "disassembly_pages_rels" ADD CONSTRAINT "disassembly_pages_rels_parent_fk" FOREIGN KEY ("parent_id") REFERENCES "public"."disassembly_pages"("id") ON DELETE cascade ON UPDATE no action; - ALTER TABLE "disassembly_pages_rels" ADD CONSTRAINT "disassembly_pages_rels_products_fk" FOREIGN KEY ("products_id") REFERENCES "public"."products"("id") ON DELETE cascade ON UPDATE no action; - ALTER TABLE "disassembly_pages_rels" ADD CONSTRAINT "disassembly_pages_rels_preorder_products_fk" FOREIGN KEY ("preorder_products_id") REFERENCES "public"."preorder_products"("id") ON DELETE cascade ON UPDATE no action; - ALTER TABLE "hero_slider_rels" ADD CONSTRAINT "hero_slider_rels_parent_fk" FOREIGN KEY ("parent_id") REFERENCES "public"."hero_slider"("id") ON DELETE cascade ON UPDATE no action; - ALTER TABLE "hero_slider_rels" ADD CONSTRAINT "hero_slider_rels_products_fk" FOREIGN KEY ("products_id") REFERENCES "public"."products"("id") ON DELETE cascade ON UPDATE no action; - ALTER TABLE "hero_slider_rels" ADD CONSTRAINT "hero_slider_rels_preorder_products_fk" FOREIGN KEY ("preorder_products_id") REFERENCES "public"."preorder_products"("id") ON DELETE cascade ON UPDATE no action; - CREATE INDEX "products_taobao_links_order_idx" ON "products_taobao_links" USING btree ("_order"); - CREATE INDEX "products_taobao_links_parent_id_idx" ON "products_taobao_links" USING btree ("_parent_id"); - CREATE INDEX "preorder_products_taobao_links_order_idx" ON "preorder_products_taobao_links" USING btree ("_order"); - CREATE INDEX "preorder_products_taobao_links_parent_id_idx" ON "preorder_products_taobao_links" USING btree ("_parent_id"); - CREATE INDEX "disassembly_pages_components_linked_products_order_idx" ON "disassembly_pages_components_linked_products" USING btree ("_order"); - CREATE INDEX "disassembly_pages_components_linked_products_parent_id_idx" ON "disassembly_pages_components_linked_products" USING btree ("_parent_id"); - CREATE INDEX "disassembly_pages_components_order_idx" ON "disassembly_pages_components" USING btree ("_order"); - CREATE INDEX "disassembly_pages_components_parent_id_idx" ON "disassembly_pages_components" USING btree ("_parent_id"); - CREATE INDEX "disassembly_pages_main_image_idx" ON "disassembly_pages" USING btree ("main_image_id"); - CREATE INDEX "disassembly_pages_updated_at_idx" ON "disassembly_pages" USING btree ("updated_at"); - CREATE INDEX "disassembly_pages_created_at_idx" ON "disassembly_pages" USING btree ("created_at"); - CREATE INDEX "disassembly_pages_rels_order_idx" ON "disassembly_pages_rels" USING btree ("order"); - CREATE INDEX "disassembly_pages_rels_parent_idx" ON "disassembly_pages_rels" USING btree ("parent_id"); - CREATE INDEX "disassembly_pages_rels_path_idx" ON "disassembly_pages_rels" USING btree ("path"); - CREATE INDEX "disassembly_pages_rels_products_id_idx" ON "disassembly_pages_rels" USING btree ("products_id"); - CREATE INDEX "disassembly_pages_rels_preorder_products_id_idx" ON "disassembly_pages_rels" USING btree ("preorder_products_id"); - CREATE INDEX "hero_slider_rels_order_idx" ON "hero_slider_rels" USING btree ("order"); - CREATE INDEX "hero_slider_rels_parent_idx" ON "hero_slider_rels" USING btree ("parent_id"); - CREATE INDEX "hero_slider_rels_path_idx" ON "hero_slider_rels" USING btree ("path"); - CREATE INDEX "hero_slider_rels_products_id_idx" ON "hero_slider_rels" USING btree ("products_id"); - CREATE INDEX "hero_slider_rels_preorder_products_id_idx" ON "hero_slider_rels" USING btree ("preorder_products_id"); - ALTER TABLE "products_rels" ADD CONSTRAINT "products_rels_preorder_products_fk" FOREIGN KEY ("preorder_products_id") REFERENCES "public"."preorder_products"("id") ON DELETE cascade ON UPDATE no action; - ALTER TABLE "preorder_products_rels" ADD CONSTRAINT "preorder_products_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_disassembly_pages_fk" FOREIGN KEY ("disassembly_pages_id") REFERENCES "public"."disassembly_pages"("id") ON DELETE cascade ON UPDATE no action; - CREATE INDEX "products_handle_idx" ON "products" USING btree ("handle"); - CREATE UNIQUE INDEX "products_seed_id_idx" ON "products" USING btree ("seed_id"); - CREATE INDEX "products_rels_preorder_products_id_idx" ON "products_rels" USING btree ("preorder_products_id"); - CREATE INDEX "preorder_products_handle_idx" ON "preorder_products" USING btree ("handle"); - CREATE UNIQUE INDEX "preorder_products_seed_id_idx" ON "preorder_products" USING btree ("seed_id"); - CREATE INDEX "preorder_products_rels_products_id_idx" ON "preorder_products_rels" USING btree ("products_id"); - CREATE INDEX "payload_locked_documents_rels_disassembly_pages_id_idx" ON "payload_locked_documents_rels" USING btree ("disassembly_pages_id"); - ALTER TABLE "preorder_products_rels" DROP COLUMN "order_products_id"; - ALTER TABLE "payload_locked_documents_rels" DROP COLUMN "order_products_id"; - ALTER TABLE "hero_slider_slides" DROP COLUMN "image_mobile_id"; - ALTER TABLE "product_recommendations_rels" DROP COLUMN "order_products_id"; - DROP TYPE "public"."enum_order_products_status";`) -} - -export async function down({ db, payload, req }: MigrateDownArgs): Promise { - await db.execute(sql` - CREATE TYPE "public"."enum_order_products_status" AS ENUM('draft', 'published'); - CREATE TABLE "order_products" ( - "id" serial PRIMARY KEY NOT NULL, - "medusa_id" varchar NOT NULL, - "status" "enum_order_products_status" DEFAULT 'draft' NOT NULL, - "title" varchar NOT NULL, - "handle" varchar, - "thumbnail" varchar, - "last_synced_at" timestamp(3) with time zone, - "description" 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 "order_products_rels" ( - "id" serial PRIMARY KEY NOT NULL, - "order" integer, - "parent_id" integer NOT NULL, - "path" varchar NOT NULL, - "preorder_products_id" integer, - "order_products_id" integer - ); - - ALTER TABLE "products_taobao_links" DISABLE ROW LEVEL SECURITY; - ALTER TABLE "preorder_products_taobao_links" DISABLE ROW LEVEL SECURITY; - ALTER TABLE "disassembly_pages_components_linked_products" DISABLE ROW LEVEL SECURITY; - ALTER TABLE "disassembly_pages_components" DISABLE ROW LEVEL SECURITY; - ALTER TABLE "disassembly_pages" DISABLE ROW LEVEL SECURITY; - ALTER TABLE "disassembly_pages_rels" DISABLE ROW LEVEL SECURITY; - ALTER TABLE "hero_slider_rels" DISABLE ROW LEVEL SECURITY; - ALTER TABLE "site_access" DISABLE ROW LEVEL SECURITY; - DROP TABLE "products_taobao_links" CASCADE; - DROP TABLE "preorder_products_taobao_links" CASCADE; - DROP TABLE "disassembly_pages_components_linked_products" CASCADE; - DROP TABLE "disassembly_pages_components" CASCADE; - DROP TABLE "disassembly_pages" CASCADE; - DROP TABLE "disassembly_pages_rels" CASCADE; - DROP TABLE "hero_slider_rels" CASCADE; - DROP TABLE "site_access" CASCADE; - ALTER TABLE "products_rels" DROP CONSTRAINT "products_rels_preorder_products_fk"; - - ALTER TABLE "preorder_products_rels" DROP CONSTRAINT "preorder_products_rels_products_fk"; - - ALTER TABLE "payload_locked_documents_rels" DROP CONSTRAINT "payload_locked_documents_rels_disassembly_pages_fk"; - - DROP INDEX "products_handle_idx"; - DROP INDEX "products_seed_id_idx"; - DROP INDEX "products_rels_preorder_products_id_idx"; - DROP INDEX "preorder_products_handle_idx"; - DROP INDEX "preorder_products_seed_id_idx"; - DROP INDEX "preorder_products_rels_products_id_idx"; - DROP INDEX "payload_locked_documents_rels_disassembly_pages_id_idx"; - ALTER TABLE "preorder_products" ALTER COLUMN "description" SET DATA TYPE jsonb; - ALTER TABLE "hero_slider_slides" ALTER COLUMN "subtitle" DROP NOT NULL; - ALTER TABLE "preorder_products_rels" ADD COLUMN "order_products_id" integer; - ALTER TABLE "payload_locked_documents_rels" ADD COLUMN "order_products_id" integer; - ALTER TABLE "hero_slider_slides" ADD COLUMN "image_mobile_id" integer; - ALTER TABLE "product_recommendations_rels" ADD COLUMN "order_products_id" integer; - ALTER TABLE "order_products_rels" ADD CONSTRAINT "order_products_rels_parent_fk" FOREIGN KEY ("parent_id") REFERENCES "public"."order_products"("id") ON DELETE cascade ON UPDATE no action; - ALTER TABLE "order_products_rels" ADD CONSTRAINT "order_products_rels_preorder_products_fk" FOREIGN KEY ("preorder_products_id") REFERENCES "public"."preorder_products"("id") ON DELETE cascade ON UPDATE no action; - ALTER TABLE "order_products_rels" ADD CONSTRAINT "order_products_rels_order_products_fk" FOREIGN KEY ("order_products_id") REFERENCES "public"."order_products"("id") ON DELETE cascade ON UPDATE no action; - CREATE UNIQUE INDEX "order_products_medusa_id_idx" ON "order_products" USING btree ("medusa_id"); - CREATE INDEX "order_products_updated_at_idx" ON "order_products" USING btree ("updated_at"); - CREATE INDEX "order_products_created_at_idx" ON "order_products" USING btree ("created_at"); - CREATE INDEX "order_products_rels_order_idx" ON "order_products_rels" USING btree ("order"); - CREATE INDEX "order_products_rels_parent_idx" ON "order_products_rels" USING btree ("parent_id"); - CREATE INDEX "order_products_rels_path_idx" ON "order_products_rels" USING btree ("path"); - CREATE INDEX "order_products_rels_preorder_products_id_idx" ON "order_products_rels" USING btree ("preorder_products_id"); - CREATE INDEX "order_products_rels_order_products_id_idx" ON "order_products_rels" USING btree ("order_products_id"); - ALTER TABLE "preorder_products_rels" ADD CONSTRAINT "preorder_products_rels_order_products_fk" FOREIGN KEY ("order_products_id") REFERENCES "public"."order_products"("id") ON DELETE cascade ON UPDATE no action; - ALTER TABLE "payload_locked_documents_rels" ADD CONSTRAINT "payload_locked_documents_rels_order_products_fk" FOREIGN KEY ("order_products_id") REFERENCES "public"."order_products"("id") ON DELETE cascade ON UPDATE no action; - ALTER TABLE "hero_slider_slides" ADD CONSTRAINT "hero_slider_slides_image_mobile_id_media_id_fk" FOREIGN KEY ("image_mobile_id") REFERENCES "public"."media"("id") ON DELETE set null ON UPDATE no action; - ALTER TABLE "product_recommendations_rels" ADD CONSTRAINT "product_recommendations_rels_order_products_fk" FOREIGN KEY ("order_products_id") REFERENCES "public"."order_products"("id") ON DELETE cascade ON UPDATE no action; - CREATE INDEX "preorder_products_rels_order_products_id_idx" ON "preorder_products_rels" USING btree ("order_products_id"); - CREATE INDEX "payload_locked_documents_rels_order_products_id_idx" ON "payload_locked_documents_rels" USING btree ("order_products_id"); - CREATE INDEX "hero_slider_slides_image_mobile_idx" ON "hero_slider_slides" USING btree ("image_mobile_id"); - CREATE INDEX "product_recommendations_rels_order_products_id_idx" ON "product_recommendations_rels" USING btree ("order_products_id"); - ALTER TABLE "products" DROP COLUMN "seed_id"; - ALTER TABLE "products" DROP COLUMN "start_price"; - ALTER TABLE "products" DROP COLUMN "description"; - ALTER TABLE "products" DROP COLUMN "tags"; - ALTER TABLE "products" DROP COLUMN "type"; - ALTER TABLE "products" DROP COLUMN "collection"; - ALTER TABLE "products" DROP COLUMN "category"; - ALTER TABLE "products" DROP COLUMN "height"; - ALTER TABLE "products" DROP COLUMN "width"; - ALTER TABLE "products" DROP COLUMN "length"; - ALTER TABLE "products" DROP COLUMN "weight"; - ALTER TABLE "products" DROP COLUMN "mid_code"; - ALTER TABLE "products" DROP COLUMN "hs_code"; - ALTER TABLE "products" DROP COLUMN "country_of_origin"; - ALTER TABLE "products_rels" DROP COLUMN "preorder_products_id"; - ALTER TABLE "preorder_products" DROP COLUMN "seed_id"; - ALTER TABLE "preorder_products" DROP COLUMN "start_price"; - ALTER TABLE "preorder_products" DROP COLUMN "preorder_type"; - ALTER TABLE "preorder_products" DROP COLUMN "funding_goal"; - ALTER TABLE "preorder_products" DROP COLUMN "preorder_start_date"; - ALTER TABLE "preorder_products" DROP COLUMN "preorder_end_date"; - ALTER TABLE "preorder_products" DROP COLUMN "order_count"; - ALTER TABLE "preorder_products" DROP COLUMN "fake_order_count"; - ALTER TABLE "preorder_products" DROP COLUMN "content"; - ALTER TABLE "preorder_products" DROP COLUMN "tags"; - ALTER TABLE "preorder_products" DROP COLUMN "type"; - ALTER TABLE "preorder_products" DROP COLUMN "collection"; - ALTER TABLE "preorder_products" DROP COLUMN "category"; - ALTER TABLE "preorder_products" DROP COLUMN "height"; - ALTER TABLE "preorder_products" DROP COLUMN "width"; - ALTER TABLE "preorder_products" DROP COLUMN "length"; - ALTER TABLE "preorder_products" DROP COLUMN "weight"; - ALTER TABLE "preorder_products" DROP COLUMN "mid_code"; - ALTER TABLE "preorder_products" DROP COLUMN "hs_code"; - ALTER TABLE "preorder_products" DROP COLUMN "country_of_origin"; - ALTER TABLE "preorder_products_rels" DROP COLUMN "products_id"; - ALTER TABLE "payload_locked_documents_rels" DROP COLUMN "disassembly_pages_id"; - ALTER TABLE "hero_slider_slides" DROP COLUMN "desc"; - ALTER TABLE "hero_slider_slides" DROP COLUMN "layout"; - ALTER TABLE "hero_slider_slides" DROP COLUMN "show_focus_circle"; - ALTER TABLE "hero_slider_slides" DROP COLUMN "price"; - ALTER TABLE "product_recommendations_lists" DROP COLUMN "preorder"; - DROP TYPE "public"."enum_preorder_products_preorder_type"; - DROP TYPE "public"."enum_hero_slider_slides_layout";`) -} diff --git a/src/migrations/20260223_disassembly_refactor.ts b/src/migrations/20260223_disassembly_refactor.ts deleted file mode 100644 index d9acace..0000000 --- a/src/migrations/20260223_disassembly_refactor.ts +++ /dev/null @@ -1,250 +0,0 @@ -import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres' - -/** - * 迁移:将 disassembly_pages 的嵌套数组表重构为三个独立 Collection - * - * 旧结构(arrays): - * disassembly_pages - * disassembly_pages_components (array: order, parent_id, label, 坐标, 半径) - * disassembly_pages_components_linked_products (nested array: order, parent_id, 坐标, product_name) - * disassembly_pages_rels (products_id, preorder_products_id) - * - * 新结构(独立 Collections): - * disassembly_pages (保留主表,rels 改为指向 disassembly_components) - * disassembly_components (第二层 Collection) - * disassembly_components_rels (linkedProducts → disassembly_linked_products) - * disassembly_linked_products (第三层 Collection) - * disassembly_linked_products_rels (products, preorder_products) - */ -export async function up({ db, payload, req }: MigrateUpArgs): Promise { - await db.execute(sql` - -- ── 1. 创建 disassembly_components 表 ────────────────────────────── - CREATE TABLE "disassembly_components" ( - "id" serial PRIMARY KEY NOT NULL, - "label" varchar NOT NULL, - "start_coordinate_x" numeric DEFAULT 0 NOT NULL, - "start_coordinate_y" numeric DEFAULT 0 NOT NULL, - "start_radius" numeric DEFAULT 20 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 INDEX "disassembly_components_updated_at_idx" - ON "disassembly_components" USING btree ("updated_at"); - CREATE INDEX "disassembly_components_created_at_idx" - ON "disassembly_components" USING btree ("created_at"); - - -- ── 2. 创建 disassembly_components_rels 表 ────────────────────────── - CREATE TABLE "disassembly_components_rels" ( - "id" serial PRIMARY KEY NOT NULL, - "order" integer, - "parent_id" integer NOT NULL, - "path" varchar NOT NULL, - "disassembly_linked_products_id" integer - ); - - ALTER TABLE "disassembly_components_rels" - ADD CONSTRAINT "disassembly_components_rels_parent_fk" - FOREIGN KEY ("parent_id") REFERENCES "public"."disassembly_components"("id") - ON DELETE cascade ON UPDATE no action; - - CREATE INDEX "disassembly_components_rels_order_idx" - ON "disassembly_components_rels" USING btree ("order"); - CREATE INDEX "disassembly_components_rels_parent_idx" - ON "disassembly_components_rels" USING btree ("parent_id"); - CREATE INDEX "disassembly_components_rels_path_idx" - ON "disassembly_components_rels" USING btree ("path"); - - -- ── 3. 创建 disassembly_linked_products 表 ────────────────────────── - CREATE TABLE "disassembly_linked_products" ( - "id" serial PRIMARY KEY NOT NULL, - "coordinate_x" numeric DEFAULT 0 NOT NULL, - "coordinate_y" numeric DEFAULT 0 NOT NULL, - "product_name" varchar, - "updated_at" timestamp(3) with time zone DEFAULT now() NOT NULL, - "created_at" timestamp(3) with time zone DEFAULT now() NOT NULL - ); - - CREATE INDEX "disassembly_linked_products_updated_at_idx" - ON "disassembly_linked_products" USING btree ("updated_at"); - CREATE INDEX "disassembly_linked_products_created_at_idx" - ON "disassembly_linked_products" USING btree ("created_at"); - - -- ── 4. 创建 disassembly_linked_products_rels 表 ───────────────────── - CREATE TABLE "disassembly_linked_products_rels" ( - "id" serial PRIMARY KEY NOT NULL, - "order" integer, - "parent_id" integer NOT NULL, - "path" varchar NOT NULL, - "products_id" integer, - "preorder_products_id" integer - ); - - ALTER TABLE "disassembly_linked_products_rels" - ADD CONSTRAINT "disassembly_linked_products_rels_parent_fk" - FOREIGN KEY ("parent_id") REFERENCES "public"."disassembly_linked_products"("id") - ON DELETE cascade ON UPDATE no action; - - ALTER TABLE "disassembly_linked_products_rels" - ADD CONSTRAINT "disassembly_linked_products_rels_products_fk" - FOREIGN KEY ("products_id") REFERENCES "public"."products"("id") - ON DELETE cascade ON UPDATE no action; - - ALTER TABLE "disassembly_linked_products_rels" - ADD CONSTRAINT "disassembly_linked_products_rels_preorder_products_fk" - FOREIGN KEY ("preorder_products_id") REFERENCES "public"."preorder_products"("id") - ON DELETE cascade ON UPDATE no action; - - CREATE INDEX "disassembly_linked_products_rels_order_idx" - ON "disassembly_linked_products_rels" USING btree ("order"); - CREATE INDEX "disassembly_linked_products_rels_parent_idx" - ON "disassembly_linked_products_rels" USING btree ("parent_id"); - CREATE INDEX "disassembly_linked_products_rels_path_idx" - ON "disassembly_linked_products_rels" USING btree ("path"); - CREATE INDEX "disassembly_linked_products_rels_products_id_idx" - ON "disassembly_linked_products_rels" USING btree ("products_id"); - CREATE INDEX "disassembly_linked_products_rels_preorder_products_id_idx" - ON "disassembly_linked_products_rels" USING btree ("preorder_products_id"); - - -- ── 5. 修改 disassembly_pages_rels:指向 disassembly_components ────── - -- 移除旧的 products/preorder_products 外键及列(已迁移到 disassembly_linked_products_rels) - ALTER TABLE "disassembly_pages_rels" - DROP CONSTRAINT IF EXISTS "disassembly_pages_rels_products_fk"; - ALTER TABLE "disassembly_pages_rels" - DROP CONSTRAINT IF EXISTS "disassembly_pages_rels_preorder_products_fk"; - DROP INDEX IF EXISTS "disassembly_pages_rels_products_id_idx"; - DROP INDEX IF EXISTS "disassembly_pages_rels_preorder_products_id_idx"; - ALTER TABLE "disassembly_pages_rels" DROP COLUMN IF EXISTS "products_id"; - ALTER TABLE "disassembly_pages_rels" DROP COLUMN IF EXISTS "preorder_products_id"; - - -- 添加 disassembly_components_id 列 - ALTER TABLE "disassembly_pages_rels" - ADD COLUMN "disassembly_components_id" integer; - - ALTER TABLE "disassembly_pages_rels" - ADD CONSTRAINT "disassembly_pages_rels_disassembly_components_fk" - FOREIGN KEY ("disassembly_components_id") REFERENCES "public"."disassembly_components"("id") - ON DELETE cascade ON UPDATE no action; - - CREATE INDEX "disassembly_pages_rels_disassembly_components_id_idx" - ON "disassembly_pages_rels" USING btree ("disassembly_components_id"); - - -- ── 6. 添加 payload_locked_documents_rels 的新 Collection 引用 ──────── - ALTER TABLE "payload_locked_documents_rels" - ADD COLUMN "disassembly_components_id" integer; - ALTER TABLE "payload_locked_documents_rels" - ADD COLUMN "disassembly_linked_products_id" integer; - - ALTER TABLE "payload_locked_documents_rels" - ADD CONSTRAINT "payload_locked_documents_rels_disassembly_components_fk" - FOREIGN KEY ("disassembly_components_id") REFERENCES "public"."disassembly_components"("id") - ON DELETE cascade ON UPDATE no action; - - ALTER TABLE "payload_locked_documents_rels" - ADD CONSTRAINT "payload_locked_documents_rels_disassembly_linked_products_fk" - FOREIGN KEY ("disassembly_linked_products_id") REFERENCES "public"."disassembly_linked_products"("id") - ON DELETE cascade ON UPDATE no action; - - CREATE INDEX "payload_locked_documents_rels_disassembly_components_id_idx" - ON "payload_locked_documents_rels" USING btree ("disassembly_components_id"); - CREATE INDEX "payload_locked_documents_rels_disassembly_linked_products_id_idx" - ON "payload_locked_documents_rels" USING btree ("disassembly_linked_products_id"); - - -- ── 7. 为 disassembly_components_rels 添加外键(在目标表创建后)──────── - ALTER TABLE "disassembly_components_rels" - ADD CONSTRAINT "disassembly_components_rels_disassembly_linked_products_fk" - FOREIGN KEY ("disassembly_linked_products_id") REFERENCES "public"."disassembly_linked_products"("id") - ON DELETE cascade ON UPDATE no action; - - CREATE INDEX "disassembly_components_rels_disassembly_linked_products_id_idx" - ON "disassembly_components_rels" USING btree ("disassembly_linked_products_id"); - - -- ── 8. 删除旧的嵌套数组表 ─────────────────────────────────────────── - ALTER TABLE "disassembly_pages_components_linked_products" DISABLE ROW LEVEL SECURITY; - ALTER TABLE "disassembly_pages_components" DISABLE ROW LEVEL SECURITY; - DROP TABLE "disassembly_pages_components_linked_products" CASCADE; - DROP TABLE "disassembly_pages_components" CASCADE; - `) -} - -export async function down({ db, payload, req }: MigrateDownArgs): Promise { - await db.execute(sql` - -- ── 还原:重新创建旧的嵌套数组表 ──────────────────────────────────── - CREATE TABLE "disassembly_pages_components_linked_products" ( - "_order" integer NOT NULL, - "_parent_id" varchar NOT NULL, - "id" varchar PRIMARY KEY NOT NULL, - "coordinate_x" numeric DEFAULT 0 NOT NULL, - "coordinate_y" numeric DEFAULT 0 NOT NULL, - "product_name" varchar - ); - - CREATE TABLE "disassembly_pages_components" ( - "_order" integer NOT NULL, - "_parent_id" integer NOT NULL, - "id" varchar PRIMARY KEY NOT NULL, - "label" varchar, - "start_coordinate_x" numeric DEFAULT 0 NOT NULL, - "start_coordinate_y" numeric DEFAULT 0 NOT NULL, - "start_radius" numeric DEFAULT 20 NOT NULL - ); - - ALTER TABLE "disassembly_pages_components_linked_products" - ADD CONSTRAINT "disassembly_pages_components_linked_products_parent_id_fk" - FOREIGN KEY ("_parent_id") REFERENCES "public"."disassembly_pages_components"("id") - ON DELETE cascade ON UPDATE no action; - - ALTER TABLE "disassembly_pages_components" - ADD CONSTRAINT "disassembly_pages_components_parent_id_fk" - FOREIGN KEY ("_parent_id") REFERENCES "public"."disassembly_pages"("id") - ON DELETE cascade ON UPDATE no action; - - CREATE INDEX "disassembly_pages_components_linked_products_order_idx" - ON "disassembly_pages_components_linked_products" USING btree ("_order"); - CREATE INDEX "disassembly_pages_components_linked_products_parent_id_idx" - ON "disassembly_pages_components_linked_products" USING btree ("_parent_id"); - CREATE INDEX "disassembly_pages_components_order_idx" - ON "disassembly_pages_components" USING btree ("_order"); - CREATE INDEX "disassembly_pages_components_parent_id_idx" - ON "disassembly_pages_components" USING btree ("_parent_id"); - - -- 还原 disassembly_pages_rels - ALTER TABLE "disassembly_pages_rels" - DROP CONSTRAINT IF EXISTS "disassembly_pages_rels_disassembly_components_fk"; - DROP INDEX IF EXISTS "disassembly_pages_rels_disassembly_components_id_idx"; - ALTER TABLE "disassembly_pages_rels" DROP COLUMN IF EXISTS "disassembly_components_id"; - - ALTER TABLE "disassembly_pages_rels" ADD COLUMN "products_id" integer; - ALTER TABLE "disassembly_pages_rels" ADD COLUMN "preorder_products_id" integer; - - ALTER TABLE "disassembly_pages_rels" - ADD CONSTRAINT "disassembly_pages_rels_products_fk" - FOREIGN KEY ("products_id") REFERENCES "public"."products"("id") - ON DELETE cascade ON UPDATE no action; - ALTER TABLE "disassembly_pages_rels" - ADD CONSTRAINT "disassembly_pages_rels_preorder_products_fk" - FOREIGN KEY ("preorder_products_id") REFERENCES "public"."preorder_products"("id") - ON DELETE cascade ON UPDATE no action; - - CREATE INDEX "disassembly_pages_rels_products_id_idx" - ON "disassembly_pages_rels" USING btree ("products_id"); - CREATE INDEX "disassembly_pages_rels_preorder_products_id_idx" - ON "disassembly_pages_rels" USING btree ("preorder_products_id"); - - -- 还原 payload_locked_documents_rels - ALTER TABLE "payload_locked_documents_rels" - DROP CONSTRAINT IF EXISTS "payload_locked_documents_rels_disassembly_components_fk"; - ALTER TABLE "payload_locked_documents_rels" - DROP CONSTRAINT IF EXISTS "payload_locked_documents_rels_disassembly_linked_products_fk"; - DROP INDEX IF EXISTS "payload_locked_documents_rels_disassembly_components_id_idx"; - DROP INDEX IF EXISTS "payload_locked_documents_rels_disassembly_linked_products_id_idx"; - ALTER TABLE "payload_locked_documents_rels" DROP COLUMN IF EXISTS "disassembly_components_id"; - ALTER TABLE "payload_locked_documents_rels" DROP COLUMN IF EXISTS "disassembly_linked_products_id"; - - -- 删除新的 Collection 表 - DROP TABLE IF EXISTS "disassembly_linked_products_rels" CASCADE; - DROP TABLE IF EXISTS "disassembly_linked_products" CASCADE; - DROP TABLE IF EXISTS "disassembly_components_rels" CASCADE; - DROP TABLE IF EXISTS "disassembly_components" CASCADE; - `) -} diff --git a/src/migrations/baseline.ts b/src/migrations/baseline.ts new file mode 100644 index 0000000..f5127f0 --- /dev/null +++ b/src/migrations/baseline.ts @@ -0,0 +1,20 @@ +import { MigrateUpArgs, MigrateDownArgs, sql } from '@payloadcms/db-postgres' + +/** + * Baseline migration — represents the complete current schema state. + * + * All tables were originally created and evolved through dev-mode pushes + * and prior migrations (all applied). This file consolidates them into a + * single entry so Payload's migration tracker stays clean. + * + * For a fresh database, run `pnpm payload migrate:fresh` to let Payload + * rebuild the schema from the collection config, then run this migration + * to record the baseline as applied. + */ +export async function up({ db }: MigrateUpArgs): Promise { + // Schema is already up-to-date; nothing to execute. +} + +export async function down({ db }: MigrateDownArgs): Promise { + // No rollback for baseline. +} diff --git a/src/migrations/hero_slider_simplify.ts b/src/migrations/hero_slider_simplify.ts deleted file mode 100644 index 60fe068..0000000 --- a/src/migrations/hero_slider_simplify.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { MigrateUpArgs, sql } from '@payloadcms/db-postgres' - -export async function up({ db }: MigrateUpArgs): Promise { - await db.execute(sql`ALTER TABLE hero_slider_slides ADD COLUMN IF NOT EXISTS link TEXT;`) - - await db.execute( - sql`UPDATE hero_slider_slides SET link = cta_link WHERE cta_link IS NOT NULL AND cta_enabled = true;`, - ) - - await db.execute( - sql`ALTER TABLE hero_slider_slides - DROP COLUMN IF EXISTS cta_enabled, - DROP COLUMN IF EXISTS cta_text, - DROP COLUMN IF EXISTS cta_style, - DROP COLUMN IF EXISTS cta_link, - DROP COLUMN IF EXISTS cta_new_tab, - DROP COLUMN IF EXISTS text_position, - DROP COLUMN IF EXISTS text_color, - DROP COLUMN IF EXISTS overlay, - DROP COLUMN IF EXISTS status;`, - ) -} diff --git a/src/migrations/index.ts b/src/migrations/index.ts index 9a20a0c..78d325a 100644 --- a/src/migrations/index.ts +++ b/src/migrations/index.ts @@ -1,45 +1,10 @@ -import * as migration_20260208_171142 from './20260208_171142'; -import * as migration_20260212_193303 from './20260212_193303'; -import * as migration_20260212_202303 from './20260212_202303'; -import * as migration_20260222_170233 from './20260222_170233'; -import * as migration_hero_slider_simplify from './hero_slider_simplify'; -import * as migration_product_recommendations_simplify from './product_recommendations_simplify'; -import * as migration_20260223_disassembly_refactor from './20260223_disassembly_refactor'; +import * as migration_baseline from './baseline' export const migrations = [ { - up: migration_20260208_171142.up, - down: migration_20260208_171142.down, - name: '20260208_171142', + up: migration_baseline.up, + down: migration_baseline.down, + name: 'baseline', }, - { - up: migration_20260212_193303.up, - down: migration_20260212_193303.down, - name: '20260212_193303', - }, - { - up: migration_20260212_202303.up, - down: migration_20260212_202303.down, - name: '20260212_202303', - }, - { - up: migration_20260222_170233.up, - down: migration_20260222_170233.down, - name: '20260222_170233', - }, - { - up: migration_hero_slider_simplify.up, - down: migration_hero_slider_simplify.down, - name: 'hero_slider_simplify', - }, - { - up: migration_product_recommendations_simplify.up, - down: migration_product_recommendations_simplify.down, - name: 'product_recommendations_simplify' - }, - { - up: migration_20260223_disassembly_refactor.up, - down: migration_20260223_disassembly_refactor.down, - name: '20260223_disassembly_refactor', - }, -]; +] + diff --git a/src/migrations/product_recommendations_simplify.ts b/src/migrations/product_recommendations_simplify.ts deleted file mode 100644 index 9eead38..0000000 --- a/src/migrations/product_recommendations_simplify.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { MigrateUpArgs, sql } from '@payloadcms/db-postgres' - -export async function up({ db }: MigrateUpArgs): Promise { - await db.execute( - sql`ALTER TABLE product_recommendations_lists - DROP COLUMN IF EXISTS slug, - DROP COLUMN IF EXISTS type, - DROP COLUMN IF EXISTS display_limit, - DROP COLUMN IF EXISTS show_view_all, - DROP COLUMN IF EXISTS view_all_link, - DROP COLUMN IF EXISTS layout, - DROP COLUMN IF EXISTS columns, - DROP COLUMN IF EXISTS show_price, - DROP COLUMN IF EXISTS show_rating, - DROP COLUMN IF EXISTS show_quick_view, - DROP COLUMN IF EXISTS status;`, - ) -} diff --git a/src/payload-types.ts b/src/payload-types.ts index 55b500c..9cc9525 100644 --- a/src/payload-types.ts +++ b/src/payload-types.ts @@ -78,6 +78,7 @@ export interface Config { 'disassembly-areas': DisassemblyArea; 'disassembly-components': DisassemblyComponent; 'disassembly-linked-products': DisassemblyLinkedProduct; + precautions: Precaution; 'payload-kv': PayloadKv; 'payload-jobs': PayloadJob; 'payload-locked-documents': PayloadLockedDocument; @@ -97,6 +98,7 @@ export interface Config { 'disassembly-areas': DisassemblyAreasSelect | DisassemblyAreasSelect; 'disassembly-components': DisassemblyComponentsSelect | DisassemblyComponentsSelect; 'disassembly-linked-products': DisassemblyLinkedProductsSelect | DisassemblyLinkedProductsSelect; + precautions: PrecautionsSelect | PrecautionsSelect; 'payload-kv': PayloadKvSelect | PayloadKvSelect; 'payload-jobs': PayloadJobsSelect | PayloadJobsSelect; 'payload-locked-documents': PayloadLockedDocumentsSelect | PayloadLockedDocumentsSelect; @@ -241,6 +243,10 @@ export interface Product { * 产品简介(纯文本,从 Medusa 同步,显示在卡片和列表页) */ description?: string | null; + /** + * 访问密码(用于保护特定产品页面或内容) + */ + accessPassword?: string | null; /** * 商品详细内容(富文本,由 Payload 编辑,展示在产品详情页) */ @@ -318,6 +324,54 @@ export interface Product { * 原产国(从 Medusa 同步) */ countryOfOrigin?: string | null; + /** + * 产品项目状态列表,可直接在此添加和编辑 + */ + projectStatuses?: + | { + /** + * 状态名称,例如:研发中、众筹中、量产中 + */ + title: string; + /** + * 状态徽章标签(简短文字,展示在产品卡片上) + */ + badge?: string | null; + /** + * 状态简介 + */ + description?: string | null; + /** + * 排序权重(数值越小越靠前) + */ + order?: number | null; + id?: string | null; + }[] + | null; + /** + * 引用通用注意事项(在《通用注意事项》集合中统一管理,可被多个产品复用) + */ + sharedPrecautions?: (string | Precaution)[] | null; + /** + * 产品专属注意事项,可直接在此添加和编辑 + */ + precautions?: + | { + /** + * 注意事项标题,例如:安装注意事项、使用须知 + */ + title: string; + /** + * 注意事项摘要 + */ + summary?: string | null; + /** + * 排序权重(数值越小越靠前) + */ + order?: number | null; + id?: string | null; + }[] + | null; /** * 💡 管理淘宝采购链接(仅后台显示,不通过 API 暴露) */ @@ -387,6 +441,10 @@ export interface PreorderProduct { * 产品简介(纯文本,从 Medusa 同步,显示在卡片和列表页) */ description?: string | null; + /** + * 访问密码(用于保护特定产品页面或内容) + */ + accessPassword?: string | null; /** * 预购类型 */ @@ -488,6 +546,54 @@ export interface PreorderProduct { * 原产国(从 Medusa 同步) */ countryOfOrigin?: string | null; + /** + * 产品项目状态列表,可直接在此添加和编辑 + */ + projectStatuses?: + | { + /** + * 状态名称,例如:研发中、众筹中、量产中 + */ + title: string; + /** + * 状态徽章标签(简短文字,展示在产品卡片上) + */ + badge?: string | null; + /** + * 状态简介 + */ + description?: string | null; + /** + * 排序权重(数值越小越靠前) + */ + order?: number | null; + id?: string | null; + }[] + | null; + /** + * 引用通用注意事项(在《通用注意事项》集合中统一管理,可被多个产品复用) + */ + sharedPrecautions?: (string | Precaution)[] | null; + /** + * 产品专属注意事项,可直接在此添加和编辑 + */ + precautions?: + | { + /** + * 注意事项标题,例如:安装注意事项、使用须知 + */ + title: string; + /** + * 注意事项摘要 + */ + summary?: string | null; + /** + * 排序权重(数值越小越靠前) + */ + order?: number | null; + id?: string | null; + }[] + | null; /** * 💡 管理淘宝采购链接(仅后台显示,不通过 API 暴露) */ @@ -513,6 +619,29 @@ export interface PreorderProduct { updatedAt: string; createdAt: string; } +/** + * 管理通用注意事项,可被多个产品复用引用 + * + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "precautions". + */ +export interface Precaution { + /** + * 注意事项标题,例如:安装注意事项、使用须知 + */ + title: string; + /** + * 注意事项摘要 + */ + summary?: string | null; + /** + * 排序权重(数值越小越靠前) + */ + order?: number | null; + id: string; + updatedAt: string; + createdAt: string; +} /** * 管理系统公告和通知 * @@ -1004,6 +1133,10 @@ export interface PayloadLockedDocument { | ({ relationTo: 'disassembly-linked-products'; value: number | DisassemblyLinkedProduct; + } | null) + | ({ + relationTo: 'precautions'; + value: string | Precaution; } | null); globalSlug?: string | null; user: { @@ -1102,6 +1235,7 @@ export interface ProductsSelect { startPrice?: T; lastSyncedAt?: T; description?: T; + accessPassword?: T; content?: T; relatedProducts?: T; tags?: T; @@ -1115,6 +1249,24 @@ export interface ProductsSelect { midCode?: T; hsCode?: T; countryOfOrigin?: T; + projectStatuses?: + | T + | { + title?: T; + badge?: T; + description?: T; + order?: T; + id?: T; + }; + sharedPrecautions?: T; + precautions?: + | T + | { + title?: T; + summary?: T; + order?: T; + id?: T; + }; taobaoLinks?: | T | { @@ -1142,6 +1294,7 @@ export interface PreorderProductsSelect { startPrice?: T; lastSyncedAt?: T; description?: T; + accessPassword?: T; preorderType?: T; fundingGoal?: T; preorderStartDate?: T; @@ -1161,6 +1314,24 @@ export interface PreorderProductsSelect { midCode?: T; hsCode?: T; countryOfOrigin?: T; + projectStatuses?: + | T + | { + title?: T; + badge?: T; + description?: T; + order?: T; + id?: T; + }; + sharedPrecautions?: T; + precautions?: + | T + | { + title?: T; + summary?: T; + order?: T; + id?: T; + }; taobaoLinks?: | T | { @@ -1294,6 +1465,18 @@ export interface DisassemblyLinkedProductsSelect { updatedAt?: T; createdAt?: T; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "precautions_select". + */ +export interface PrecautionsSelect { + title?: T; + summary?: T; + order?: T; + id?: T; + updatedAt?: T; + createdAt?: T; +} /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "payload-kv_select". diff --git a/src/payload.config.ts b/src/payload.config.ts index d5c6e2c..a943f10 100644 --- a/src/payload.config.ts +++ b/src/payload.config.ts @@ -7,8 +7,8 @@ import sharp from 'sharp' import { Users } from './collections/Users' import { Media } from './collections/Media' -import { Products } from './collections/Products' -import { PreorderProducts } from './collections/PreorderProducts' +import { Products } from './collections/products/Products' +import { PreorderProducts } from './collections/products/PreorderProducts' import { Announcements } from './collections/Announcements' import { Articles } from './collections/Articles' import { Logs } from './collections/Logs' @@ -16,6 +16,7 @@ import { DisassemblyPages } from './collections/disassembly/DisassemblyPages' import { DisassemblyAreas } from './collections/disassembly/DisassemblyAreas' import { DisassemblyComponents } from './collections/disassembly/DisassemblyComponents' import { DisassemblyLinkedProducts } from './collections/disassembly/DisassemblyLinkedProducts' +import { Precautions } from './collections/Precautions' import { AdminSettings } from './globals/AdminSettings' import { LogsManager } from './globals/LogsManager' import { HeroSlider } from './globals/HeroSlider' @@ -61,7 +62,7 @@ export default buildConfig({ }, fallbackLanguage: 'zh', }, - collections: [Users, Media, Products, PreorderProducts, Announcements, Articles, Logs, DisassemblyPages, DisassemblyAreas, DisassemblyComponents, DisassemblyLinkedProducts], + collections: [Users, Media, Products, PreorderProducts, Announcements, Articles, Logs, DisassemblyPages, DisassemblyAreas, DisassemblyComponents, DisassemblyLinkedProducts, Precautions], globals: [AdminSettings, LogsManager, HeroSlider, ProductRecommendations, SiteAccess], editor: lexicalEditor(), secret: process.env.PAYLOAD_SECRET || '',