mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
feat(db): add data lifecycle columns (deleteAfter, legalHold, quotas, retention)
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
ALTER TABLE "jobs" ADD COLUMN "delete_after" timestamp with time zone;--> statement-breakpoint
|
||||
ALTER TABLE "teams" ADD COLUMN "legal_hold" boolean DEFAULT false NOT NULL;--> statement-breakpoint
|
||||
ALTER TABLE "teams" ADD COLUMN "storage_quota" bigint;--> statement-breakpoint
|
||||
ALTER TABLE "teams" ADD COLUMN "retention_hours" integer;--> statement-breakpoint
|
||||
ALTER TABLE "users" ADD COLUMN "legal_hold" boolean DEFAULT false NOT NULL;--> statement-breakpoint
|
||||
ALTER TABLE "users" ADD COLUMN "storage_used" bigint DEFAULT 0 NOT NULL;--> statement-breakpoint
|
||||
ALTER TABLE "users" ADD COLUMN "storage_quota" bigint;
|
||||
File diff suppressed because it is too large
Load Diff
@@ -22,6 +22,13 @@
|
||||
"when": 1781338621449,
|
||||
"tag": "0002_fair_sprite",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 3,
|
||||
"version": "7",
|
||||
"when": 1781354362106,
|
||||
"tag": "0003_flimsy_dust",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -29,6 +29,9 @@ export const users = pgTable("users", {
|
||||
authProvider: text("auth_provider").notNull().default("local"),
|
||||
externalId: text("external_id"),
|
||||
email: text("email"),
|
||||
legalHold: boolean("legal_hold").notNull().default(false),
|
||||
storageUsed: bigint("storage_used", { mode: "number" }).notNull().default(0),
|
||||
storageQuota: bigint("storage_quota", { mode: "number" }),
|
||||
createdAt: timestamp("created_at", { withTimezone: true })
|
||||
.notNull()
|
||||
.$defaultFn(() => new Date()),
|
||||
@@ -43,6 +46,9 @@ export const users = pgTable("users", {
|
||||
export const teams = pgTable("teams", {
|
||||
id: text("id").primaryKey(),
|
||||
name: text("name").notNull().unique(),
|
||||
legalHold: boolean("legal_hold").notNull().default(false),
|
||||
storageQuota: bigint("storage_quota", { mode: "number" }),
|
||||
retentionHours: integer("retention_hours"),
|
||||
createdAt: timestamp("created_at", { withTimezone: true })
|
||||
.notNull()
|
||||
.$defaultFn(() => new Date()),
|
||||
@@ -91,6 +97,7 @@ export const jobs = pgTable(
|
||||
.$defaultFn(() => new Date()),
|
||||
startedAt: timestamp("started_at", { withTimezone: true }),
|
||||
completedAt: timestamp("completed_at", { withTimezone: true }),
|
||||
deleteAfter: timestamp("delete_after", { withTimezone: true }),
|
||||
},
|
||||
(table) => [
|
||||
index("jobs_created_at_idx").on(table.createdAt),
|
||||
|
||||
Reference in New Issue
Block a user