diff --git a/src/app/(payload)/admin/importMap.js b/src/app/(payload)/admin/importMap.js index ef9c8fe..e0e8d15 100644 --- a/src/app/(payload)/admin/importMap.js +++ b/src/app/(payload)/admin/importMap.js @@ -28,6 +28,7 @@ import { RelatedProductsField as RelatedProductsField_f3e26ca26ab1ef52a2ee0f6932 import { SyncMedusaButton as SyncMedusaButton_31e6578e170fdd0bad7013c8202d6e08 } from '../../../components/sync/SyncMedusaButton' import { default as default_c2e3814fe427263135b1f5931c37f6f2 } from '../../../components/list/ProductGridStyler' import { ForceSyncButton as ForceSyncButton_28396efe36d6238add95cf44109e281c } from '../../../components/sync/ForceSyncButton' +import { BlocksFeatureClient as BlocksFeatureClient_e70f5e05f09f93e00b997edb1ef0c864 } from '@payloadcms/richtext-lexical/client' import { default as default_767734c8b7b095ea28d54c32abcf46e4 } from '../../../components/views/AdminPanel' import { default as default_a766ef013722c08f9bb937940272cb5f } from '../../../components/views/LogsManagerView' import { S3ClientUploadHandler as S3ClientUploadHandler_f97aa6c64367fa259c5bc0567239ef24 } from '@payloadcms/storage-s3/client' @@ -64,6 +65,7 @@ export const importMap = { "/components/sync/SyncMedusaButton#SyncMedusaButton": SyncMedusaButton_31e6578e170fdd0bad7013c8202d6e08, "/components/list/ProductGridStyler#default": default_c2e3814fe427263135b1f5931c37f6f2, "/components/sync/ForceSyncButton#ForceSyncButton": ForceSyncButton_28396efe36d6238add95cf44109e281c, + "@payloadcms/richtext-lexical/client#BlocksFeatureClient": BlocksFeatureClient_e70f5e05f09f93e00b997edb1ef0c864, "/components/views/AdminPanel#default": default_767734c8b7b095ea28d54c32abcf46e4, "/components/views/LogsManagerView#default": default_a766ef013722c08f9bb937940272cb5f, "@payloadcms/storage-s3/client#S3ClientUploadHandler": S3ClientUploadHandler_f97aa6c64367fa259c5bc0567239ef24, diff --git a/src/app/api/public/products/[id]/route.ts b/src/app/api/public/products/[id]/route.ts index e371ad7..9ff7306 100644 --- a/src/app/api/public/products/[id]/route.ts +++ b/src/app/api/public/products/[id]/route.ts @@ -6,13 +6,17 @@ import { getCache, setCache } from '@/lib/redis' /** * GET /api/public/products/[id] * 获取单个产品详情(带缓存) + * 支持参数: + * - collection: 'preorder-products' | 'products' (可选,如不指定则自动搜索) */ export async function GET(req: NextRequest, { params }: { params: { id: string } }) { try { const { id } = params + const searchParams = req.nextUrl.searchParams + const collection = searchParams.get('collection') // 生成缓存 key - const cacheKey = `products:detail:${id}` + const cacheKey = `products:detail:${id}:collection=${collection || 'auto'}` // 尝试从缓存获取 const cached = await getCache(cacheKey) @@ -24,13 +28,50 @@ export async function GET(req: NextRequest, { params }: { params: { id: string } }) } - // 从数据库获取 const payload = await getPayload({ config }) - const result = await payload.findByID({ - collection: 'products', - id, - depth: 2, - }) + let result: any = null + let foundCollection: string = '' + + if (collection) { + // 如果指定了 collection,直接查询 + try { + result = await payload.findByID({ + collection: collection as any, + id, + depth: 2, + }) + foundCollection = collection + } catch { + // 找不到 + } + } else { + // 自动搜索各个 collection + const collections = ['preorder-products', 'products'] + + for (const col of collections) { + try { + result = await payload.findByID({ + collection: col as any, + id, + depth: 2, + }) + foundCollection = col + break + } catch { + // 继续尝试下一个 + } + } + } + + if (!result) { + return NextResponse.json( + { + success: false, + error: 'Product not found', + }, + { status: 404 }, + ) + } // 只有已发布的产品才返回 if (result.status !== 'published') { @@ -43,12 +84,18 @@ export async function GET(req: NextRequest, { params }: { params: { id: string } ) } + // 添加 collection 信息 + const resultWithMeta = { + ...result, + _collection: foundCollection, + } + // 缓存结果(1 小时) - await setCache(cacheKey, result, 3600) + await setCache(cacheKey, resultWithMeta, 3600) return NextResponse.json({ success: true, - data: result, + data: resultWithMeta, cached: false, }) } catch (error) { diff --git a/src/app/api/public/products/route.ts b/src/app/api/public/products/route.ts index fbe89d0..418e826 100644 --- a/src/app/api/public/products/route.ts +++ b/src/app/api/public/products/route.ts @@ -6,6 +6,11 @@ import { getCache, setCache } from '@/lib/redis' /** * GET /api/public/products * 获取产品列表(带缓存) + * 支持参数: + * - type: 'preorder' | 'order' | 'all' (默认 'all') + * - page: 页码 + * - limit: 每页数量 + * - status: 'draft' | 'published' (默认 'published') */ export async function GET(req: NextRequest) { try { @@ -13,9 +18,10 @@ export async function GET(req: NextRequest) { const page = parseInt(searchParams.get('page') || '1', 10) const limit = parseInt(searchParams.get('limit') || '10', 10) const status = searchParams.get('status') || 'published' + const type = searchParams.get('type') || 'all' // 生成缓存 key - const cacheKey = `products:list:page=${page}:limit=${limit}:status=${status}` + const cacheKey = `products:list:type=${type}:page=${page}:limit=${limit}:status=${status}` // 尝试从缓存获取 const cached = await getCache(cacheKey) @@ -27,17 +33,74 @@ export async function GET(req: NextRequest) { }) } - // 从数据库获取 const payload = await getPayload({ config }) - const result = await payload.find({ - collection: 'products', - where: { - status: { equals: status }, - }, - page, - limit, - depth: 1, - }) + const where = { status: { equals: status } } + + let result + + if (type === 'all') { + // 查询所有类型 + const [preorders, products] = await Promise.all([ + payload.find({ + collection: 'preorder-products', + where, + page, + limit, + depth: 1, + }), + payload.find({ + collection: 'products', + where, + page, + limit, + depth: 1, + }), + ]) + + // 合并结果 + result = { + docs: [ + ...preorders.docs.map((doc) => ({ ...doc, _type: 'preorder-products' })), + ...products.docs.map((doc) => ({ ...doc, _type: 'products' })), + ], + totalDocs: preorders.totalDocs + products.totalDocs, + limit, + page, + totalPages: Math.ceil( + (preorders.totalDocs + products.totalDocs) / limit, + ), + hasNextPage: + page < Math.ceil((preorders.totalDocs + products.totalDocs) / limit), + hasPrevPage: page > 1, + } + } else if (type === 'preorder') { + // 只查询预售商品 + result = await payload.find({ + collection: 'preorder-products', + where, + page, + limit, + depth: 1, + }) + } else if (type === 'order') { + // 只查询现货商品 + result = await payload.find({ + collection: 'products', + where, + page, + limit, + depth: 1, + }) + } else { + // 旧的 products collection + result = await payload.find({ + collection: 'products', + where, + page, + limit, + depth: 1, + }) + } // 缓存结果(1 小时) await setCache(cacheKey, result, 3600) diff --git a/src/app/api/sync-medusa/route.ts b/src/app/api/sync-medusa/route.ts index bd58d3d..8ebeb66 100644 --- a/src/app/api/sync-medusa/route.ts +++ b/src/app/api/sync-medusa/route.ts @@ -5,6 +5,7 @@ import { getAllMedusaProducts, transformMedusaProductToPayload, getMedusaProductsPaginated, + getProductCollection, } from '@/lib/medusa' /** @@ -18,6 +19,7 @@ export async function GET(request: Request) { const { searchParams } = new URL(request.url) const medusaId = searchParams.get('medusaId') const payloadId = searchParams.get('payloadId') + const collection = searchParams.get('collection') const forceUpdate = searchParams.get('forceUpdate') === 'true' const payload = await getPayload({ config }) @@ -30,7 +32,12 @@ export async function GET(request: Request) { // 同步单个商品(通过 Payload ID) if (payloadId) { - const result = await syncSingleProductByPayloadId(payload, payloadId, forceUpdate) + const result = await syncSingleProductByPayloadId( + payload, + payloadId, + collection || '', + forceUpdate, + ) return NextResponse.json(result) } @@ -54,27 +61,6 @@ export async function GET(request: Request) { */ async function syncSingleProductByMedusaId(payload: any, medusaId: string, forceUpdate: boolean) { try { - // 检查商品是否已存在 - const existing = await payload.find({ - collection: 'products', - where: { - medusaId: { equals: medusaId }, - }, - limit: 1, - }) - - const existingProduct = existing.docs[0] - - // 如果存在且不强制更新,跳过 - if (existingProduct && !forceUpdate) { - return { - success: true, - action: 'skipped', - message: `商品 ${medusaId} 已存在`, - productId: existingProduct.id, - } - } - // 从 Medusa 获取商品数据 const medusaProducts = await getAllMedusaProducts() const medusaProduct = medusaProducts.find((p) => p.id === medusaId) @@ -87,12 +73,69 @@ async function syncSingleProductByMedusaId(payload: any, medusaId: string, force } } + // 确定应该同步到哪个 collection + const targetCollection = getProductCollection(medusaProduct) + const otherCollection = + targetCollection === 'preorder-products' ? 'products' : 'preorder-products' + + // 在目标 collection 中检查是否已存在 + const existingInTarget = await payload.find({ + collection: targetCollection, + where: { + medusaId: { equals: medusaId }, + }, + limit: 1, + }) + + // 在另一个 collection 中检查是否存在(产品类型可能改变) + const existingInOther = await payload.find({ + collection: otherCollection, + where: { + medusaId: { equals: medusaId }, + }, + limit: 1, + }) + const productData = transformMedusaProductToPayload(medusaProduct) + // 如果在另一个 collection 中存在,需要删除并在正确的 collection 中创建 + if (existingInOther.docs[0]) { + await payload.delete({ + collection: otherCollection, + id: existingInOther.docs[0].id, + }) + + const created = await payload.create({ + collection: targetCollection, + data: productData, + }) + + return { + success: true, + action: 'moved', + message: `商品 ${medusaId} 已从 ${otherCollection} 移动到 ${targetCollection}`, + productId: created.id, + collection: targetCollection, + } + } + + const existingProduct = existingInTarget.docs[0] + + // 如果存在且不强制更新,跳过 + if (existingProduct && !forceUpdate) { + return { + success: true, + action: 'skipped', + message: `商品 ${medusaId} 已存在于 ${targetCollection}`, + productId: existingProduct.id, + collection: targetCollection, + } + } + if (existingProduct) { // 更新现有商品 const updated = await payload.update({ - collection: 'products', + collection: targetCollection, id: existingProduct.id, data: productData, }) @@ -100,21 +143,23 @@ async function syncSingleProductByMedusaId(payload: any, medusaId: string, force return { success: true, action: 'updated', - message: `商品 ${medusaId} 已更新`, + message: `商品 ${medusaId} 已更新于 ${targetCollection}`, productId: updated.id, + collection: targetCollection, } } else { // 创建新商品 const created = await payload.create({ - collection: 'products', + collection: targetCollection, data: productData, }) return { success: true, action: 'created', - message: `商品 ${medusaId} 已创建`, + message: `商品 ${medusaId} 已创建于 ${targetCollection}`, productId: created.id, + collection: targetCollection, } } } catch (error) { @@ -131,19 +176,45 @@ async function syncSingleProductByMedusaId(payload: any, medusaId: string, force /** * 通过 Payload ID 同步单个商品 */ -async function syncSingleProductByPayloadId(payload: any, payloadId: string, forceUpdate: boolean) { +async function syncSingleProductByPayloadId( + payload: any, + payloadId: string, + collection: string, + forceUpdate: boolean, +) { try { - // 获取 Payload 商品 - const product = await payload.findByID({ - collection: 'products', - id: payloadId, - }) + // 如果未指定 collection,尝试在两个 collections 中查找 + let product: any = null + let foundCollection: string = collection + + if (collection) { + product = await payload.findByID({ + collection, + id: payloadId, + }) + } else { + // 尝试 preorder-products + try { + product = await payload.findByID({ + collection: 'preorder-products', + id: payloadId, + }) + foundCollection = 'preorder-products' + } catch { + // 最后尝试旧的 products + product = await payload.findByID({ + collection: 'products', + id: payloadId, + }) + foundCollection = 'products' + } + } if (!product) { return { success: false, action: 'not_found', - message: `Payload 中未找到商品 ID: ${payloadId}`, + message: `未找到商品 ID: ${payloadId}`, } } @@ -200,16 +271,55 @@ async function syncAllProducts(payload: any, forceUpdate: boolean) { // 处理每个商品 for (const medusaProduct of medusaProducts) { try { - // 检查是否已存在 - const existing = await payload.find({ - collection: 'products', + // 确定应该同步到哪个 collection + const targetCollection = getProductCollection(medusaProduct) + const otherCollection = + targetCollection === 'preorder-products' ? 'products' : 'preorder-products' + + // 在目标 collection 中检查是否已存在 + const existingInTarget = await payload.find({ + collection: targetCollection, where: { medusaId: { equals: medusaProduct.id }, }, limit: 1, }) - const existingProduct = existing.docs[0] + // 在另一个 collection 中检查是否存在(产品类型可能改变) + const existingInOther = await payload.find({ + collection: otherCollection, + where: { + medusaId: { equals: medusaProduct.id }, + }, + limit: 1, + }) + + const productData = transformMedusaProductToPayload(medusaProduct) + + // 如果在错误的 collection 中,移动它 + if (existingInOther.docs[0]) { + await payload.delete({ + collection: otherCollection, + id: existingInOther.docs[0].id, + }) + + await payload.create({ + collection: targetCollection, + data: productData, + }) + + results.updated++ + results.details.push({ + medusaId: medusaProduct.id, + title: medusaProduct.title, + action: 'moved', + from: otherCollection, + to: targetCollection, + }) + continue + } + + const existingProduct = existingInTarget.docs[0] // 如果存在且不强制更新,跳过 if (existingProduct && !forceUpdate) { @@ -218,16 +328,15 @@ async function syncAllProducts(payload: any, forceUpdate: boolean) { medusaId: medusaProduct.id, title: medusaProduct.title, action: 'skipped', + collection: targetCollection, }) continue } - const productData = transformMedusaProductToPayload(medusaProduct) - if (existingProduct) { // 更新 await payload.update({ - collection: 'products', + collection: targetCollection, id: existingProduct.id, data: productData, }) @@ -236,11 +345,12 @@ async function syncAllProducts(payload: any, forceUpdate: boolean) { medusaId: medusaProduct.id, title: medusaProduct.title, action: 'updated', + collection: targetCollection, }) } else { // 创建 await payload.create({ - collection: 'products', + collection: targetCollection, data: productData, }) results.created++ @@ -248,6 +358,7 @@ async function syncAllProducts(payload: any, forceUpdate: boolean) { medusaId: medusaProduct.id, title: medusaProduct.title, action: 'created', + collection: targetCollection, }) } } catch (error) { @@ -295,7 +406,7 @@ export async function POST(request: Request) { // } const body = await request.json() - const { medusaId, payloadId, forceUpdate = true } = body + const { medusaId, payloadId, collection = '', forceUpdate = true } = body if (medusaId) { const result = await syncSingleProductByMedusaId(payload, medusaId, forceUpdate) @@ -303,7 +414,7 @@ export async function POST(request: Request) { } if (payloadId) { - const result = await syncSingleProductByPayloadId(payload, payloadId, forceUpdate) + const result = await syncSingleProductByPayloadId(payload, payloadId, collection, forceUpdate) return NextResponse.json(result) } diff --git a/src/collections/PreorderProducts.ts b/src/collections/PreorderProducts.ts new file mode 100644 index 0000000..98f0392 --- /dev/null +++ b/src/collections/PreorderProducts.ts @@ -0,0 +1,210 @@ +import type { CollectionConfig } from 'payload' +import { logAfterChange, logAfterDelete } from '../hooks/logAction' +import { cacheAfterChange, cacheAfterDelete } from '../hooks/cacheInvalidation' +import { + AlignFeature, + BlocksFeature, + BoldFeature, + ChecklistFeature, + HeadingFeature, + IndentFeature, + InlineCodeFeature, + ItalicFeature, + lexicalEditor, + LinkFeature, + OrderedListFeature, + ParagraphFeature, + RelationshipFeature, + UnorderedListFeature, + UploadFeature, + FixedToolbarFeature, + InlineToolbarFeature, + HorizontalRuleFeature, + BlockquoteFeature, +} from '@payloadcms/richtext-lexical' + +export const PreorderProducts: CollectionConfig = { + slug: 'preorder-products', + admin: { + useAsTitle: 'title', + defaultColumns: ['thumbnail', 'title', 'medusaId', 'status', 'updatedAt'], + description: '管理预售商品的详细内容和描述', + listSearchableFields: ['title', 'medusaId', 'handle'], + pagination: { + defaultLimit: 25, + }, + components: { + edit: { + PreviewButton: '/components/sync/ForceSyncButton#ForceSyncButton', + }, + beforeListTable: [ + '/components/sync/SyncMedusaButton#SyncMedusaButton', + '/components/list/ProductGridStyler', + ], + }, + }, + access: { + read: () => true, + }, + fields: [ + { + type: 'tabs', + tabs: [ + { + label: '基本信息', + fields: [ + { + type: 'row', + fields: [ + { + name: 'medusaId', + type: 'text', + required: true, + unique: true, + index: true, + admin: { + description: 'Medusa 商品 ID', + readOnly: true, + width: '60%', + }, + }, + { + name: 'status', + type: 'select', + required: true, + defaultValue: 'draft', + options: [ + { label: '草稿', value: 'draft' }, + { label: '已发布', value: 'published' }, + ], + admin: { + description: '商品详情状态', + width: '40%', + }, + }, + ], + }, + { + name: 'title', + type: 'text', + required: true, + admin: { + description: '商品标题(从 Medusa 同步)', + readOnly: true, + }, + }, + { + name: 'handle', + type: 'text', + admin: { + description: '商品 URL handle(从 Medusa 同步)', + readOnly: true, + }, + }, + { + name: 'thumbnail', + type: 'text', + admin: { + description: '商品缩略图 URL(从 Medusa 同步)', + readOnly: true, + }, + }, + { + name: 'lastSyncedAt', + type: 'date', + admin: { + description: '上次同步时间', + readOnly: true, + date: { + displayFormat: 'yyyy-MM-dd HH:mm:ss', + }, + }, + }, + ], + }, + { + label: '商品描述', + fields: [ + { + name: 'description', + type: 'richText', + editor: lexicalEditor({ + features: [ + ParagraphFeature(), + HeadingFeature({ enabledHeadingSizes: ['h2', 'h3', 'h4'] }), + BoldFeature(), + ItalicFeature(), + UnorderedListFeature(), + OrderedListFeature(), + LinkFeature(), + AlignFeature(), + BlockquoteFeature(), + HorizontalRuleFeature(), + InlineCodeFeature(), + IndentFeature(), + ChecklistFeature(), + FixedToolbarFeature(), + InlineToolbarFeature(), + BlocksFeature({ + blocks: [ + { + slug: 'image', + imageURL: '/api/media', + fields: [ + { + name: 'caption', + type: 'text', + label: '图片说明', + }, + ], + }, + ], + }), + UploadFeature({ + collections: { + media: { + fields: [ + { + name: 'caption', + type: 'text', + label: '图片说明', + }, + ], + }, + }, + }), + RelationshipFeature(), + ], + }), + admin: { + description: '预售商品的详细描述(支持富文本编辑)', + }, + }, + ], + }, + { + label: '相关商品', + fields: [ + { + name: 'relatedProducts', + type: 'relationship', + relationTo: ['preorder-products', 'products'], + hasMany: true, + admin: { + description: '推荐的相关商品', + components: { + Field: '/components/fields/RelatedProductsField#RelatedProductsField', + }, + }, + }, + ], + }, + ], + }, + ], + hooks: { + afterChange: [cacheAfterChange, logAfterChange], + afterDelete: [cacheAfterDelete, logAfterDelete], + }, + timestamps: true, +} diff --git a/src/collections/Products.ts b/src/collections/Products.ts index 6d105ef..6c7c62e 100644 --- a/src/collections/Products.ts +++ b/src/collections/Products.ts @@ -188,7 +188,7 @@ export const Products: CollectionConfig = { { name: 'relatedProducts', type: 'relationship', - relationTo: 'products', + relationTo: ['products', 'preorder-products'], hasMany: true, admin: { description: '相关商品,支持搜索联想', diff --git a/src/globals/ProductRecommendations.ts b/src/globals/ProductRecommendations.ts index 26dad69..0d13de3 100644 --- a/src/globals/ProductRecommendations.ts +++ b/src/globals/ProductRecommendations.ts @@ -96,7 +96,7 @@ export const ProductRecommendations: GlobalConfig = { en: 'Products', zh: '商品列表', }, - relationTo: 'products', + relationTo: ['products', 'preorder-products'], hasMany: true, admin: { description: { diff --git a/src/lib/medusa.ts b/src/lib/medusa.ts index 187bdc4..2b20862 100644 --- a/src/lib/medusa.ts +++ b/src/lib/medusa.ts @@ -14,7 +14,9 @@ interface MedusaProduct { status: string created_at: string updated_at: string - metadata?: Record + metadata?: Record & { + is_preorder?: boolean + } images?: Array<{ id: string url: string @@ -173,6 +175,21 @@ export async function uploadImageFromUrl(imageUrl: string, payload: any): Promis } } +/** + * 判断产品是否为预售商品 + * 检查 metadata.is_preorder + */ +export function isPreorderProduct(product: MedusaProduct): boolean { + return product.metadata?.is_preorder === true +} + +/** + * 获取产品应该同步到的 collection + */ +export function getProductCollection(product: MedusaProduct): 'preorder-products' | 'products' { + return isPreorderProduct(product) ? 'preorder-products' : 'products' +} + /** * 转换 Medusa 商品数据到 Payload 格式 * 直接保存 Medusa 的图片 URL,不上传到 Media 集合 diff --git a/src/migrations/20260212_202303.json b/src/migrations/20260212_202303.json new file mode 100644 index 0000000..6e71348 --- /dev/null +++ b/src/migrations/20260212_202303.json @@ -0,0 +1,4563 @@ +{ + "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 new file mode 100644 index 0000000..9986926 --- /dev/null +++ b/src/migrations/20260212_202303.ts @@ -0,0 +1,45 @@ +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/hero_slider_simplify.ts b/src/migrations/hero_slider_simplify.ts index a1687bc..60fe068 100644 --- a/src/migrations/hero_slider_simplify.ts +++ b/src/migrations/hero_slider_simplify.ts @@ -1,12 +1,10 @@ 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`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;` + sql`UPDATE hero_slider_slides SET link = cta_link WHERE cta_link IS NOT NULL AND cta_enabled = true;`, ) await db.execute( @@ -19,6 +17,6 @@ export async function up({ db }: MigrateUpArgs): Promise { DROP COLUMN IF EXISTS text_position, DROP COLUMN IF EXISTS text_color, DROP COLUMN IF EXISTS overlay, - DROP COLUMN IF EXISTS status;` + DROP COLUMN IF EXISTS status;`, ) } diff --git a/src/migrations/index.ts b/src/migrations/index.ts index 3069545..60e69e2 100644 --- a/src/migrations/index.ts +++ b/src/migrations/index.ts @@ -1,7 +1,8 @@ -import * as migration_20260208_171142 from './20260208_171142'; -import * as migration_20260212_193303 from './20260212_193303'; -import * as migration_hero_slider_simplify from './hero_slider_simplify'; -import * as migration_product_recommendations_simplify from './product_recommendations_simplify'; +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_hero_slider_simplify from './hero_slider_simplify' +import * as migration_product_recommendations_simplify from './product_recommendations_simplify' export const migrations = [ { @@ -12,14 +13,18 @@ export const migrations = [ { up: migration_20260212_193303.up, down: migration_20260212_193303.down, - name: '20260212_193303' + name: '20260212_193303', + }, + { + up: migration_20260212_202303.up, + name: '20260212_202303', }, { up: migration_hero_slider_simplify.up, - name: 'hero_slider_simplify' + name: 'hero_slider_simplify', }, { up: migration_product_recommendations_simplify.up, - name: 'product_recommendations_simplify' + name: 'product_recommendations_simplify', }, -]; +] diff --git a/src/migrations/product_recommendations_simplify.ts b/src/migrations/product_recommendations_simplify.ts index 94ff21b..9eead38 100644 --- a/src/migrations/product_recommendations_simplify.ts +++ b/src/migrations/product_recommendations_simplify.ts @@ -13,6 +13,6 @@ export async function up({ db }: MigrateUpArgs): Promise { DROP COLUMN IF EXISTS show_price, DROP COLUMN IF EXISTS show_rating, DROP COLUMN IF EXISTS show_quick_view, - DROP COLUMN IF EXISTS status;` + DROP COLUMN IF EXISTS status;`, ) } diff --git a/src/payload-types.ts b/src/payload-types.ts index 8df5ba7..4e4ab33 100644 --- a/src/payload-types.ts +++ b/src/payload-types.ts @@ -70,6 +70,7 @@ export interface Config { users: User; media: Media; products: Product; + 'preorder-products': PreorderProduct; announcements: Announcement; articles: Article; logs: Log; @@ -84,6 +85,7 @@ export interface Config { users: UsersSelect | UsersSelect; media: MediaSelect | MediaSelect; products: ProductsSelect | ProductsSelect; + 'preorder-products': PreorderProductsSelect | PreorderProductsSelect; announcements: AnnouncementsSelect | AnnouncementsSelect; articles: ArticlesSelect | ArticlesSelect; logs: LogsSelect | LogsSelect; @@ -235,7 +237,86 @@ export interface Product { /** * 相关商品,支持搜索联想 */ - relatedProducts?: (number | Product)[] | null; + relatedProducts?: + | ( + | { + relationTo: 'products'; + value: number | Product; + } + | { + relationTo: 'preorder-products'; + value: number | PreorderProduct; + } + )[] + | null; + updatedAt: string; + createdAt: string; +} +/** + * 管理预售商品的详细内容和描述 + * + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "preorder-products". + */ +export interface PreorderProduct { + id: number; + /** + * Medusa 商品 ID + */ + medusaId: string; + /** + * 商品详情状态 + */ + status: 'draft' | 'published'; + /** + * 商品标题(从 Medusa 同步) + */ + title: string; + /** + * 商品 URL handle(从 Medusa 同步) + */ + handle?: string | null; + /** + * 商品缩略图 URL(从 Medusa 同步) + */ + thumbnail?: string | null; + /** + * 上次同步时间 + */ + lastSyncedAt?: string | null; + /** + * 预售商品的详细描述(支持富文本编辑) + */ + description?: { + root: { + type: string; + children: { + type: any; + version: number; + [k: string]: unknown; + }[]; + direction: ('ltr' | 'rtl') | null; + format: 'left' | 'start' | 'center' | 'right' | 'end' | 'justify' | ''; + indent: number; + version: number; + }; + [k: string]: unknown; + } | null; + /** + * 推荐的相关商品 + */ + relatedProducts?: + | ( + | { + relationTo: 'preorder-products'; + value: number | PreorderProduct; + } + | { + relationTo: 'products'; + value: number | Product; + } + )[] + | null; updatedAt: string; createdAt: string; } @@ -573,6 +654,10 @@ export interface PayloadLockedDocument { relationTo: 'products'; value: number | Product; } | null) + | ({ + relationTo: 'preorder-products'; + value: number | PreorderProduct; + } | null) | ({ relationTo: 'announcements'; value: number | Announcement; @@ -684,6 +769,22 @@ export interface ProductsSelect { updatedAt?: T; createdAt?: T; } +/** + * This interface was referenced by `Config`'s JSON-Schema + * via the `definition` "preorder-products_select". + */ +export interface PreorderProductsSelect { + medusaId?: T; + status?: T; + title?: T; + handle?: T; + thumbnail?: T; + lastSyncedAt?: T; + description?: T; + relatedProducts?: T; + updatedAt?: T; + createdAt?: T; +} /** * This interface was referenced by `Config`'s JSON-Schema * via the `definition` "announcements_select". @@ -893,7 +994,18 @@ export interface ProductRecommendation { /** * Select and drag to reorder products */ - products?: (number | Product)[] | null; + products?: + | ( + | { + relationTo: 'products'; + value: number | Product; + } + | { + relationTo: 'preorder-products'; + value: number | PreorderProduct; + } + )[] + | null; id?: string | null; }[] | null; diff --git a/src/payload.config.ts b/src/payload.config.ts index d99058c..a6c95d5 100644 --- a/src/payload.config.ts +++ b/src/payload.config.ts @@ -8,6 +8,7 @@ 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 { Announcements } from './collections/Announcements' import { Articles } from './collections/Articles' import { Logs } from './collections/Logs' @@ -46,7 +47,15 @@ export default buildConfig({ }, fallbackLanguage: 'zh', }, - collections: [Users, Media, Products, Announcements, Articles, Logs], + collections: [ + Users, + Media, + Products, + PreorderProducts, + Announcements, + Articles, + Logs, + ], globals: [AdminSettings, LogsManager, HeroSlider, ProductRecommendations], editor: lexicalEditor(), secret: process.env.PAYLOAD_SECRET || '',