You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

31 lines
1.1 KiB

import { index, integer, sqliteTable, text } from "drizzle-orm/sqlite-core";
import { users } from "./auth";
export const userExportTasks = sqliteTable(
"user_export_tasks",
{
id: integer().primaryKey(),
userId: integer("user_id")
.notNull()
.references(() => users.id, { onDelete: "cascade" }),
status: text().notNull().default("queued"),
maskPolicy: text("mask_policy").notNull().default("masked"),
exportCutoffAt: integer("export_cutoff_at", { mode: "timestamp_ms" }),
outputDir: text("output_dir"),
outputName: text("output_name"),
totalBytes: integer("total_bytes"),
errorCode: text("error_code"),
errorMessage: text("error_message"),
expiresAt: integer("expires_at", { mode: "timestamp_ms" }),
createdAt: integer("created_at", { mode: "timestamp_ms" }).defaultNow().notNull(),
updatedAt: integer("updated_at", { mode: "timestamp_ms" })
.defaultNow()
.$onUpdate(() => new Date())
.notNull(),
},
(table) => [
index("user_export_tasks_user_id_idx").on(table.userId),
index("user_export_tasks_status_idx").on(table.status),
],
);