24 lines
925 B
SQL
24 lines
925 B
SQL
CREATE TABLE IF NOT EXISTS "StorageMigrationTask" (
|
|
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
|
"sourceUrl" text NOT NULL UNIQUE,
|
|
"sourcePath" text NOT NULL,
|
|
"sourceStorageConfigId" uuid REFERENCES "StorageConfig"("id"),
|
|
"targetStorageConfigId" uuid REFERENCES "StorageConfig"("id"),
|
|
"targetUrl" text,
|
|
"status" varchar(32) NOT NULL DEFAULT 'pending',
|
|
"attemptCount" integer NOT NULL DEFAULT 0,
|
|
"lastError" text,
|
|
"migrateAfterAt" timestamp NOT NULL,
|
|
"cleanupAfterAt" timestamp NOT NULL,
|
|
"migratedAt" timestamp,
|
|
"cleanedAt" timestamp,
|
|
"createdAt" timestamp NOT NULL DEFAULT now(),
|
|
"updatedAt" timestamp NOT NULL DEFAULT now()
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS "StorageMigrationTask_status_migrate_idx"
|
|
ON "StorageMigrationTask"("status", "migrateAfterAt");
|
|
|
|
CREATE INDEX IF NOT EXISTS "StorageMigrationTask_status_cleanup_idx"
|
|
ON "StorageMigrationTask"("status", "cleanupAfterAt");
|