feat(documents): add Epson scanner inbox and document shelf
This commit is contained in:
20
backend/db/migrations/0073_scanner_document_inbox.sql
Normal file
20
backend/db/migrations/0073_scanner_document_inbox.sql
Normal file
@@ -0,0 +1,20 @@
|
||||
CREATE TABLE "scanner_inbox_connections" (
|
||||
"tenant_id" bigint PRIMARY KEY REFERENCES "tenants"("id") ON DELETE CASCADE,
|
||||
"username" text NOT NULL UNIQUE,
|
||||
"password_hash" text NOT NULL,
|
||||
"active" boolean NOT NULL DEFAULT true,
|
||||
"created_at" timestamp with time zone NOT NULL DEFAULT now(),
|
||||
"updated_at" timestamp with time zone
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE "scanner_inbox_documents" (
|
||||
"file_id" uuid PRIMARY KEY REFERENCES "files"("id") ON DELETE CASCADE,
|
||||
"tenant_id" bigint NOT NULL REFERENCES "tenants"("id") ON DELETE CASCADE,
|
||||
"remote_filename" text NOT NULL,
|
||||
"checksum" text NOT NULL,
|
||||
"received_at" timestamp with time zone NOT NULL DEFAULT now()
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE UNIQUE INDEX "scanner_inbox_documents_filename_key" ON "scanner_inbox_documents" ("tenant_id", "remote_filename");
|
||||
--> statement-breakpoint
|
||||
CREATE INDEX "scanner_inbox_documents_received_idx" ON "scanner_inbox_documents" ("tenant_id", "received_at");
|
||||
Reference in New Issue
Block a user