db migration

This commit is contained in:
Jun-te Kim 2026-04-16 17:41:55 +00:00
parent 224a8ad696
commit e0449d01a2
4 changed files with 6451 additions and 0 deletions

View file

@ -0,0 +1,2 @@
ALTER TABLE "bulk_address_uploads" ADD COLUMN "source_headers" text[] DEFAULT '{}' NOT NULL;--> statement-breakpoint
ALTER TABLE "bulk_address_uploads" ADD COLUMN "column_mapping" jsonb;

File diff suppressed because it is too large Load diff

View file

@ -1198,6 +1198,13 @@
"when": 1776357524564,
"tag": "0170_furry_moonstone",
"breakpoints": true
},
{
"idx": 171,
"version": "7",
"when": 1776361262258,
"tag": "0171_chunky_wallow",
"breakpoints": true
}
]
}

View file

@ -0,0 +1,19 @@
import { pgTable, uuid, text, timestamp, jsonb } from "drizzle-orm/pg-core";
import { sql } from "drizzle-orm";
export const bulkAddressUploads = pgTable("bulk_address_uploads", {
id: uuid("id").defaultRandom().primaryKey(),
portfolioId: text("portfolio_id").notNull(),
userId: text("user_id").notNull(),
s3Bucket: text("s3_bucket").notNull(),
s3Key: text("s3_key").notNull(),
filename: text("filename").notNull(),
status: text("status").notNull().default("ready_for_processing"),
sourceHeaders: text("source_headers").array().notNull().default(sql`'{}'`),
columnMapping: jsonb("column_mapping").$type<Record<string, string>>(),
createdAt: timestamp("created_at", { withTimezone: true }).notNull().defaultNow(),
updatedAt: timestamp("updated_at", { withTimezone: true })
.notNull()
.defaultNow()
.$onUpdate(() => new Date()),
});