mirror of
https://github.com/jjbrunton/Sauci.git
synced 2026-10-31 18:19:43 +00:00
feat(api): harden production data import
Preserve live Dokploy state while importing legacy Supabase data. Add schema parity, safe relationship reconciliation, storage quarantine, and production-shaped integration coverage.
This commit is contained in:
1 parent
78900a24fb
commit
aedba2a480
8 files changed
+795
-85
No files matched your search
@@ -10,6 +10,10 @@ export const categories = pgTable('categories', {
|
||||
color: text('color'),
|
||||
sortOrder: integer('sort_order').notNull().default(0),
|
||||
isPublic: boolean('is_public').notNull().default(true),
|
||||
contentStatus: text('content_status').notNull().default('unreviewed'),
|
||||
contentReviewReason: text('content_review_reason'),
|
||||
contentReviewedAt: timestamp('content_reviewed_at', { withTimezone: true }),
|
||||
contentReviewedBy: uuid('content_reviewed_by').references(() => profiles.id, { onDelete: 'set null' }),
|
||||
createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
|
||||
});
|
||||
|
||||
@@ -26,6 +30,10 @@ export const questionPacks = pgTable('question_packs', {
|
||||
avgIntensity: numeric('avg_intensity', { precision: 3, scale: 2, mode: 'number' }),
|
||||
sortOrder: integer('sort_order').notNull().default(0),
|
||||
categoryId: uuid('category_id').references(() => categories.id, { onDelete: 'set null' }),
|
||||
contentStatus: text('content_status').notNull().default('unreviewed'),
|
||||
contentReviewReason: text('content_review_reason'),
|
||||
contentReviewedAt: timestamp('content_reviewed_at', { withTimezone: true }),
|
||||
contentReviewedBy: uuid('content_reviewed_by').references(() => profiles.id, { onDelete: 'set null' }),
|
||||
createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
|
||||
}, (table) => [index('question_packs_category_id_idx').on(table.categoryId)]);
|
||||
|
||||
@@ -42,6 +50,10 @@ export const questions = pgTable('questions', {
|
||||
config: jsonb('config').notNull().default({}),
|
||||
deletedAt: timestamp('deleted_at', { withTimezone: true }),
|
||||
inverseOf: uuid('inverse_of'),
|
||||
contentStatus: text('content_status').notNull().default('unreviewed'),
|
||||
contentReviewReason: text('content_review_reason'),
|
||||
contentReviewedAt: timestamp('content_reviewed_at', { withTimezone: true }),
|
||||
contentReviewedBy: uuid('content_reviewed_by').references(() => profiles.id, { onDelete: 'set null' }),
|
||||
createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
|
||||
}, (table) => [index('questions_pack_id_idx').on(table.packId)]);
|
||||
|
||||
@@ -64,3 +76,17 @@ export const couplePacks = pgTable('couple_packs', {
|
||||
enabled: boolean('enabled').notNull().default(true),
|
||||
createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
|
||||
}, (table) => [primaryKey({ columns: [table.coupleId, table.packId] })]);
|
||||
|
||||
export const contentReviews = pgTable('content_reviews', {
|
||||
id: uuid('id').primaryKey().defaultRandom(),
|
||||
entityType: text('entity_type').notNull(),
|
||||
entityId: uuid('entity_id').notNull(),
|
||||
previousStatus: text('previous_status').notNull(),
|
||||
newStatus: text('new_status').notNull(),
|
||||
reason: text('reason').notNull(),
|
||||
changedBy: uuid('changed_by').references(() => profiles.id, { onDelete: 'set null' }),
|
||||
createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
|
||||
}, (table) => [
|
||||
index('content_reviews_entity_idx').on(table.entityType, table.entityId, table.createdAt),
|
||||
index('content_reviews_created_at_idx').on(table.createdAt),
|
||||
]);
|
||||
Reference in new issue
Block a user