Skip to content

armgit / papra

Public Imported from GitHub
0

The minimalistic document archiving platform.

refactor(server): merged migrations (#169)

Corentin Thomassetfeb83782276b
diff --git a/apps/papra-server/migrations/0000_initial_schema_setup.sql b/apps/papra-server/migrations/0000_initial_schema_setup.sql
index e7110468..0d0d6344 100644
--- a/apps/papra-server/migrations/0000_initial_schema_setup.sql
+++ b/apps/papra-server/migrations/0000_initial_schema_setup.sql
@@ -10,6 +10,7 @@ CREATE TABLE `documents` (
`original_name` text NOT NULL,
`original_size` integer DEFAULT 0 NOT NULL,
`original_storage_key` text NOT NULL,
+ `original_sha256_hash` text NOT NULL,
`name` text NOT NULL,
`mime_type` text NOT NULL,
`content` text DEFAULT '' NOT NULL,
@@ -19,22 +20,42 @@ CREATE TABLE `documents` (
);
--> statement-breakpoint
CREATE INDEX `documents_organization_id_is_deleted_created_at_index` ON `documents` (`organization_id`,`is_deleted`,`created_at`);--> statement-breakpoint
-CREATE TABLE `organization_users` (
+CREATE INDEX `documents_organization_id_is_deleted_index` ON `documents` (`organization_id`,`is_deleted`);--> statement-breakpoint
+CREATE UNIQUE INDEX `documents_organization_id_original_sha256_hash_unique` ON `documents` (`organization_id`,`original_sha256_hash`);--> statement-breakpoint
+CREATE INDEX `documents_original_sha256_hash_index` ON `documents` (`original_sha256_hash`);--> statement-breakpoint
+CREATE INDEX `documents_organization_id_size_index` ON `documents` (`organization_id`,`original_size`);--> statement-breakpoint
+CREATE TABLE `organization_invitations` (
`id` text PRIMARY KEY NOT NULL,
`created_at` integer NOT NULL,
`updated_at` integer NOT NULL,
- `user_id` text NOT NULL,
`organization_id` text NOT NULL,
- `role` text DEFAULT 'member' NOT NULL,
- FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE cascade ON DELETE cascade,
- FOREIGN KEY (`organization_id`) REFERENCES `organizations`(`id`) ON UPDATE cascade ON DELETE cascade
+ `email` text NOT NULL,
+ `role` text,
+ `status` text NOT NULL,
+ `expires_at` integer NOT NULL,
+ `inviter_id` text NOT NULL,
+ FOREIGN KEY (`organization_id`) REFERENCES `organizations`(`id`) ON UPDATE cascade ON DELETE cascade,
+ FOREIGN KEY (`inviter_id`) REFERENCES `users`(`id`) ON UPDATE cascade ON DELETE cascade
+);
+--> statement-breakpoint
+CREATE TABLE `organization_members` (
+ `id` text PRIMARY KEY NOT NULL,
+ `created_at` integer NOT NULL,
+ `updated_at` integer NOT NULL,
+ `organization_id` text NOT NULL,
+ `user_id` text NOT NULL,
+ `role` text NOT NULL,
+ FOREIGN KEY (`organization_id`) REFERENCES `organizations`(`id`) ON UPDATE cascade ON DELETE cascade,
+ FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE cascade ON DELETE cascade
);
--> statement-breakpoint
+CREATE UNIQUE INDEX `organization_members_user_organization_unique` ON `organization_members` (`organization_id`,`user_id`);--> statement-breakpoint
CREATE TABLE `organizations` (
`id` text PRIMARY KEY NOT NULL,
`created_at` integer NOT NULL,
`updated_at` integer NOT NULL,
- `name` text NOT NULL
+ `name` text NOT NULL,
+ `customer_id` text
);
--> statement-breakpoint
CREATE TABLE `user_roles` (
@@ -48,6 +69,26 @@ CREATE TABLE `user_roles` (
--> statement-breakpoint
CREATE INDEX `user_roles_role_index` ON `user_roles` (`role`);--> statement-breakpoint
CREATE UNIQUE INDEX `user_roles_user_id_role_unique_index` ON `user_roles` (`user_id`,`role`);--> statement-breakpoint
+CREATE TABLE `documents_tags` (
+ `document_id` text NOT NULL,
+ `tag_id` text NOT NULL,
+ PRIMARY KEY(`document_id`, `tag_id`),
+ FOREIGN KEY (`document_id`) REFERENCES `documents`(`id`) ON UPDATE cascade ON DELETE cascade,
+ FOREIGN KEY (`tag_id`) REFERENCES `tags`(`id`) ON UPDATE cascade ON DELETE cascade
+);
+--> statement-breakpoint
+CREATE TABLE `tags` (
+ `id` text PRIMARY KEY NOT NULL,
+ `created_at` integer NOT NULL,
+ `updated_at` integer NOT NULL,
+ `organization_id` text NOT NULL,
+ `name` text NOT NULL,
+ `color` text NOT NULL,
+ `description` text,
+ FOREIGN KEY (`organization_id`) REFERENCES `organizations`(`id`) ON UPDATE cascade ON DELETE cascade
+);
+--> statement-breakpoint
+CREATE UNIQUE INDEX `tags_organization_id_name_unique` ON `tags` (`organization_id`,`name`);--> statement-breakpoint
CREATE TABLE `users` (
`id` text PRIMARY KEY NOT NULL,
`created_at` integer NOT NULL,
@@ -55,7 +96,8 @@ CREATE TABLE `users` (
`email` text NOT NULL,
`email_verified` integer DEFAULT false NOT NULL,
`name` text,
- `image` text
+ `image` text,
+ `max_organization_count` integer
);
--> statement-breakpoint
CREATE UNIQUE INDEX `users_email_unique` ON `users` (`email`);--> statement-breakpoint
@@ -86,9 +128,12 @@ CREATE TABLE `auth_sessions` (
`expires_at` integer NOT NULL,
`ip_address` text,
`user_agent` text,
- FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE cascade ON DELETE cascade
+ `active_organization_id` text,
+ FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE cascade ON DELETE cascade,
+ FOREIGN KEY (`active_organization_id`) REFERENCES `organizations`(`id`) ON UPDATE cascade ON DELETE set null
);
--> statement-breakpoint
+CREATE INDEX `auth_sessions_token_index` ON `auth_sessions` (`token`);--> statement-breakpoint
CREATE TABLE `auth_verifications` (
`id` text PRIMARY KEY NOT NULL,
`created_at` integer NOT NULL,
@@ -97,3 +142,31 @@ CREATE TABLE `auth_verifications` (
`value` text NOT NULL,
`expires_at` integer NOT NULL
);
+--> statement-breakpoint
+CREATE INDEX `auth_verifications_identifier_index` ON `auth_verifications` (`identifier`);--> statement-breakpoint
+CREATE TABLE `intake_emails` (
+ `id` text PRIMARY KEY NOT NULL,
+ `created_at` integer NOT NULL,
+ `updated_at` integer NOT NULL,
+ `email_address` text NOT NULL,
+ `organization_id` text NOT NULL,
+ `allowed_origins` text DEFAULT '[]' NOT NULL,
+ `is_enabled` integer DEFAULT true NOT NULL,
+ FOREIGN KEY (`organization_id`) REFERENCES `organizations`(`id`) ON UPDATE cascade ON DELETE cascade
+);
+--> statement-breakpoint
+CREATE UNIQUE INDEX `intake_emails_email_address_unique` ON `intake_emails` (`email_address`);--> statement-breakpoint
+CREATE TABLE `organization_subscriptions` (
+ `id` text PRIMARY KEY NOT NULL,
+ `customer_id` text NOT NULL,
+ `organization_id` text NOT NULL,
+ `plan_id` text NOT NULL,
+ `status` text NOT NULL,
+ `seats_count` integer NOT NULL,
+ `current_period_end` integer NOT NULL,
+ `current_period_start` integer NOT NULL,
+ `cancel_at_period_end` integer DEFAULT false NOT NULL,
+ `created_at` integer NOT NULL,
+ `updated_at` integer NOT NULL,
+ FOREIGN KEY (`organization_id`) REFERENCES `organizations`(`id`) ON UPDATE cascade ON DELETE cascade
+);
diff --git a/apps/papra-server/migrations/0002_tags.sql b/apps/papra-server/migrations/0002_tags.sql
deleted file mode 100644
index 0dbf1a47..00000000
--- a/apps/papra-server/migrations/0002_tags.sql
+++ /dev/null
@@ -1,20 +0,0 @@
-CREATE TABLE `documents_tags` (
- `document_id` text NOT NULL,
- `tag_id` text NOT NULL,
- PRIMARY KEY(`document_id`, `tag_id`),
- FOREIGN KEY (`document_id`) REFERENCES `documents`(`id`) ON UPDATE cascade ON DELETE cascade,
- FOREIGN KEY (`tag_id`) REFERENCES `tags`(`id`) ON UPDATE cascade ON DELETE cascade
-);
---> statement-breakpoint
-CREATE TABLE `tags` (
- `id` text PRIMARY KEY NOT NULL,
- `created_at` integer NOT NULL,
- `updated_at` integer NOT NULL,
- `organization_id` text NOT NULL,
- `name` text NOT NULL,
- `color` text NOT NULL,
- `description` text,
- FOREIGN KEY (`organization_id`) REFERENCES `organizations`(`id`) ON UPDATE cascade ON DELETE cascade
-);
---> statement-breakpoint
-CREATE UNIQUE INDEX `tags_organization_id_name_unique` ON `tags` (`organization_id`,`name`);
\ No newline at end of file
diff --git a/apps/papra-server/migrations/0003_intake-emails.sql b/apps/papra-server/migrations/0003_intake-emails.sql
deleted file mode 100644
index a5d59cbe..00000000
--- a/apps/papra-server/migrations/0003_intake-emails.sql
+++ /dev/null
@@ -1,9 +0,0 @@
-CREATE TABLE `intake_emails` (
- `id` text PRIMARY KEY NOT NULL,
- `created_at` integer NOT NULL,
- `updated_at` integer NOT NULL,
- `organization_id` text NOT NULL,
- `allowed_origins` text DEFAULT '[]' NOT NULL,
- `is_enabled` integer DEFAULT true NOT NULL,
- FOREIGN KEY (`organization_id`) REFERENCES `organizations`(`id`) ON UPDATE cascade ON DELETE cascade
-);
diff --git a/apps/papra-server/migrations/0004_auth-indexs.sql b/apps/papra-server/migrations/0004_auth-indexs.sql
deleted file mode 100644
index 71ce2eee..00000000
--- a/apps/papra-server/migrations/0004_auth-indexs.sql
+++ /dev/null
@@ -1,2 +0,0 @@
-CREATE INDEX `auth_sessions_token_index` ON `auth_sessions` (`token`);--> statement-breakpoint
-CREATE INDEX `auth_verifications_identifier_index` ON `auth_verifications` (`identifier`);
\ No newline at end of file
diff --git a/apps/papra-server/migrations/0005_intake-emails-addresses.sql b/apps/papra-server/migrations/0005_intake-emails-addresses.sql
deleted file mode 100644
index f6be2d04..00000000
--- a/apps/papra-server/migrations/0005_intake-emails-addresses.sql
+++ /dev/null
@@ -1,3 +0,0 @@
-ALTER TABLE `intake_emails` ADD `email_address` text NOT NULL;--> statement-breakpoint
-CREATE UNIQUE INDEX `intake_emails_email_address_unique` ON `intake_emails` (`email_address`);--> statement-breakpoint
-CREATE INDEX `documents_organization_id_is_deleted_index` ON `documents` (`organization_id`,`is_deleted`);
\ No newline at end of file
diff --git a/apps/papra-server/migrations/0006_documents-hash.sql b/apps/papra-server/migrations/0006_documents-hash.sql
deleted file mode 100644
index 085f4deb..00000000
--- a/apps/papra-server/migrations/0006_documents-hash.sql
+++ /dev/null
@@ -1,2 +0,0 @@
-ALTER TABLE `documents` ADD `original_sha256_hash` text NOT NULL;--> statement-breakpoint
-CREATE UNIQUE INDEX `documents_organization_id_original_sha256_hash_unique` ON `documents` (`organization_id`,`original_sha256_hash`);
\ No newline at end of file
diff --git a/apps/papra-server/migrations/0007_better-auth-orgs.sql b/apps/papra-server/migrations/0007_better-auth-orgs.sql
deleted file mode 100644
index 0eb71935..00000000
--- a/apps/papra-server/migrations/0007_better-auth-orgs.sql
+++ /dev/null
@@ -1,37 +0,0 @@
-ALTER TABLE `organization_users` RENAME TO `organization_members`;--> statement-breakpoint
-CREATE TABLE `organization_invitations` (
- `id` text PRIMARY KEY NOT NULL,
- `created_at` integer NOT NULL,
- `updated_at` integer NOT NULL,
- `organization_id` text NOT NULL,
- `email` text NOT NULL,
- `role` text,
- `status` text NOT NULL,
- `expires_at` integer NOT NULL,
- `inviter_id` text NOT NULL,
- FOREIGN KEY (`organization_id`) REFERENCES `organizations`(`id`) ON UPDATE cascade ON DELETE cascade,
- FOREIGN KEY (`inviter_id`) REFERENCES `users`(`id`) ON UPDATE cascade ON DELETE cascade
-);
---> statement-breakpoint
-PRAGMA foreign_keys=OFF;--> statement-breakpoint
-CREATE TABLE `__new_organization_members` (
- `id` text PRIMARY KEY NOT NULL,
- `created_at` integer NOT NULL,
- `updated_at` integer NOT NULL,
- `organization_id` text NOT NULL,
- `user_id` text NOT NULL,
- `role` text NOT NULL,
- FOREIGN KEY (`organization_id`) REFERENCES `organizations`(`id`) ON UPDATE cascade ON DELETE cascade,
- FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE cascade ON DELETE cascade
-);
---> statement-breakpoint
-INSERT INTO `__new_organization_members`("id", "created_at", "updated_at", "organization_id", "user_id", "role") SELECT "id", "created_at", "updated_at", "organization_id", "user_id", "role" FROM `organization_members`;--> statement-breakpoint
-DROP TABLE `organization_members`;--> statement-breakpoint
-ALTER TABLE `__new_organization_members` RENAME TO `organization_members`;--> statement-breakpoint
-PRAGMA foreign_keys=ON;--> statement-breakpoint
-ALTER TABLE `organizations` ADD `slug` text;--> statement-breakpoint
-ALTER TABLE `organizations` ADD `logo` text;--> statement-breakpoint
-ALTER TABLE `organizations` ADD `metadata` text;--> statement-breakpoint
-CREATE UNIQUE INDEX `organizations_slug_unique` ON `organizations` (`slug`);--> statement-breakpoint
-ALTER TABLE `auth_sessions` ADD `active_organization_id` text REFERENCES organizations(id);--> statement-breakpoint
-CREATE INDEX `documents_original_sha256_hash_index` ON `documents` (`original_sha256_hash`);
\ No newline at end of file
diff --git a/apps/papra-server/migrations/0008_max-user-organization-count.sql b/apps/papra-server/migrations/0008_max-user-organization-count.sql
deleted file mode 100644
index cba507de..00000000
--- a/apps/papra-server/migrations/0008_max-user-organization-count.sql
+++ /dev/null
@@ -1,23 +0,0 @@
-CREATE TABLE `organization_subscriptions` (
- `id` text PRIMARY KEY NOT NULL,
- `created_at` integer NOT NULL,
- `updated_at` integer NOT NULL,
- `organization_id` text NOT NULL,
- `plan_id` text NOT NULL,
- `stripe_subscription_id` text NOT NULL,
- `stripe_customer_id` text NOT NULL,
- `status` text NOT NULL,
- `current_period_end` integer NOT NULL,
- `current_period_start` integer NOT NULL,
- `cancel_at_period_end` integer DEFAULT false NOT NULL,
- FOREIGN KEY (`organization_id`) REFERENCES `organizations`(`id`) ON UPDATE cascade ON DELETE cascade
-);
---> statement-breakpoint
-DROP INDEX `organizations_slug_unique`;--> statement-breakpoint
-ALTER TABLE `organizations` DROP COLUMN `slug`;--> statement-breakpoint
-ALTER TABLE `organizations` DROP COLUMN `logo`;--> statement-breakpoint
-ALTER TABLE `organizations` DROP COLUMN `metadata`;--> statement-breakpoint
-ALTER TABLE `users` ADD `customer_id` text;--> statement-breakpoint
-ALTER TABLE `users` ADD `max_organization_count` integer;--> statement-breakpoint
-CREATE UNIQUE INDEX `users_customer_id_unique` ON `users` (`customer_id`);--> statement-breakpoint
-CREATE UNIQUE INDEX `organization_members_user_organization_unique` ON `organization_members` (`organization_id`,`user_id`);
\ No newline at end of file
diff --git a/apps/papra-server/migrations/0009_subscriptions.sql b/apps/papra-server/migrations/0009_subscriptions.sql
deleted file mode 100644
index cf5b9347..00000000
--- a/apps/papra-server/migrations/0009_subscriptions.sql
+++ /dev/null
@@ -1,2 +0,0 @@
-ALTER TABLE `organization_subscriptions` ADD `seats_count` integer NOT NULL;--> statement-breakpoint
-CREATE INDEX `documents_organization_id_size_index` ON `documents` (`organization_id`,`original_size`);
\ No newline at end of file
diff --git a/apps/papra-server/migrations/0010_subscriptions-2.sql b/apps/papra-server/migrations/0010_subscriptions-2.sql
deleted file mode 100644
index 37b894ae..00000000
--- a/apps/papra-server/migrations/0010_subscriptions-2.sql
+++ /dev/null
@@ -1,4 +0,0 @@
-ALTER TABLE `organization_subscriptions` RENAME COLUMN "stripe_customer_id" TO "customer_id";--> statement-breakpoint
-ALTER TABLE `organization_subscriptions` DROP COLUMN `stripe_subscription_id`;--> statement-breakpoint
-DROP INDEX `users_customer_id_unique`;--> statement-breakpoint
-ALTER TABLE `users` DROP COLUMN `customer_id`;
\ No newline at end of file
diff --git a/apps/papra-server/migrations/0011_orgs-customer-id.sql b/apps/papra-server/migrations/0011_orgs-customer-id.sql
deleted file mode 100644
index c2cab5f9..00000000
--- a/apps/papra-server/migrations/0011_orgs-customer-id.sql
+++ /dev/null
@@ -1 +0,0 @@
-ALTER TABLE `organizations` ADD `customer_id` text;
\ No newline at end of file
diff --git a/apps/papra-server/migrations/meta/0000_snapshot.json b/apps/papra-server/migrations/meta/0000_snapshot.json
index e4ba1152..6161cc85 100644
--- a/apps/papra-server/migrations/meta/0000_snapshot.json
+++ b/apps/papra-server/migrations/meta/0000_snapshot.json
@@ -1,7 +1,7 @@
{
"version": "6",
"dialect": "sqlite",
- "id": "5e528f3f-6da7-4bda-bc61-b157c495681a",
+ "id": "cdc4a655-0dd1-42e5-8e2d-516570b59da6",
"prevId": "00000000-0000-0000-0000-000000000000",
"tables": {
"documents": {
@@ -86,6 +86,13 @@
"notNull": true,
"autoincrement": false
},
+ "original_sha256_hash": {
+ "name": "original_sha256_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
"name": {
"name": "name",
"type": "text",
@@ -118,6 +125,37 @@
"created_at"
],
"isUnique": false
+ },
+ "documents_organization_id_is_deleted_index": {
+ "name": "documents_organization_id_is_deleted_index",
+ "columns": [
+ "organization_id",
+ "is_deleted"
+ ],
+ "isUnique": false
+ },
+ "documents_organization_id_original_sha256_hash_unique": {
+ "name": "documents_organization_id_original_sha256_hash_unique",
+ "columns": [
+ "organization_id",
+ "original_sha256_hash"
+ ],
+ "isUnique": true
+ },
+ "documents_original_sha256_hash_index": {
+ "name": "documents_original_sha256_hash_index",
+ "columns": [
+ "original_sha256_hash"
+ ],
+ "isUnique": false
+ },
+ "documents_organization_id_size_index": {
+ "name": "documents_organization_id_size_index",
+ "columns": [
+ "organization_id",
+ "original_size"
+ ],
+ "isUnique": false
}
},
"foreignKeys": {
@@ -165,8 +203,8 @@
"uniqueConstraints": {},
"checkConstraints": {}
},
- "organization_users": {
- "name": "organization_users",
+ "organization_invitations": {
+ "name": "organization_invitations",
"columns": {
"id": {
"name": "id",
@@ -189,15 +227,15 @@
"notNull": true,
"autoincrement": false
},
- "user_id": {
- "name": "user_id",
+ "organization_id": {
+ "name": "organization_id",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
- "organization_id": {
- "name": "organization_id",
+ "email": {
+ "name": "email",
"type": "text",
"primaryKey": false,
"notNull": true,
@@ -207,29 +245,124 @@
"name": "role",
"type": "text",
"primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
"notNull": true,
- "autoincrement": false,
- "default": "'member'"
+ "autoincrement": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "inviter_id": {
+ "name": "inviter_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
}
},
"indexes": {},
"foreignKeys": {
- "organization_users_user_id_users_id_fk": {
- "name": "organization_users_user_id_users_id_fk",
- "tableFrom": "organization_users",
+ "organization_invitations_organization_id_organizations_id_fk": {
+ "name": "organization_invitations_organization_id_organizations_id_fk",
+ "tableFrom": "organization_invitations",
+ "tableTo": "organizations",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "organization_invitations_inviter_id_users_id_fk": {
+ "name": "organization_invitations_inviter_id_users_id_fk",
+ "tableFrom": "organization_invitations",
"tableTo": "users",
"columnsFrom": [
- "user_id"
+ "inviter_id"
],
"columnsTo": [
"id"
],
"onDelete": "cascade",
"onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "organization_members": {
+ "name": "organization_members",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
},
- "organization_users_organization_id_organizations_id_fk": {
- "name": "organization_users_organization_id_organizations_id_fk",
- "tableFrom": "organization_users",
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "organization_members_user_organization_unique": {
+ "name": "organization_members_user_organization_unique",
+ "columns": [
+ "organization_id",
+ "user_id"
+ ],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {
+ "organization_members_organization_id_organizations_id_fk": {
+ "name": "organization_members_organization_id_organizations_id_fk",
+ "tableFrom": "organization_members",
"tableTo": "organizations",
"columnsFrom": [
"organization_id"
@@ -239,6 +372,19 @@
],
"onDelete": "cascade",
"onUpdate": "cascade"
+ },
+ "organization_members_user_id_users_id_fk": {
+ "name": "organization_members_user_id_users_id_fk",
+ "tableFrom": "organization_members",
+ "tableTo": "users",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
}
},
"compositePrimaryKeys": {},
@@ -275,6 +421,13 @@
"primaryKey": false,
"notNull": true,
"autoincrement": false
+ },
+ "customer_id": {
+ "name": "customer_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
}
},
"indexes": {},
@@ -358,6 +511,147 @@
"uniqueConstraints": {},
"checkConstraints": {}
},
+ "documents_tags": {
+ "name": "documents_tags",
+ "columns": {
+ "document_id": {
+ "name": "document_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "tag_id": {
+ "name": "tag_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "documents_tags_document_id_documents_id_fk": {
+ "name": "documents_tags_document_id_documents_id_fk",
+ "tableFrom": "documents_tags",
+ "tableTo": "documents",
+ "columnsFrom": [
+ "document_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ },
+ "documents_tags_tag_id_tags_id_fk": {
+ "name": "documents_tags_tag_id_tags_id_fk",
+ "tableFrom": "documents_tags",
+ "tableTo": "tags",
+ "columnsFrom": [
+ "tag_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {
+ "documents_tags_pkey": {
+ "columns": [
+ "document_id",
+ "tag_id"
+ ],
+ "name": "documents_tags_pkey"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "tags": {
+ "name": "tags",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "tags_organization_id_name_unique": {
+ "name": "tags_organization_id_name_unique",
+ "columns": [
+ "organization_id",
+ "name"
+ ],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {
+ "tags_organization_id_organizations_id_fk": {
+ "name": "tags_organization_id_organizations_id_fk",
+ "tableFrom": "tags",
+ "tableTo": "organizations",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
"users": {
"name": "users",
"columns": {
@@ -410,6 +704,13 @@
"primaryKey": false,
"notNull": false,
"autoincrement": false
+ },
+ "max_organization_count": {
+ "name": "max_organization_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
}
},
"indexes": {
@@ -606,9 +907,24 @@
"primaryKey": false,
"notNull": false,
"autoincrement": false
+ },
+ "active_organization_id": {
+ "name": "active_organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "auth_sessions_token_index": {
+ "name": "auth_sessions_token_index",
+ "columns": [
+ "token"
+ ],
+ "isUnique": false
}
},
- "indexes": {},
"foreignKeys": {
"auth_sessions_user_id_users_id_fk": {
"name": "auth_sessions_user_id_users_id_fk",
@@ -622,6 +938,19 @@
],
"onDelete": "cascade",
"onUpdate": "cascade"
+ },
+ "auth_sessions_active_organization_id_organizations_id_fk": {
+ "name": "auth_sessions_active_organization_id_organizations_id_fk",
+ "tableFrom": "auth_sessions",
+ "tableTo": "organizations",
+ "columnsFrom": [
+ "active_organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "set null",
+ "onUpdate": "cascade"
}
},
"compositePrimaryKeys": {},
@@ -674,11 +1003,204 @@
"autoincrement": false
}
},
- "indexes": {},
+ "indexes": {
+ "auth_verifications_identifier_index": {
+ "name": "auth_verifications_identifier_index",
+ "columns": [
+ "identifier"
+ ],
+ "isUnique": false
+ }
+ },
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
+ },
+ "intake_emails": {
+ "name": "intake_emails",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "email_address": {
+ "name": "email_address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "allowed_origins": {
+ "name": "allowed_origins",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'[]'"
+ },
+ "is_enabled": {
+ "name": "is_enabled",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": true
+ }
+ },
+ "indexes": {
+ "intake_emails_email_address_unique": {
+ "name": "intake_emails_email_address_unique",
+ "columns": [
+ "email_address"
+ ],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {
+ "intake_emails_organization_id_organizations_id_fk": {
+ "name": "intake_emails_organization_id_organizations_id_fk",
+ "tableFrom": "intake_emails",
+ "tableTo": "organizations",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "organization_subscriptions": {
+ "name": "organization_subscriptions",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "customer_id": {
+ "name": "customer_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "plan_id": {
+ "name": "plan_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "seats_count": {
+ "name": "seats_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "current_period_end": {
+ "name": "current_period_end",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "current_period_start": {
+ "name": "current_period_start",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "cancel_at_period_end": {
+ "name": "cancel_at_period_end",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "organization_subscriptions_organization_id_organizations_id_fk": {
+ "name": "organization_subscriptions_organization_id_organizations_id_fk",
+ "tableFrom": "organization_subscriptions",
+ "tableTo": "organizations",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
}
},
"views": {},
diff --git a/apps/papra-server/migrations/meta/0001_snapshot.json b/apps/papra-server/migrations/meta/0001_snapshot.json
index 065652b0..3a8e531b 100644
--- a/apps/papra-server/migrations/meta/0001_snapshot.json
+++ b/apps/papra-server/migrations/meta/0001_snapshot.json
@@ -1,6 +1,6 @@
{
- "id": "449e7226-178b-4119-ac7d-6880323b2974",
- "prevId": "5e528f3f-6da7-4bda-bc61-b157c495681a",
+ "id": "4d99e358-8e33-4991-80c4-d7595c094310",
+ "prevId": "cdc4a655-0dd1-42e5-8e2d-516570b59da6",
"version": "6",
"dialect": "sqlite",
"tables": {
@@ -86,6 +86,13 @@
"notNull": true,
"autoincrement": false
},
+ "original_sha256_hash": {
+ "name": "original_sha256_hash",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
"name": {
"name": "name",
"type": "text",
@@ -118,6 +125,37 @@
"created_at"
],
"isUnique": false
+ },
+ "documents_organization_id_is_deleted_index": {
+ "name": "documents_organization_id_is_deleted_index",
+ "columns": [
+ "organization_id",
+ "is_deleted"
+ ],
+ "isUnique": false
+ },
+ "documents_organization_id_original_sha256_hash_unique": {
+ "name": "documents_organization_id_original_sha256_hash_unique",
+ "columns": [
+ "organization_id",
+ "original_sha256_hash"
+ ],
+ "isUnique": true
+ },
+ "documents_original_sha256_hash_index": {
+ "name": "documents_original_sha256_hash_index",
+ "columns": [
+ "original_sha256_hash"
+ ],
+ "isUnique": false
+ },
+ "documents_organization_id_size_index": {
+ "name": "documents_organization_id_size_index",
+ "columns": [
+ "organization_id",
+ "original_size"
+ ],
+ "isUnique": false
}
},
"foreignKeys": {
@@ -165,8 +203,8 @@
"uniqueConstraints": {},
"checkConstraints": {}
},
- "organization_users": {
- "name": "organization_users",
+ "organization_invitations": {
+ "name": "organization_invitations",
"columns": {
"id": {
"name": "id",
@@ -189,15 +227,15 @@
"notNull": true,
"autoincrement": false
},
- "user_id": {
- "name": "user_id",
+ "organization_id": {
+ "name": "organization_id",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
- "organization_id": {
- "name": "organization_id",
+ "email": {
+ "name": "email",
"type": "text",
"primaryKey": false,
"notNull": true,
@@ -207,18 +245,51 @@
"name": "role",
"type": "text",
"primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
"notNull": true,
- "autoincrement": false,
- "default": "'member'"
+ "autoincrement": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "inviter_id": {
+ "name": "inviter_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
}
},
"indexes": {},
"foreignKeys": {
- "organization_users_user_id_users_id_fk": {
- "name": "organization_users_user_id_users_id_fk",
- "tableFrom": "organization_users",
+ "organization_invitations_organization_id_organizations_id_fk": {
+ "name": "organization_invitations_organization_id_organizations_id_fk",
+ "tableFrom": "organization_invitations",
"columnsFrom": [
- "user_id"
+ "organization_id"
+ ],
+ "tableTo": "organizations",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "cascade",
+ "onDelete": "cascade"
+ },
+ "organization_invitations_inviter_id_users_id_fk": {
+ "name": "organization_invitations_inviter_id_users_id_fk",
+ "tableFrom": "organization_invitations",
+ "columnsFrom": [
+ "inviter_id"
],
"tableTo": "users",
"columnsTo": [
@@ -226,10 +297,72 @@
],
"onUpdate": "cascade",
"onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "organization_members": {
+ "name": "organization_members",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
},
- "organization_users_organization_id_organizations_id_fk": {
- "name": "organization_users_organization_id_organizations_id_fk",
- "tableFrom": "organization_users",
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "role": {
+ "name": "role",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "organization_members_user_organization_unique": {
+ "name": "organization_members_user_organization_unique",
+ "columns": [
+ "organization_id",
+ "user_id"
+ ],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {
+ "organization_members_organization_id_organizations_id_fk": {
+ "name": "organization_members_organization_id_organizations_id_fk",
+ "tableFrom": "organization_members",
"columnsFrom": [
"organization_id"
],
@@ -239,6 +372,19 @@
],
"onUpdate": "cascade",
"onDelete": "cascade"
+ },
+ "organization_members_user_id_users_id_fk": {
+ "name": "organization_members_user_id_users_id_fk",
+ "tableFrom": "organization_members",
+ "columnsFrom": [
+ "user_id"
+ ],
+ "tableTo": "users",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "cascade",
+ "onDelete": "cascade"
}
},
"compositePrimaryKeys": {},
@@ -275,6 +421,13 @@
"primaryKey": false,
"notNull": true,
"autoincrement": false
+ },
+ "customer_id": {
+ "name": "customer_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
}
},
"indexes": {},
@@ -358,6 +511,147 @@
"uniqueConstraints": {},
"checkConstraints": {}
},
+ "documents_tags": {
+ "name": "documents_tags",
+ "columns": {
+ "document_id": {
+ "name": "document_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "tag_id": {
+ "name": "tag_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "documents_tags_document_id_documents_id_fk": {
+ "name": "documents_tags_document_id_documents_id_fk",
+ "tableFrom": "documents_tags",
+ "columnsFrom": [
+ "document_id"
+ ],
+ "tableTo": "documents",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "cascade",
+ "onDelete": "cascade"
+ },
+ "documents_tags_tag_id_tags_id_fk": {
+ "name": "documents_tags_tag_id_tags_id_fk",
+ "tableFrom": "documents_tags",
+ "columnsFrom": [
+ "tag_id"
+ ],
+ "tableTo": "tags",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "cascade",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {
+ "documents_tags_pkey": {
+ "columns": [
+ "document_id",
+ "tag_id"
+ ],
+ "name": "documents_tags_pkey"
+ }
+ },
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "tags": {
+ "name": "tags",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "color": {
+ "name": "color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "tags_organization_id_name_unique": {
+ "name": "tags_organization_id_name_unique",
+ "columns": [
+ "organization_id",
+ "name"
+ ],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {
+ "tags_organization_id_organizations_id_fk": {
+ "name": "tags_organization_id_organizations_id_fk",
+ "tableFrom": "tags",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "tableTo": "organizations",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "cascade",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
"users": {
"name": "users",
"columns": {
@@ -410,6 +704,13 @@
"primaryKey": false,
"notNull": false,
"autoincrement": false
+ },
+ "max_organization_count": {
+ "name": "max_organization_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
}
},
"indexes": {
@@ -606,9 +907,24 @@
"primaryKey": false,
"notNull": false,
"autoincrement": false
+ },
+ "active_organization_id": {
+ "name": "active_organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "auth_sessions_token_index": {
+ "name": "auth_sessions_token_index",
+ "columns": [
+ "token"
+ ],
+ "isUnique": false
}
},
- "indexes": {},
"foreignKeys": {
"auth_sessions_user_id_users_id_fk": {
"name": "auth_sessions_user_id_users_id_fk",
@@ -622,6 +938,19 @@
],
"onUpdate": "cascade",
"onDelete": "cascade"
+ },
+ "auth_sessions_active_organization_id_organizations_id_fk": {
+ "name": "auth_sessions_active_organization_id_organizations_id_fk",
+ "tableFrom": "auth_sessions",
+ "columnsFrom": [
+ "active_organization_id"
+ ],
+ "tableTo": "organizations",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "cascade",
+ "onDelete": "set null"
}
},
"compositePrimaryKeys": {},
@@ -674,11 +1003,204 @@
"autoincrement": false
}
},
- "indexes": {},
+ "indexes": {
+ "auth_verifications_identifier_index": {
+ "name": "auth_verifications_identifier_index",
+ "columns": [
+ "identifier"
+ ],
+ "isUnique": false
+ }
+ },
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
+ },
+ "intake_emails": {
+ "name": "intake_emails",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "email_address": {
+ "name": "email_address",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "allowed_origins": {
+ "name": "allowed_origins",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'[]'"
+ },
+ "is_enabled": {
+ "name": "is_enabled",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": true
+ }
+ },
+ "indexes": {
+ "intake_emails_email_address_unique": {
+ "name": "intake_emails_email_address_unique",
+ "columns": [
+ "email_address"
+ ],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {
+ "intake_emails_organization_id_organizations_id_fk": {
+ "name": "intake_emails_organization_id_organizations_id_fk",
+ "tableFrom": "intake_emails",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "tableTo": "organizations",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "cascade",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
+ },
+ "organization_subscriptions": {
+ "name": "organization_subscriptions",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "customer_id": {
+ "name": "customer_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "organization_id": {
+ "name": "organization_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "plan_id": {
+ "name": "plan_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "seats_count": {
+ "name": "seats_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "current_period_end": {
+ "name": "current_period_end",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "current_period_start": {
+ "name": "current_period_start",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "cancel_at_period_end": {
+ "name": "cancel_at_period_end",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "organization_subscriptions_organization_id_organizations_id_fk": {
+ "name": "organization_subscriptions_organization_id_organizations_id_fk",
+ "tableFrom": "organization_subscriptions",
+ "columnsFrom": [
+ "organization_id"
+ ],
+ "tableTo": "organizations",
+ "columnsTo": [
+ "id"
+ ],
+ "onUpdate": "cascade",
+ "onDelete": "cascade"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "checkConstraints": {}
}
},
"views": {},
diff --git a/apps/papra-server/migrations/meta/0002_snapshot.json b/apps/papra-server/migrations/meta/0002_snapshot.json
deleted file mode 100644
index 7e4f23fa..00000000
--- a/apps/papra-server/migrations/meta/0002_snapshot.json
+++ /dev/null
@@ -1,835 +0,0 @@
-{
- "version": "6",
- "dialect": "sqlite",
- "id": "461b726b-6e58-4a08-81bc-324027e568c5",
- "prevId": "449e7226-178b-4119-ac7d-6880323b2974",
- "tables": {
- "documents": {
- "name": "documents",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "is_deleted": {
- "name": "is_deleted",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": false
- },
- "deleted_at": {
- "name": "deleted_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "organization_id": {
- "name": "organization_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "created_by": {
- "name": "created_by",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "deleted_by": {
- "name": "deleted_by",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "original_name": {
- "name": "original_name",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "original_size": {
- "name": "original_size",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": 0
- },
- "original_storage_key": {
- "name": "original_storage_key",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "mime_type": {
- "name": "mime_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "content": {
- "name": "content",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": "''"
- }
- },
- "indexes": {
- "documents_organization_id_is_deleted_created_at_index": {
- "name": "documents_organization_id_is_deleted_created_at_index",
- "columns": [
- "organization_id",
- "is_deleted",
- "created_at"
- ],
- "isUnique": false
- }
- },
- "foreignKeys": {
- "documents_organization_id_organizations_id_fk": {
- "name": "documents_organization_id_organizations_id_fk",
- "tableFrom": "documents",
- "tableTo": "organizations",
- "columnsFrom": [
- "organization_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "documents_created_by_users_id_fk": {
- "name": "documents_created_by_users_id_fk",
- "tableFrom": "documents",
- "tableTo": "users",
- "columnsFrom": [
- "created_by"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "cascade"
- },
- "documents_deleted_by_users_id_fk": {
- "name": "documents_deleted_by_users_id_fk",
- "tableFrom": "documents",
- "tableTo": "users",
- "columnsFrom": [
- "deleted_by"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "organization_users": {
- "name": "organization_users",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "organization_id": {
- "name": "organization_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "role": {
- "name": "role",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": "'member'"
- }
- },
- "indexes": {},
- "foreignKeys": {
- "organization_users_user_id_users_id_fk": {
- "name": "organization_users_user_id_users_id_fk",
- "tableFrom": "organization_users",
- "tableTo": "users",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "organization_users_organization_id_organizations_id_fk": {
- "name": "organization_users_organization_id_organizations_id_fk",
- "tableFrom": "organization_users",
- "tableTo": "organizations",
- "columnsFrom": [
- "organization_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "organizations": {
- "name": "organizations",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- }
- },
- "indexes": {},
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "user_roles": {
- "name": "user_roles",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "role": {
- "name": "role",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- }
- },
- "indexes": {
- "user_roles_role_index": {
- "name": "user_roles_role_index",
- "columns": [
- "role"
- ],
- "isUnique": false
- },
- "user_roles_user_id_role_unique_index": {
- "name": "user_roles_user_id_role_unique_index",
- "columns": [
- "user_id",
- "role"
- ],
- "isUnique": true
- }
- },
- "foreignKeys": {
- "user_roles_user_id_users_id_fk": {
- "name": "user_roles_user_id_users_id_fk",
- "tableFrom": "user_roles",
- "tableTo": "users",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "documents_tags": {
- "name": "documents_tags",
- "columns": {
- "document_id": {
- "name": "document_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "tag_id": {
- "name": "tag_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- }
- },
- "indexes": {},
- "foreignKeys": {
- "documents_tags_document_id_documents_id_fk": {
- "name": "documents_tags_document_id_documents_id_fk",
- "tableFrom": "documents_tags",
- "tableTo": "documents",
- "columnsFrom": [
- "document_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "documents_tags_tag_id_tags_id_fk": {
- "name": "documents_tags_tag_id_tags_id_fk",
- "tableFrom": "documents_tags",
- "tableTo": "tags",
- "columnsFrom": [
- "tag_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {
- "documents_tags_pkey": {
- "columns": [
- "document_id",
- "tag_id"
- ],
- "name": "documents_tags_pkey"
- }
- },
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "tags": {
- "name": "tags",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "organization_id": {
- "name": "organization_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "color": {
- "name": "color",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "description": {
- "name": "description",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- }
- },
- "indexes": {
- "tags_organization_id_name_unique": {
- "name": "tags_organization_id_name_unique",
- "columns": [
- "organization_id",
- "name"
- ],
- "isUnique": true
- }
- },
- "foreignKeys": {
- "tags_organization_id_organizations_id_fk": {
- "name": "tags_organization_id_organizations_id_fk",
- "tableFrom": "tags",
- "tableTo": "organizations",
- "columnsFrom": [
- "organization_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "users": {
- "name": "users",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "email": {
- "name": "email",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "email_verified": {
- "name": "email_verified",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": false
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "image": {
- "name": "image",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- }
- },
- "indexes": {
- "users_email_unique": {
- "name": "users_email_unique",
- "columns": [
- "email"
- ],
- "isUnique": true
- },
- "users_email_index": {
- "name": "users_email_index",
- "columns": [
- "email"
- ],
- "isUnique": false
- }
- },
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "auth_accounts": {
- "name": "auth_accounts",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "account_id": {
- "name": "account_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "provider_id": {
- "name": "provider_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "access_token": {
- "name": "access_token",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "refresh_token": {
- "name": "refresh_token",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "access_token_expires_at": {
- "name": "access_token_expires_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "refresh_token_expires_at": {
- "name": "refresh_token_expires_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "scope": {
- "name": "scope",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "id_token": {
- "name": "id_token",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "password": {
- "name": "password",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- }
- },
- "indexes": {},
- "foreignKeys": {
- "auth_accounts_user_id_users_id_fk": {
- "name": "auth_accounts_user_id_users_id_fk",
- "tableFrom": "auth_accounts",
- "tableTo": "users",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "auth_sessions": {
- "name": "auth_sessions",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "token": {
- "name": "token",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "expires_at": {
- "name": "expires_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "ip_address": {
- "name": "ip_address",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "user_agent": {
- "name": "user_agent",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- }
- },
- "indexes": {},
- "foreignKeys": {
- "auth_sessions_user_id_users_id_fk": {
- "name": "auth_sessions_user_id_users_id_fk",
- "tableFrom": "auth_sessions",
- "tableTo": "users",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "auth_verifications": {
- "name": "auth_verifications",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "identifier": {
- "name": "identifier",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "value": {
- "name": "value",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "expires_at": {
- "name": "expires_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- }
- },
- "indexes": {},
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- }
- },
- "views": {},
- "enums": {},
- "_meta": {
- "schemas": {},
- "tables": {},
- "columns": {}
- },
- "internal": {
- "indexes": {}
- }
-}
diff --git a/apps/papra-server/migrations/meta/0003_snapshot.json b/apps/papra-server/migrations/meta/0003_snapshot.json
deleted file mode 100644
index 0b787494..00000000
--- a/apps/papra-server/migrations/meta/0003_snapshot.json
+++ /dev/null
@@ -1,903 +0,0 @@
-{
- "version": "6",
- "dialect": "sqlite",
- "id": "7347bf3b-241a-46c0-9c6c-843be2d46547",
- "prevId": "461b726b-6e58-4a08-81bc-324027e568c5",
- "tables": {
- "documents": {
- "name": "documents",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "is_deleted": {
- "name": "is_deleted",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": false
- },
- "deleted_at": {
- "name": "deleted_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "organization_id": {
- "name": "organization_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "created_by": {
- "name": "created_by",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "deleted_by": {
- "name": "deleted_by",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "original_name": {
- "name": "original_name",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "original_size": {
- "name": "original_size",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": 0
- },
- "original_storage_key": {
- "name": "original_storage_key",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "mime_type": {
- "name": "mime_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "content": {
- "name": "content",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": "''"
- }
- },
- "indexes": {
- "documents_organization_id_is_deleted_created_at_index": {
- "name": "documents_organization_id_is_deleted_created_at_index",
- "columns": [
- "organization_id",
- "is_deleted",
- "created_at"
- ],
- "isUnique": false
- }
- },
- "foreignKeys": {
- "documents_organization_id_organizations_id_fk": {
- "name": "documents_organization_id_organizations_id_fk",
- "tableFrom": "documents",
- "tableTo": "organizations",
- "columnsFrom": [
- "organization_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "documents_created_by_users_id_fk": {
- "name": "documents_created_by_users_id_fk",
- "tableFrom": "documents",
- "tableTo": "users",
- "columnsFrom": [
- "created_by"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "cascade"
- },
- "documents_deleted_by_users_id_fk": {
- "name": "documents_deleted_by_users_id_fk",
- "tableFrom": "documents",
- "tableTo": "users",
- "columnsFrom": [
- "deleted_by"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "organization_users": {
- "name": "organization_users",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "organization_id": {
- "name": "organization_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "role": {
- "name": "role",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": "'member'"
- }
- },
- "indexes": {},
- "foreignKeys": {
- "organization_users_user_id_users_id_fk": {
- "name": "organization_users_user_id_users_id_fk",
- "tableFrom": "organization_users",
- "tableTo": "users",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "organization_users_organization_id_organizations_id_fk": {
- "name": "organization_users_organization_id_organizations_id_fk",
- "tableFrom": "organization_users",
- "tableTo": "organizations",
- "columnsFrom": [
- "organization_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "organizations": {
- "name": "organizations",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- }
- },
- "indexes": {},
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "user_roles": {
- "name": "user_roles",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "role": {
- "name": "role",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- }
- },
- "indexes": {
- "user_roles_role_index": {
- "name": "user_roles_role_index",
- "columns": [
- "role"
- ],
- "isUnique": false
- },
- "user_roles_user_id_role_unique_index": {
- "name": "user_roles_user_id_role_unique_index",
- "columns": [
- "user_id",
- "role"
- ],
- "isUnique": true
- }
- },
- "foreignKeys": {
- "user_roles_user_id_users_id_fk": {
- "name": "user_roles_user_id_users_id_fk",
- "tableFrom": "user_roles",
- "tableTo": "users",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "documents_tags": {
- "name": "documents_tags",
- "columns": {
- "document_id": {
- "name": "document_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "tag_id": {
- "name": "tag_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- }
- },
- "indexes": {},
- "foreignKeys": {
- "documents_tags_document_id_documents_id_fk": {
- "name": "documents_tags_document_id_documents_id_fk",
- "tableFrom": "documents_tags",
- "tableTo": "documents",
- "columnsFrom": [
- "document_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "documents_tags_tag_id_tags_id_fk": {
- "name": "documents_tags_tag_id_tags_id_fk",
- "tableFrom": "documents_tags",
- "tableTo": "tags",
- "columnsFrom": [
- "tag_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {
- "documents_tags_pkey": {
- "columns": [
- "document_id",
- "tag_id"
- ],
- "name": "documents_tags_pkey"
- }
- },
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "tags": {
- "name": "tags",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "organization_id": {
- "name": "organization_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "color": {
- "name": "color",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "description": {
- "name": "description",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- }
- },
- "indexes": {
- "tags_organization_id_name_unique": {
- "name": "tags_organization_id_name_unique",
- "columns": [
- "organization_id",
- "name"
- ],
- "isUnique": true
- }
- },
- "foreignKeys": {
- "tags_organization_id_organizations_id_fk": {
- "name": "tags_organization_id_organizations_id_fk",
- "tableFrom": "tags",
- "tableTo": "organizations",
- "columnsFrom": [
- "organization_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "users": {
- "name": "users",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "email": {
- "name": "email",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "email_verified": {
- "name": "email_verified",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": false
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "image": {
- "name": "image",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- }
- },
- "indexes": {
- "users_email_unique": {
- "name": "users_email_unique",
- "columns": [
- "email"
- ],
- "isUnique": true
- },
- "users_email_index": {
- "name": "users_email_index",
- "columns": [
- "email"
- ],
- "isUnique": false
- }
- },
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "auth_accounts": {
- "name": "auth_accounts",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "account_id": {
- "name": "account_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "provider_id": {
- "name": "provider_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "access_token": {
- "name": "access_token",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "refresh_token": {
- "name": "refresh_token",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "access_token_expires_at": {
- "name": "access_token_expires_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "refresh_token_expires_at": {
- "name": "refresh_token_expires_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "scope": {
- "name": "scope",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "id_token": {
- "name": "id_token",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "password": {
- "name": "password",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- }
- },
- "indexes": {},
- "foreignKeys": {
- "auth_accounts_user_id_users_id_fk": {
- "name": "auth_accounts_user_id_users_id_fk",
- "tableFrom": "auth_accounts",
- "tableTo": "users",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "auth_sessions": {
- "name": "auth_sessions",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "token": {
- "name": "token",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "expires_at": {
- "name": "expires_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "ip_address": {
- "name": "ip_address",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "user_agent": {
- "name": "user_agent",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- }
- },
- "indexes": {},
- "foreignKeys": {
- "auth_sessions_user_id_users_id_fk": {
- "name": "auth_sessions_user_id_users_id_fk",
- "tableFrom": "auth_sessions",
- "tableTo": "users",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "auth_verifications": {
- "name": "auth_verifications",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "identifier": {
- "name": "identifier",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "value": {
- "name": "value",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "expires_at": {
- "name": "expires_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- }
- },
- "indexes": {},
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "intake_emails": {
- "name": "intake_emails",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "organization_id": {
- "name": "organization_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "allowed_origins": {
- "name": "allowed_origins",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": "'[]'"
- },
- "is_enabled": {
- "name": "is_enabled",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": true
- }
- },
- "indexes": {},
- "foreignKeys": {
- "intake_emails_organization_id_organizations_id_fk": {
- "name": "intake_emails_organization_id_organizations_id_fk",
- "tableFrom": "intake_emails",
- "tableTo": "organizations",
- "columnsFrom": [
- "organization_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- }
- },
- "views": {},
- "enums": {},
- "_meta": {
- "schemas": {},
- "tables": {},
- "columns": {}
- },
- "internal": {
- "indexes": {}
- }
-}
diff --git a/apps/papra-server/migrations/meta/0004_snapshot.json b/apps/papra-server/migrations/meta/0004_snapshot.json
deleted file mode 100644
index 2ac44095..00000000
--- a/apps/papra-server/migrations/meta/0004_snapshot.json
+++ /dev/null
@@ -1,919 +0,0 @@
-{
- "version": "6",
- "dialect": "sqlite",
- "id": "2924235c-4fd1-461c-ba1c-6851da94e9a7",
- "prevId": "7347bf3b-241a-46c0-9c6c-843be2d46547",
- "tables": {
- "documents": {
- "name": "documents",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "is_deleted": {
- "name": "is_deleted",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": false
- },
- "deleted_at": {
- "name": "deleted_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "organization_id": {
- "name": "organization_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "created_by": {
- "name": "created_by",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "deleted_by": {
- "name": "deleted_by",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "original_name": {
- "name": "original_name",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "original_size": {
- "name": "original_size",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": 0
- },
- "original_storage_key": {
- "name": "original_storage_key",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "mime_type": {
- "name": "mime_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "content": {
- "name": "content",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": "''"
- }
- },
- "indexes": {
- "documents_organization_id_is_deleted_created_at_index": {
- "name": "documents_organization_id_is_deleted_created_at_index",
- "columns": [
- "organization_id",
- "is_deleted",
- "created_at"
- ],
- "isUnique": false
- }
- },
- "foreignKeys": {
- "documents_organization_id_organizations_id_fk": {
- "name": "documents_organization_id_organizations_id_fk",
- "tableFrom": "documents",
- "tableTo": "organizations",
- "columnsFrom": [
- "organization_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "documents_created_by_users_id_fk": {
- "name": "documents_created_by_users_id_fk",
- "tableFrom": "documents",
- "tableTo": "users",
- "columnsFrom": [
- "created_by"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "cascade"
- },
- "documents_deleted_by_users_id_fk": {
- "name": "documents_deleted_by_users_id_fk",
- "tableFrom": "documents",
- "tableTo": "users",
- "columnsFrom": [
- "deleted_by"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "organization_users": {
- "name": "organization_users",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "organization_id": {
- "name": "organization_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "role": {
- "name": "role",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": "'member'"
- }
- },
- "indexes": {},
- "foreignKeys": {
- "organization_users_user_id_users_id_fk": {
- "name": "organization_users_user_id_users_id_fk",
- "tableFrom": "organization_users",
- "tableTo": "users",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "organization_users_organization_id_organizations_id_fk": {
- "name": "organization_users_organization_id_organizations_id_fk",
- "tableFrom": "organization_users",
- "tableTo": "organizations",
- "columnsFrom": [
- "organization_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "organizations": {
- "name": "organizations",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- }
- },
- "indexes": {},
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "user_roles": {
- "name": "user_roles",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "role": {
- "name": "role",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- }
- },
- "indexes": {
- "user_roles_role_index": {
- "name": "user_roles_role_index",
- "columns": [
- "role"
- ],
- "isUnique": false
- },
- "user_roles_user_id_role_unique_index": {
- "name": "user_roles_user_id_role_unique_index",
- "columns": [
- "user_id",
- "role"
- ],
- "isUnique": true
- }
- },
- "foreignKeys": {
- "user_roles_user_id_users_id_fk": {
- "name": "user_roles_user_id_users_id_fk",
- "tableFrom": "user_roles",
- "tableTo": "users",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "documents_tags": {
- "name": "documents_tags",
- "columns": {
- "document_id": {
- "name": "document_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "tag_id": {
- "name": "tag_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- }
- },
- "indexes": {},
- "foreignKeys": {
- "documents_tags_document_id_documents_id_fk": {
- "name": "documents_tags_document_id_documents_id_fk",
- "tableFrom": "documents_tags",
- "tableTo": "documents",
- "columnsFrom": [
- "document_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "documents_tags_tag_id_tags_id_fk": {
- "name": "documents_tags_tag_id_tags_id_fk",
- "tableFrom": "documents_tags",
- "tableTo": "tags",
- "columnsFrom": [
- "tag_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {
- "documents_tags_pkey": {
- "columns": [
- "document_id",
- "tag_id"
- ],
- "name": "documents_tags_pkey"
- }
- },
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "tags": {
- "name": "tags",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "organization_id": {
- "name": "organization_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "color": {
- "name": "color",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "description": {
- "name": "description",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- }
- },
- "indexes": {
- "tags_organization_id_name_unique": {
- "name": "tags_organization_id_name_unique",
- "columns": [
- "organization_id",
- "name"
- ],
- "isUnique": true
- }
- },
- "foreignKeys": {
- "tags_organization_id_organizations_id_fk": {
- "name": "tags_organization_id_organizations_id_fk",
- "tableFrom": "tags",
- "tableTo": "organizations",
- "columnsFrom": [
- "organization_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "users": {
- "name": "users",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "email": {
- "name": "email",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "email_verified": {
- "name": "email_verified",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": false
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "image": {
- "name": "image",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- }
- },
- "indexes": {
- "users_email_unique": {
- "name": "users_email_unique",
- "columns": [
- "email"
- ],
- "isUnique": true
- },
- "users_email_index": {
- "name": "users_email_index",
- "columns": [
- "email"
- ],
- "isUnique": false
- }
- },
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "auth_accounts": {
- "name": "auth_accounts",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "account_id": {
- "name": "account_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "provider_id": {
- "name": "provider_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "access_token": {
- "name": "access_token",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "refresh_token": {
- "name": "refresh_token",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "access_token_expires_at": {
- "name": "access_token_expires_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "refresh_token_expires_at": {
- "name": "refresh_token_expires_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "scope": {
- "name": "scope",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "id_token": {
- "name": "id_token",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "password": {
- "name": "password",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- }
- },
- "indexes": {},
- "foreignKeys": {
- "auth_accounts_user_id_users_id_fk": {
- "name": "auth_accounts_user_id_users_id_fk",
- "tableFrom": "auth_accounts",
- "tableTo": "users",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "auth_sessions": {
- "name": "auth_sessions",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "token": {
- "name": "token",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "expires_at": {
- "name": "expires_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "ip_address": {
- "name": "ip_address",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "user_agent": {
- "name": "user_agent",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- }
- },
- "indexes": {
- "auth_sessions_token_index": {
- "name": "auth_sessions_token_index",
- "columns": [
- "token"
- ],
- "isUnique": false
- }
- },
- "foreignKeys": {
- "auth_sessions_user_id_users_id_fk": {
- "name": "auth_sessions_user_id_users_id_fk",
- "tableFrom": "auth_sessions",
- "tableTo": "users",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "auth_verifications": {
- "name": "auth_verifications",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "identifier": {
- "name": "identifier",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "value": {
- "name": "value",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "expires_at": {
- "name": "expires_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- }
- },
- "indexes": {
- "auth_verifications_identifier_index": {
- "name": "auth_verifications_identifier_index",
- "columns": [
- "identifier"
- ],
- "isUnique": false
- }
- },
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "intake_emails": {
- "name": "intake_emails",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "organization_id": {
- "name": "organization_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "allowed_origins": {
- "name": "allowed_origins",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": "'[]'"
- },
- "is_enabled": {
- "name": "is_enabled",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": true
- }
- },
- "indexes": {},
- "foreignKeys": {
- "intake_emails_organization_id_organizations_id_fk": {
- "name": "intake_emails_organization_id_organizations_id_fk",
- "tableFrom": "intake_emails",
- "tableTo": "organizations",
- "columnsFrom": [
- "organization_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- }
- },
- "views": {},
- "enums": {},
- "_meta": {
- "schemas": {},
- "tables": {},
- "columns": {}
- },
- "internal": {
- "indexes": {}
- }
-}
diff --git a/apps/papra-server/migrations/meta/0005_snapshot.json b/apps/papra-server/migrations/meta/0005_snapshot.json
deleted file mode 100644
index 21820fa8..00000000
--- a/apps/papra-server/migrations/meta/0005_snapshot.json
+++ /dev/null
@@ -1,942 +0,0 @@
-{
- "version": "6",
- "dialect": "sqlite",
- "id": "64c5c91e-42f1-45e8-bda0-934852ef45c9",
- "prevId": "2924235c-4fd1-461c-ba1c-6851da94e9a7",
- "tables": {
- "documents": {
- "name": "documents",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "is_deleted": {
- "name": "is_deleted",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": false
- },
- "deleted_at": {
- "name": "deleted_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "organization_id": {
- "name": "organization_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "created_by": {
- "name": "created_by",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "deleted_by": {
- "name": "deleted_by",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "original_name": {
- "name": "original_name",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "original_size": {
- "name": "original_size",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": 0
- },
- "original_storage_key": {
- "name": "original_storage_key",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "mime_type": {
- "name": "mime_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "content": {
- "name": "content",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": "''"
- }
- },
- "indexes": {
- "documents_organization_id_is_deleted_created_at_index": {
- "name": "documents_organization_id_is_deleted_created_at_index",
- "columns": [
- "organization_id",
- "is_deleted",
- "created_at"
- ],
- "isUnique": false
- },
- "documents_organization_id_is_deleted_index": {
- "name": "documents_organization_id_is_deleted_index",
- "columns": [
- "organization_id",
- "is_deleted"
- ],
- "isUnique": false
- }
- },
- "foreignKeys": {
- "documents_organization_id_organizations_id_fk": {
- "name": "documents_organization_id_organizations_id_fk",
- "tableFrom": "documents",
- "tableTo": "organizations",
- "columnsFrom": [
- "organization_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "documents_created_by_users_id_fk": {
- "name": "documents_created_by_users_id_fk",
- "tableFrom": "documents",
- "tableTo": "users",
- "columnsFrom": [
- "created_by"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "cascade"
- },
- "documents_deleted_by_users_id_fk": {
- "name": "documents_deleted_by_users_id_fk",
- "tableFrom": "documents",
- "tableTo": "users",
- "columnsFrom": [
- "deleted_by"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "organization_users": {
- "name": "organization_users",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "organization_id": {
- "name": "organization_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "role": {
- "name": "role",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": "'member'"
- }
- },
- "indexes": {},
- "foreignKeys": {
- "organization_users_user_id_users_id_fk": {
- "name": "organization_users_user_id_users_id_fk",
- "tableFrom": "organization_users",
- "tableTo": "users",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "organization_users_organization_id_organizations_id_fk": {
- "name": "organization_users_organization_id_organizations_id_fk",
- "tableFrom": "organization_users",
- "tableTo": "organizations",
- "columnsFrom": [
- "organization_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "organizations": {
- "name": "organizations",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- }
- },
- "indexes": {},
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "user_roles": {
- "name": "user_roles",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "role": {
- "name": "role",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- }
- },
- "indexes": {
- "user_roles_role_index": {
- "name": "user_roles_role_index",
- "columns": [
- "role"
- ],
- "isUnique": false
- },
- "user_roles_user_id_role_unique_index": {
- "name": "user_roles_user_id_role_unique_index",
- "columns": [
- "user_id",
- "role"
- ],
- "isUnique": true
- }
- },
- "foreignKeys": {
- "user_roles_user_id_users_id_fk": {
- "name": "user_roles_user_id_users_id_fk",
- "tableFrom": "user_roles",
- "tableTo": "users",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "documents_tags": {
- "name": "documents_tags",
- "columns": {
- "document_id": {
- "name": "document_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "tag_id": {
- "name": "tag_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- }
- },
- "indexes": {},
- "foreignKeys": {
- "documents_tags_document_id_documents_id_fk": {
- "name": "documents_tags_document_id_documents_id_fk",
- "tableFrom": "documents_tags",
- "tableTo": "documents",
- "columnsFrom": [
- "document_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "documents_tags_tag_id_tags_id_fk": {
- "name": "documents_tags_tag_id_tags_id_fk",
- "tableFrom": "documents_tags",
- "tableTo": "tags",
- "columnsFrom": [
- "tag_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {
- "documents_tags_pkey": {
- "columns": [
- "document_id",
- "tag_id"
- ],
- "name": "documents_tags_pkey"
- }
- },
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "tags": {
- "name": "tags",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "organization_id": {
- "name": "organization_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "color": {
- "name": "color",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "description": {
- "name": "description",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- }
- },
- "indexes": {
- "tags_organization_id_name_unique": {
- "name": "tags_organization_id_name_unique",
- "columns": [
- "organization_id",
- "name"
- ],
- "isUnique": true
- }
- },
- "foreignKeys": {
- "tags_organization_id_organizations_id_fk": {
- "name": "tags_organization_id_organizations_id_fk",
- "tableFrom": "tags",
- "tableTo": "organizations",
- "columnsFrom": [
- "organization_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "users": {
- "name": "users",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "email": {
- "name": "email",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "email_verified": {
- "name": "email_verified",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": false
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "image": {
- "name": "image",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- }
- },
- "indexes": {
- "users_email_unique": {
- "name": "users_email_unique",
- "columns": [
- "email"
- ],
- "isUnique": true
- },
- "users_email_index": {
- "name": "users_email_index",
- "columns": [
- "email"
- ],
- "isUnique": false
- }
- },
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "auth_accounts": {
- "name": "auth_accounts",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "account_id": {
- "name": "account_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "provider_id": {
- "name": "provider_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "access_token": {
- "name": "access_token",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "refresh_token": {
- "name": "refresh_token",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "access_token_expires_at": {
- "name": "access_token_expires_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "refresh_token_expires_at": {
- "name": "refresh_token_expires_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "scope": {
- "name": "scope",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "id_token": {
- "name": "id_token",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "password": {
- "name": "password",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- }
- },
- "indexes": {},
- "foreignKeys": {
- "auth_accounts_user_id_users_id_fk": {
- "name": "auth_accounts_user_id_users_id_fk",
- "tableFrom": "auth_accounts",
- "tableTo": "users",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "auth_sessions": {
- "name": "auth_sessions",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "token": {
- "name": "token",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "expires_at": {
- "name": "expires_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "ip_address": {
- "name": "ip_address",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "user_agent": {
- "name": "user_agent",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- }
- },
- "indexes": {
- "auth_sessions_token_index": {
- "name": "auth_sessions_token_index",
- "columns": [
- "token"
- ],
- "isUnique": false
- }
- },
- "foreignKeys": {
- "auth_sessions_user_id_users_id_fk": {
- "name": "auth_sessions_user_id_users_id_fk",
- "tableFrom": "auth_sessions",
- "tableTo": "users",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "auth_verifications": {
- "name": "auth_verifications",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "identifier": {
- "name": "identifier",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "value": {
- "name": "value",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "expires_at": {
- "name": "expires_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- }
- },
- "indexes": {
- "auth_verifications_identifier_index": {
- "name": "auth_verifications_identifier_index",
- "columns": [
- "identifier"
- ],
- "isUnique": false
- }
- },
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "intake_emails": {
- "name": "intake_emails",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "email_address": {
- "name": "email_address",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "organization_id": {
- "name": "organization_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "allowed_origins": {
- "name": "allowed_origins",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": "'[]'"
- },
- "is_enabled": {
- "name": "is_enabled",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": true
- }
- },
- "indexes": {
- "intake_emails_email_address_unique": {
- "name": "intake_emails_email_address_unique",
- "columns": [
- "email_address"
- ],
- "isUnique": true
- }
- },
- "foreignKeys": {
- "intake_emails_organization_id_organizations_id_fk": {
- "name": "intake_emails_organization_id_organizations_id_fk",
- "tableFrom": "intake_emails",
- "tableTo": "organizations",
- "columnsFrom": [
- "organization_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- }
- },
- "views": {},
- "enums": {},
- "_meta": {
- "schemas": {},
- "tables": {},
- "columns": {}
- },
- "internal": {
- "indexes": {}
- }
-}
diff --git a/apps/papra-server/migrations/meta/0006_snapshot.json b/apps/papra-server/migrations/meta/0006_snapshot.json
deleted file mode 100644
index d00316a7..00000000
--- a/apps/papra-server/migrations/meta/0006_snapshot.json
+++ /dev/null
@@ -1,957 +0,0 @@
-{
- "version": "6",
- "dialect": "sqlite",
- "id": "b63753f1-78a4-4d56-bc18-52634b7f2401",
- "prevId": "64c5c91e-42f1-45e8-bda0-934852ef45c9",
- "tables": {
- "documents": {
- "name": "documents",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "is_deleted": {
- "name": "is_deleted",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": false
- },
- "deleted_at": {
- "name": "deleted_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "organization_id": {
- "name": "organization_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "created_by": {
- "name": "created_by",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "deleted_by": {
- "name": "deleted_by",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "original_name": {
- "name": "original_name",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "original_size": {
- "name": "original_size",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": 0
- },
- "original_storage_key": {
- "name": "original_storage_key",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "original_sha256_hash": {
- "name": "original_sha256_hash",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "mime_type": {
- "name": "mime_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "content": {
- "name": "content",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": "''"
- }
- },
- "indexes": {
- "documents_organization_id_is_deleted_created_at_index": {
- "name": "documents_organization_id_is_deleted_created_at_index",
- "columns": [
- "organization_id",
- "is_deleted",
- "created_at"
- ],
- "isUnique": false
- },
- "documents_organization_id_is_deleted_index": {
- "name": "documents_organization_id_is_deleted_index",
- "columns": [
- "organization_id",
- "is_deleted"
- ],
- "isUnique": false
- },
- "documents_organization_id_original_sha256_hash_unique": {
- "name": "documents_organization_id_original_sha256_hash_unique",
- "columns": [
- "organization_id",
- "original_sha256_hash"
- ],
- "isUnique": true
- }
- },
- "foreignKeys": {
- "documents_organization_id_organizations_id_fk": {
- "name": "documents_organization_id_organizations_id_fk",
- "tableFrom": "documents",
- "tableTo": "organizations",
- "columnsFrom": [
- "organization_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "documents_created_by_users_id_fk": {
- "name": "documents_created_by_users_id_fk",
- "tableFrom": "documents",
- "tableTo": "users",
- "columnsFrom": [
- "created_by"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "cascade"
- },
- "documents_deleted_by_users_id_fk": {
- "name": "documents_deleted_by_users_id_fk",
- "tableFrom": "documents",
- "tableTo": "users",
- "columnsFrom": [
- "deleted_by"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "organization_users": {
- "name": "organization_users",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "organization_id": {
- "name": "organization_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "role": {
- "name": "role",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": "'member'"
- }
- },
- "indexes": {},
- "foreignKeys": {
- "organization_users_user_id_users_id_fk": {
- "name": "organization_users_user_id_users_id_fk",
- "tableFrom": "organization_users",
- "tableTo": "users",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "organization_users_organization_id_organizations_id_fk": {
- "name": "organization_users_organization_id_organizations_id_fk",
- "tableFrom": "organization_users",
- "tableTo": "organizations",
- "columnsFrom": [
- "organization_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "organizations": {
- "name": "organizations",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- }
- },
- "indexes": {},
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "user_roles": {
- "name": "user_roles",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "role": {
- "name": "role",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- }
- },
- "indexes": {
- "user_roles_role_index": {
- "name": "user_roles_role_index",
- "columns": [
- "role"
- ],
- "isUnique": false
- },
- "user_roles_user_id_role_unique_index": {
- "name": "user_roles_user_id_role_unique_index",
- "columns": [
- "user_id",
- "role"
- ],
- "isUnique": true
- }
- },
- "foreignKeys": {
- "user_roles_user_id_users_id_fk": {
- "name": "user_roles_user_id_users_id_fk",
- "tableFrom": "user_roles",
- "tableTo": "users",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "documents_tags": {
- "name": "documents_tags",
- "columns": {
- "document_id": {
- "name": "document_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "tag_id": {
- "name": "tag_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- }
- },
- "indexes": {},
- "foreignKeys": {
- "documents_tags_document_id_documents_id_fk": {
- "name": "documents_tags_document_id_documents_id_fk",
- "tableFrom": "documents_tags",
- "tableTo": "documents",
- "columnsFrom": [
- "document_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "documents_tags_tag_id_tags_id_fk": {
- "name": "documents_tags_tag_id_tags_id_fk",
- "tableFrom": "documents_tags",
- "tableTo": "tags",
- "columnsFrom": [
- "tag_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {
- "documents_tags_pkey": {
- "columns": [
- "document_id",
- "tag_id"
- ],
- "name": "documents_tags_pkey"
- }
- },
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "tags": {
- "name": "tags",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "organization_id": {
- "name": "organization_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "color": {
- "name": "color",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "description": {
- "name": "description",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- }
- },
- "indexes": {
- "tags_organization_id_name_unique": {
- "name": "tags_organization_id_name_unique",
- "columns": [
- "organization_id",
- "name"
- ],
- "isUnique": true
- }
- },
- "foreignKeys": {
- "tags_organization_id_organizations_id_fk": {
- "name": "tags_organization_id_organizations_id_fk",
- "tableFrom": "tags",
- "tableTo": "organizations",
- "columnsFrom": [
- "organization_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "users": {
- "name": "users",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "email": {
- "name": "email",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "email_verified": {
- "name": "email_verified",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": false
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "image": {
- "name": "image",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- }
- },
- "indexes": {
- "users_email_unique": {
- "name": "users_email_unique",
- "columns": [
- "email"
- ],
- "isUnique": true
- },
- "users_email_index": {
- "name": "users_email_index",
- "columns": [
- "email"
- ],
- "isUnique": false
- }
- },
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "auth_accounts": {
- "name": "auth_accounts",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "account_id": {
- "name": "account_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "provider_id": {
- "name": "provider_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "access_token": {
- "name": "access_token",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "refresh_token": {
- "name": "refresh_token",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "access_token_expires_at": {
- "name": "access_token_expires_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "refresh_token_expires_at": {
- "name": "refresh_token_expires_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "scope": {
- "name": "scope",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "id_token": {
- "name": "id_token",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "password": {
- "name": "password",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- }
- },
- "indexes": {},
- "foreignKeys": {
- "auth_accounts_user_id_users_id_fk": {
- "name": "auth_accounts_user_id_users_id_fk",
- "tableFrom": "auth_accounts",
- "tableTo": "users",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "auth_sessions": {
- "name": "auth_sessions",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "token": {
- "name": "token",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "expires_at": {
- "name": "expires_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "ip_address": {
- "name": "ip_address",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "user_agent": {
- "name": "user_agent",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- }
- },
- "indexes": {
- "auth_sessions_token_index": {
- "name": "auth_sessions_token_index",
- "columns": [
- "token"
- ],
- "isUnique": false
- }
- },
- "foreignKeys": {
- "auth_sessions_user_id_users_id_fk": {
- "name": "auth_sessions_user_id_users_id_fk",
- "tableFrom": "auth_sessions",
- "tableTo": "users",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "auth_verifications": {
- "name": "auth_verifications",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "identifier": {
- "name": "identifier",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "value": {
- "name": "value",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "expires_at": {
- "name": "expires_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- }
- },
- "indexes": {
- "auth_verifications_identifier_index": {
- "name": "auth_verifications_identifier_index",
- "columns": [
- "identifier"
- ],
- "isUnique": false
- }
- },
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "intake_emails": {
- "name": "intake_emails",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "email_address": {
- "name": "email_address",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "organization_id": {
- "name": "organization_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "allowed_origins": {
- "name": "allowed_origins",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": "'[]'"
- },
- "is_enabled": {
- "name": "is_enabled",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": true
- }
- },
- "indexes": {
- "intake_emails_email_address_unique": {
- "name": "intake_emails_email_address_unique",
- "columns": [
- "email_address"
- ],
- "isUnique": true
- }
- },
- "foreignKeys": {
- "intake_emails_organization_id_organizations_id_fk": {
- "name": "intake_emails_organization_id_organizations_id_fk",
- "tableFrom": "intake_emails",
- "tableTo": "organizations",
- "columnsFrom": [
- "organization_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- }
- },
- "views": {},
- "enums": {},
- "_meta": {
- "schemas": {},
- "tables": {},
- "columns": {}
- },
- "internal": {
- "indexes": {}
- }
-}
diff --git a/apps/papra-server/migrations/meta/0007_snapshot.json b/apps/papra-server/migrations/meta/0007_snapshot.json
deleted file mode 100644
index 3a4201cd..00000000
--- a/apps/papra-server/migrations/meta/0007_snapshot.json
+++ /dev/null
@@ -1,1114 +0,0 @@
-{
- "version": "6",
- "dialect": "sqlite",
- "id": "9b09b239-2e25-432a-9500-553dad6e2be2",
- "prevId": "b63753f1-78a4-4d56-bc18-52634b7f2401",
- "tables": {
- "documents": {
- "name": "documents",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "is_deleted": {
- "name": "is_deleted",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": false
- },
- "deleted_at": {
- "name": "deleted_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "organization_id": {
- "name": "organization_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "created_by": {
- "name": "created_by",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "deleted_by": {
- "name": "deleted_by",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "original_name": {
- "name": "original_name",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "original_size": {
- "name": "original_size",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": 0
- },
- "original_storage_key": {
- "name": "original_storage_key",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "original_sha256_hash": {
- "name": "original_sha256_hash",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "mime_type": {
- "name": "mime_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "content": {
- "name": "content",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": "''"
- }
- },
- "indexes": {
- "documents_organization_id_is_deleted_created_at_index": {
- "name": "documents_organization_id_is_deleted_created_at_index",
- "columns": [
- "organization_id",
- "is_deleted",
- "created_at"
- ],
- "isUnique": false
- },
- "documents_organization_id_is_deleted_index": {
- "name": "documents_organization_id_is_deleted_index",
- "columns": [
- "organization_id",
- "is_deleted"
- ],
- "isUnique": false
- },
- "documents_organization_id_original_sha256_hash_unique": {
- "name": "documents_organization_id_original_sha256_hash_unique",
- "columns": [
- "organization_id",
- "original_sha256_hash"
- ],
- "isUnique": true
- },
- "documents_original_sha256_hash_index": {
- "name": "documents_original_sha256_hash_index",
- "columns": [
- "original_sha256_hash"
- ],
- "isUnique": false
- }
- },
- "foreignKeys": {
- "documents_organization_id_organizations_id_fk": {
- "name": "documents_organization_id_organizations_id_fk",
- "tableFrom": "documents",
- "tableTo": "organizations",
- "columnsFrom": [
- "organization_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "documents_created_by_users_id_fk": {
- "name": "documents_created_by_users_id_fk",
- "tableFrom": "documents",
- "tableTo": "users",
- "columnsFrom": [
- "created_by"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "cascade"
- },
- "documents_deleted_by_users_id_fk": {
- "name": "documents_deleted_by_users_id_fk",
- "tableFrom": "documents",
- "tableTo": "users",
- "columnsFrom": [
- "deleted_by"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "organization_invitations": {
- "name": "organization_invitations",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "organization_id": {
- "name": "organization_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "email": {
- "name": "email",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "role": {
- "name": "role",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "expires_at": {
- "name": "expires_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "inviter_id": {
- "name": "inviter_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- }
- },
- "indexes": {},
- "foreignKeys": {
- "organization_invitations_organization_id_organizations_id_fk": {
- "name": "organization_invitations_organization_id_organizations_id_fk",
- "tableFrom": "organization_invitations",
- "tableTo": "organizations",
- "columnsFrom": [
- "organization_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "organization_invitations_inviter_id_users_id_fk": {
- "name": "organization_invitations_inviter_id_users_id_fk",
- "tableFrom": "organization_invitations",
- "tableTo": "users",
- "columnsFrom": [
- "inviter_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "organization_members": {
- "name": "organization_members",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "organization_id": {
- "name": "organization_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "role": {
- "name": "role",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- }
- },
- "indexes": {},
- "foreignKeys": {
- "organization_members_organization_id_organizations_id_fk": {
- "name": "organization_members_organization_id_organizations_id_fk",
- "tableFrom": "organization_members",
- "tableTo": "organizations",
- "columnsFrom": [
- "organization_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "organization_members_user_id_users_id_fk": {
- "name": "organization_members_user_id_users_id_fk",
- "tableFrom": "organization_members",
- "tableTo": "users",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "organizations": {
- "name": "organizations",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "slug": {
- "name": "slug",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "logo": {
- "name": "logo",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "metadata": {
- "name": "metadata",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- }
- },
- "indexes": {
- "organizations_slug_unique": {
- "name": "organizations_slug_unique",
- "columns": [
- "slug"
- ],
- "isUnique": true
- }
- },
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "user_roles": {
- "name": "user_roles",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "role": {
- "name": "role",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- }
- },
- "indexes": {
- "user_roles_role_index": {
- "name": "user_roles_role_index",
- "columns": [
- "role"
- ],
- "isUnique": false
- },
- "user_roles_user_id_role_unique_index": {
- "name": "user_roles_user_id_role_unique_index",
- "columns": [
- "user_id",
- "role"
- ],
- "isUnique": true
- }
- },
- "foreignKeys": {
- "user_roles_user_id_users_id_fk": {
- "name": "user_roles_user_id_users_id_fk",
- "tableFrom": "user_roles",
- "tableTo": "users",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "documents_tags": {
- "name": "documents_tags",
- "columns": {
- "document_id": {
- "name": "document_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "tag_id": {
- "name": "tag_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- }
- },
- "indexes": {},
- "foreignKeys": {
- "documents_tags_document_id_documents_id_fk": {
- "name": "documents_tags_document_id_documents_id_fk",
- "tableFrom": "documents_tags",
- "tableTo": "documents",
- "columnsFrom": [
- "document_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "documents_tags_tag_id_tags_id_fk": {
- "name": "documents_tags_tag_id_tags_id_fk",
- "tableFrom": "documents_tags",
- "tableTo": "tags",
- "columnsFrom": [
- "tag_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {
- "documents_tags_pkey": {
- "columns": [
- "document_id",
- "tag_id"
- ],
- "name": "documents_tags_pkey"
- }
- },
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "tags": {
- "name": "tags",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "organization_id": {
- "name": "organization_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "color": {
- "name": "color",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "description": {
- "name": "description",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- }
- },
- "indexes": {
- "tags_organization_id_name_unique": {
- "name": "tags_organization_id_name_unique",
- "columns": [
- "organization_id",
- "name"
- ],
- "isUnique": true
- }
- },
- "foreignKeys": {
- "tags_organization_id_organizations_id_fk": {
- "name": "tags_organization_id_organizations_id_fk",
- "tableFrom": "tags",
- "tableTo": "organizations",
- "columnsFrom": [
- "organization_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "users": {
- "name": "users",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "email": {
- "name": "email",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "email_verified": {
- "name": "email_verified",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": false
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "image": {
- "name": "image",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- }
- },
- "indexes": {
- "users_email_unique": {
- "name": "users_email_unique",
- "columns": [
- "email"
- ],
- "isUnique": true
- },
- "users_email_index": {
- "name": "users_email_index",
- "columns": [
- "email"
- ],
- "isUnique": false
- }
- },
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "auth_accounts": {
- "name": "auth_accounts",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "account_id": {
- "name": "account_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "provider_id": {
- "name": "provider_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "access_token": {
- "name": "access_token",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "refresh_token": {
- "name": "refresh_token",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "access_token_expires_at": {
- "name": "access_token_expires_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "refresh_token_expires_at": {
- "name": "refresh_token_expires_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "scope": {
- "name": "scope",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "id_token": {
- "name": "id_token",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "password": {
- "name": "password",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- }
- },
- "indexes": {},
- "foreignKeys": {
- "auth_accounts_user_id_users_id_fk": {
- "name": "auth_accounts_user_id_users_id_fk",
- "tableFrom": "auth_accounts",
- "tableTo": "users",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "auth_sessions": {
- "name": "auth_sessions",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "token": {
- "name": "token",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "expires_at": {
- "name": "expires_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "ip_address": {
- "name": "ip_address",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "user_agent": {
- "name": "user_agent",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "active_organization_id": {
- "name": "active_organization_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- }
- },
- "indexes": {
- "auth_sessions_token_index": {
- "name": "auth_sessions_token_index",
- "columns": [
- "token"
- ],
- "isUnique": false
- }
- },
- "foreignKeys": {
- "auth_sessions_user_id_users_id_fk": {
- "name": "auth_sessions_user_id_users_id_fk",
- "tableFrom": "auth_sessions",
- "tableTo": "users",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "auth_sessions_active_organization_id_organizations_id_fk": {
- "name": "auth_sessions_active_organization_id_organizations_id_fk",
- "tableFrom": "auth_sessions",
- "tableTo": "organizations",
- "columnsFrom": [
- "active_organization_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "auth_verifications": {
- "name": "auth_verifications",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "identifier": {
- "name": "identifier",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "value": {
- "name": "value",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "expires_at": {
- "name": "expires_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- }
- },
- "indexes": {
- "auth_verifications_identifier_index": {
- "name": "auth_verifications_identifier_index",
- "columns": [
- "identifier"
- ],
- "isUnique": false
- }
- },
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "intake_emails": {
- "name": "intake_emails",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "email_address": {
- "name": "email_address",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "organization_id": {
- "name": "organization_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "allowed_origins": {
- "name": "allowed_origins",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": "'[]'"
- },
- "is_enabled": {
- "name": "is_enabled",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": true
- }
- },
- "indexes": {
- "intake_emails_email_address_unique": {
- "name": "intake_emails_email_address_unique",
- "columns": [
- "email_address"
- ],
- "isUnique": true
- }
- },
- "foreignKeys": {
- "intake_emails_organization_id_organizations_id_fk": {
- "name": "intake_emails_organization_id_organizations_id_fk",
- "tableFrom": "intake_emails",
- "tableTo": "organizations",
- "columnsFrom": [
- "organization_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- }
- },
- "views": {},
- "enums": {},
- "_meta": {
- "schemas": {},
- "tables": {
- "\"organization_users\"": "\"organization_members\""
- },
- "columns": {}
- },
- "internal": {
- "indexes": {}
- }
-}
diff --git a/apps/papra-server/migrations/meta/0008_snapshot.json b/apps/papra-server/migrations/meta/0008_snapshot.json
deleted file mode 100644
index 352ee272..00000000
--- a/apps/papra-server/migrations/meta/0008_snapshot.json
+++ /dev/null
@@ -1,1215 +0,0 @@
-{
- "version": "6",
- "dialect": "sqlite",
- "id": "6c1b50c4-dfbb-4068-9c6a-468d6cf45040",
- "prevId": "9b09b239-2e25-432a-9500-553dad6e2be2",
- "tables": {
- "documents": {
- "name": "documents",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "is_deleted": {
- "name": "is_deleted",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": false
- },
- "deleted_at": {
- "name": "deleted_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "organization_id": {
- "name": "organization_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "created_by": {
- "name": "created_by",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "deleted_by": {
- "name": "deleted_by",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "original_name": {
- "name": "original_name",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "original_size": {
- "name": "original_size",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": 0
- },
- "original_storage_key": {
- "name": "original_storage_key",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "original_sha256_hash": {
- "name": "original_sha256_hash",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "mime_type": {
- "name": "mime_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "content": {
- "name": "content",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": "''"
- }
- },
- "indexes": {
- "documents_organization_id_is_deleted_created_at_index": {
- "name": "documents_organization_id_is_deleted_created_at_index",
- "columns": [
- "organization_id",
- "is_deleted",
- "created_at"
- ],
- "isUnique": false
- },
- "documents_organization_id_is_deleted_index": {
- "name": "documents_organization_id_is_deleted_index",
- "columns": [
- "organization_id",
- "is_deleted"
- ],
- "isUnique": false
- },
- "documents_organization_id_original_sha256_hash_unique": {
- "name": "documents_organization_id_original_sha256_hash_unique",
- "columns": [
- "organization_id",
- "original_sha256_hash"
- ],
- "isUnique": true
- },
- "documents_original_sha256_hash_index": {
- "name": "documents_original_sha256_hash_index",
- "columns": [
- "original_sha256_hash"
- ],
- "isUnique": false
- }
- },
- "foreignKeys": {
- "documents_organization_id_organizations_id_fk": {
- "name": "documents_organization_id_organizations_id_fk",
- "tableFrom": "documents",
- "tableTo": "organizations",
- "columnsFrom": [
- "organization_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "documents_created_by_users_id_fk": {
- "name": "documents_created_by_users_id_fk",
- "tableFrom": "documents",
- "tableTo": "users",
- "columnsFrom": [
- "created_by"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "cascade"
- },
- "documents_deleted_by_users_id_fk": {
- "name": "documents_deleted_by_users_id_fk",
- "tableFrom": "documents",
- "tableTo": "users",
- "columnsFrom": [
- "deleted_by"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "organization_invitations": {
- "name": "organization_invitations",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "organization_id": {
- "name": "organization_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "email": {
- "name": "email",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "role": {
- "name": "role",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "expires_at": {
- "name": "expires_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "inviter_id": {
- "name": "inviter_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- }
- },
- "indexes": {},
- "foreignKeys": {
- "organization_invitations_organization_id_organizations_id_fk": {
- "name": "organization_invitations_organization_id_organizations_id_fk",
- "tableFrom": "organization_invitations",
- "tableTo": "organizations",
- "columnsFrom": [
- "organization_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "organization_invitations_inviter_id_users_id_fk": {
- "name": "organization_invitations_inviter_id_users_id_fk",
- "tableFrom": "organization_invitations",
- "tableTo": "users",
- "columnsFrom": [
- "inviter_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "organization_members": {
- "name": "organization_members",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "organization_id": {
- "name": "organization_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "role": {
- "name": "role",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- }
- },
- "indexes": {
- "organization_members_user_organization_unique": {
- "name": "organization_members_user_organization_unique",
- "columns": [
- "organization_id",
- "user_id"
- ],
- "isUnique": true
- }
- },
- "foreignKeys": {
- "organization_members_organization_id_organizations_id_fk": {
- "name": "organization_members_organization_id_organizations_id_fk",
- "tableFrom": "organization_members",
- "tableTo": "organizations",
- "columnsFrom": [
- "organization_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "organization_members_user_id_users_id_fk": {
- "name": "organization_members_user_id_users_id_fk",
- "tableFrom": "organization_members",
- "tableTo": "users",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "organizations": {
- "name": "organizations",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- }
- },
- "indexes": {},
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "user_roles": {
- "name": "user_roles",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "role": {
- "name": "role",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- }
- },
- "indexes": {
- "user_roles_role_index": {
- "name": "user_roles_role_index",
- "columns": [
- "role"
- ],
- "isUnique": false
- },
- "user_roles_user_id_role_unique_index": {
- "name": "user_roles_user_id_role_unique_index",
- "columns": [
- "user_id",
- "role"
- ],
- "isUnique": true
- }
- },
- "foreignKeys": {
- "user_roles_user_id_users_id_fk": {
- "name": "user_roles_user_id_users_id_fk",
- "tableFrom": "user_roles",
- "tableTo": "users",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "documents_tags": {
- "name": "documents_tags",
- "columns": {
- "document_id": {
- "name": "document_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "tag_id": {
- "name": "tag_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- }
- },
- "indexes": {},
- "foreignKeys": {
- "documents_tags_document_id_documents_id_fk": {
- "name": "documents_tags_document_id_documents_id_fk",
- "tableFrom": "documents_tags",
- "tableTo": "documents",
- "columnsFrom": [
- "document_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "documents_tags_tag_id_tags_id_fk": {
- "name": "documents_tags_tag_id_tags_id_fk",
- "tableFrom": "documents_tags",
- "tableTo": "tags",
- "columnsFrom": [
- "tag_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {
- "documents_tags_pkey": {
- "columns": [
- "document_id",
- "tag_id"
- ],
- "name": "documents_tags_pkey"
- }
- },
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "tags": {
- "name": "tags",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "organization_id": {
- "name": "organization_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "color": {
- "name": "color",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "description": {
- "name": "description",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- }
- },
- "indexes": {
- "tags_organization_id_name_unique": {
- "name": "tags_organization_id_name_unique",
- "columns": [
- "organization_id",
- "name"
- ],
- "isUnique": true
- }
- },
- "foreignKeys": {
- "tags_organization_id_organizations_id_fk": {
- "name": "tags_organization_id_organizations_id_fk",
- "tableFrom": "tags",
- "tableTo": "organizations",
- "columnsFrom": [
- "organization_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "users": {
- "name": "users",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "email": {
- "name": "email",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "email_verified": {
- "name": "email_verified",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": false
- },
- "customer_id": {
- "name": "customer_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "image": {
- "name": "image",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "max_organization_count": {
- "name": "max_organization_count",
- "type": "integer",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- }
- },
- "indexes": {
- "users_email_unique": {
- "name": "users_email_unique",
- "columns": [
- "email"
- ],
- "isUnique": true
- },
- "users_customer_id_unique": {
- "name": "users_customer_id_unique",
- "columns": [
- "customer_id"
- ],
- "isUnique": true
- },
- "users_email_index": {
- "name": "users_email_index",
- "columns": [
- "email"
- ],
- "isUnique": false
- }
- },
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "auth_accounts": {
- "name": "auth_accounts",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "account_id": {
- "name": "account_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "provider_id": {
- "name": "provider_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "access_token": {
- "name": "access_token",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "refresh_token": {
- "name": "refresh_token",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "access_token_expires_at": {
- "name": "access_token_expires_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "refresh_token_expires_at": {
- "name": "refresh_token_expires_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "scope": {
- "name": "scope",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "id_token": {
- "name": "id_token",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "password": {
- "name": "password",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- }
- },
- "indexes": {},
- "foreignKeys": {
- "auth_accounts_user_id_users_id_fk": {
- "name": "auth_accounts_user_id_users_id_fk",
- "tableFrom": "auth_accounts",
- "tableTo": "users",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "auth_sessions": {
- "name": "auth_sessions",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "token": {
- "name": "token",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "expires_at": {
- "name": "expires_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "ip_address": {
- "name": "ip_address",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "user_agent": {
- "name": "user_agent",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "active_organization_id": {
- "name": "active_organization_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- }
- },
- "indexes": {
- "auth_sessions_token_index": {
- "name": "auth_sessions_token_index",
- "columns": [
- "token"
- ],
- "isUnique": false
- }
- },
- "foreignKeys": {
- "auth_sessions_user_id_users_id_fk": {
- "name": "auth_sessions_user_id_users_id_fk",
- "tableFrom": "auth_sessions",
- "tableTo": "users",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "auth_sessions_active_organization_id_organizations_id_fk": {
- "name": "auth_sessions_active_organization_id_organizations_id_fk",
- "tableFrom": "auth_sessions",
- "tableTo": "organizations",
- "columnsFrom": [
- "active_organization_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "auth_verifications": {
- "name": "auth_verifications",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "identifier": {
- "name": "identifier",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "value": {
- "name": "value",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "expires_at": {
- "name": "expires_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- }
- },
- "indexes": {
- "auth_verifications_identifier_index": {
- "name": "auth_verifications_identifier_index",
- "columns": [
- "identifier"
- ],
- "isUnique": false
- }
- },
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "intake_emails": {
- "name": "intake_emails",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "email_address": {
- "name": "email_address",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "organization_id": {
- "name": "organization_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "allowed_origins": {
- "name": "allowed_origins",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": "'[]'"
- },
- "is_enabled": {
- "name": "is_enabled",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": true
- }
- },
- "indexes": {
- "intake_emails_email_address_unique": {
- "name": "intake_emails_email_address_unique",
- "columns": [
- "email_address"
- ],
- "isUnique": true
- }
- },
- "foreignKeys": {
- "intake_emails_organization_id_organizations_id_fk": {
- "name": "intake_emails_organization_id_organizations_id_fk",
- "tableFrom": "intake_emails",
- "tableTo": "organizations",
- "columnsFrom": [
- "organization_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "organization_subscriptions": {
- "name": "organization_subscriptions",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "organization_id": {
- "name": "organization_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "plan_id": {
- "name": "plan_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "stripe_subscription_id": {
- "name": "stripe_subscription_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "stripe_customer_id": {
- "name": "stripe_customer_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "current_period_end": {
- "name": "current_period_end",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "current_period_start": {
- "name": "current_period_start",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "cancel_at_period_end": {
- "name": "cancel_at_period_end",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": false
- }
- },
- "indexes": {},
- "foreignKeys": {
- "organization_subscriptions_organization_id_organizations_id_fk": {
- "name": "organization_subscriptions_organization_id_organizations_id_fk",
- "tableFrom": "organization_subscriptions",
- "tableTo": "organizations",
- "columnsFrom": [
- "organization_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- }
- },
- "views": {},
- "enums": {},
- "_meta": {
- "schemas": {},
- "tables": {},
- "columns": {}
- },
- "internal": {
- "indexes": {}
- }
-}
diff --git a/apps/papra-server/migrations/meta/0009_snapshot.json b/apps/papra-server/migrations/meta/0009_snapshot.json
deleted file mode 100644
index 4fc91b52..00000000
--- a/apps/papra-server/migrations/meta/0009_snapshot.json
+++ /dev/null
@@ -1,1230 +0,0 @@
-{
- "version": "6",
- "dialect": "sqlite",
- "id": "1768e474-bea5-49ef-b2c9-6a4b05e1a949",
- "prevId": "6c1b50c4-dfbb-4068-9c6a-468d6cf45040",
- "tables": {
- "documents": {
- "name": "documents",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "is_deleted": {
- "name": "is_deleted",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": false
- },
- "deleted_at": {
- "name": "deleted_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "organization_id": {
- "name": "organization_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "created_by": {
- "name": "created_by",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "deleted_by": {
- "name": "deleted_by",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "original_name": {
- "name": "original_name",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "original_size": {
- "name": "original_size",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": 0
- },
- "original_storage_key": {
- "name": "original_storage_key",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "original_sha256_hash": {
- "name": "original_sha256_hash",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "mime_type": {
- "name": "mime_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "content": {
- "name": "content",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": "''"
- }
- },
- "indexes": {
- "documents_organization_id_is_deleted_created_at_index": {
- "name": "documents_organization_id_is_deleted_created_at_index",
- "columns": [
- "organization_id",
- "is_deleted",
- "created_at"
- ],
- "isUnique": false
- },
- "documents_organization_id_is_deleted_index": {
- "name": "documents_organization_id_is_deleted_index",
- "columns": [
- "organization_id",
- "is_deleted"
- ],
- "isUnique": false
- },
- "documents_organization_id_original_sha256_hash_unique": {
- "name": "documents_organization_id_original_sha256_hash_unique",
- "columns": [
- "organization_id",
- "original_sha256_hash"
- ],
- "isUnique": true
- },
- "documents_original_sha256_hash_index": {
- "name": "documents_original_sha256_hash_index",
- "columns": [
- "original_sha256_hash"
- ],
- "isUnique": false
- },
- "documents_organization_id_size_index": {
- "name": "documents_organization_id_size_index",
- "columns": [
- "organization_id",
- "original_size"
- ],
- "isUnique": false
- }
- },
- "foreignKeys": {
- "documents_organization_id_organizations_id_fk": {
- "name": "documents_organization_id_organizations_id_fk",
- "tableFrom": "documents",
- "tableTo": "organizations",
- "columnsFrom": [
- "organization_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "documents_created_by_users_id_fk": {
- "name": "documents_created_by_users_id_fk",
- "tableFrom": "documents",
- "tableTo": "users",
- "columnsFrom": [
- "created_by"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "cascade"
- },
- "documents_deleted_by_users_id_fk": {
- "name": "documents_deleted_by_users_id_fk",
- "tableFrom": "documents",
- "tableTo": "users",
- "columnsFrom": [
- "deleted_by"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "organization_invitations": {
- "name": "organization_invitations",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "organization_id": {
- "name": "organization_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "email": {
- "name": "email",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "role": {
- "name": "role",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "expires_at": {
- "name": "expires_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "inviter_id": {
- "name": "inviter_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- }
- },
- "indexes": {},
- "foreignKeys": {
- "organization_invitations_organization_id_organizations_id_fk": {
- "name": "organization_invitations_organization_id_organizations_id_fk",
- "tableFrom": "organization_invitations",
- "tableTo": "organizations",
- "columnsFrom": [
- "organization_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "organization_invitations_inviter_id_users_id_fk": {
- "name": "organization_invitations_inviter_id_users_id_fk",
- "tableFrom": "organization_invitations",
- "tableTo": "users",
- "columnsFrom": [
- "inviter_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "organization_members": {
- "name": "organization_members",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "organization_id": {
- "name": "organization_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "role": {
- "name": "role",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- }
- },
- "indexes": {
- "organization_members_user_organization_unique": {
- "name": "organization_members_user_organization_unique",
- "columns": [
- "organization_id",
- "user_id"
- ],
- "isUnique": true
- }
- },
- "foreignKeys": {
- "organization_members_organization_id_organizations_id_fk": {
- "name": "organization_members_organization_id_organizations_id_fk",
- "tableFrom": "organization_members",
- "tableTo": "organizations",
- "columnsFrom": [
- "organization_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "organization_members_user_id_users_id_fk": {
- "name": "organization_members_user_id_users_id_fk",
- "tableFrom": "organization_members",
- "tableTo": "users",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "organizations": {
- "name": "organizations",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- }
- },
- "indexes": {},
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "user_roles": {
- "name": "user_roles",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "role": {
- "name": "role",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- }
- },
- "indexes": {
- "user_roles_role_index": {
- "name": "user_roles_role_index",
- "columns": [
- "role"
- ],
- "isUnique": false
- },
- "user_roles_user_id_role_unique_index": {
- "name": "user_roles_user_id_role_unique_index",
- "columns": [
- "user_id",
- "role"
- ],
- "isUnique": true
- }
- },
- "foreignKeys": {
- "user_roles_user_id_users_id_fk": {
- "name": "user_roles_user_id_users_id_fk",
- "tableFrom": "user_roles",
- "tableTo": "users",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "documents_tags": {
- "name": "documents_tags",
- "columns": {
- "document_id": {
- "name": "document_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "tag_id": {
- "name": "tag_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- }
- },
- "indexes": {},
- "foreignKeys": {
- "documents_tags_document_id_documents_id_fk": {
- "name": "documents_tags_document_id_documents_id_fk",
- "tableFrom": "documents_tags",
- "tableTo": "documents",
- "columnsFrom": [
- "document_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "documents_tags_tag_id_tags_id_fk": {
- "name": "documents_tags_tag_id_tags_id_fk",
- "tableFrom": "documents_tags",
- "tableTo": "tags",
- "columnsFrom": [
- "tag_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {
- "documents_tags_pkey": {
- "columns": [
- "document_id",
- "tag_id"
- ],
- "name": "documents_tags_pkey"
- }
- },
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "tags": {
- "name": "tags",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "organization_id": {
- "name": "organization_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "color": {
- "name": "color",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "description": {
- "name": "description",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- }
- },
- "indexes": {
- "tags_organization_id_name_unique": {
- "name": "tags_organization_id_name_unique",
- "columns": [
- "organization_id",
- "name"
- ],
- "isUnique": true
- }
- },
- "foreignKeys": {
- "tags_organization_id_organizations_id_fk": {
- "name": "tags_organization_id_organizations_id_fk",
- "tableFrom": "tags",
- "tableTo": "organizations",
- "columnsFrom": [
- "organization_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "users": {
- "name": "users",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "email": {
- "name": "email",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "email_verified": {
- "name": "email_verified",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": false
- },
- "customer_id": {
- "name": "customer_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "image": {
- "name": "image",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "max_organization_count": {
- "name": "max_organization_count",
- "type": "integer",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- }
- },
- "indexes": {
- "users_email_unique": {
- "name": "users_email_unique",
- "columns": [
- "email"
- ],
- "isUnique": true
- },
- "users_customer_id_unique": {
- "name": "users_customer_id_unique",
- "columns": [
- "customer_id"
- ],
- "isUnique": true
- },
- "users_email_index": {
- "name": "users_email_index",
- "columns": [
- "email"
- ],
- "isUnique": false
- }
- },
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "auth_accounts": {
- "name": "auth_accounts",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "account_id": {
- "name": "account_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "provider_id": {
- "name": "provider_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "access_token": {
- "name": "access_token",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "refresh_token": {
- "name": "refresh_token",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "access_token_expires_at": {
- "name": "access_token_expires_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "refresh_token_expires_at": {
- "name": "refresh_token_expires_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "scope": {
- "name": "scope",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "id_token": {
- "name": "id_token",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "password": {
- "name": "password",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- }
- },
- "indexes": {},
- "foreignKeys": {
- "auth_accounts_user_id_users_id_fk": {
- "name": "auth_accounts_user_id_users_id_fk",
- "tableFrom": "auth_accounts",
- "tableTo": "users",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "auth_sessions": {
- "name": "auth_sessions",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "token": {
- "name": "token",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "expires_at": {
- "name": "expires_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "ip_address": {
- "name": "ip_address",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "user_agent": {
- "name": "user_agent",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "active_organization_id": {
- "name": "active_organization_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- }
- },
- "indexes": {
- "auth_sessions_token_index": {
- "name": "auth_sessions_token_index",
- "columns": [
- "token"
- ],
- "isUnique": false
- }
- },
- "foreignKeys": {
- "auth_sessions_user_id_users_id_fk": {
- "name": "auth_sessions_user_id_users_id_fk",
- "tableFrom": "auth_sessions",
- "tableTo": "users",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "auth_sessions_active_organization_id_organizations_id_fk": {
- "name": "auth_sessions_active_organization_id_organizations_id_fk",
- "tableFrom": "auth_sessions",
- "tableTo": "organizations",
- "columnsFrom": [
- "active_organization_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "auth_verifications": {
- "name": "auth_verifications",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "identifier": {
- "name": "identifier",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "value": {
- "name": "value",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "expires_at": {
- "name": "expires_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- }
- },
- "indexes": {
- "auth_verifications_identifier_index": {
- "name": "auth_verifications_identifier_index",
- "columns": [
- "identifier"
- ],
- "isUnique": false
- }
- },
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "intake_emails": {
- "name": "intake_emails",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "email_address": {
- "name": "email_address",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "organization_id": {
- "name": "organization_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "allowed_origins": {
- "name": "allowed_origins",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": "'[]'"
- },
- "is_enabled": {
- "name": "is_enabled",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": true
- }
- },
- "indexes": {
- "intake_emails_email_address_unique": {
- "name": "intake_emails_email_address_unique",
- "columns": [
- "email_address"
- ],
- "isUnique": true
- }
- },
- "foreignKeys": {
- "intake_emails_organization_id_organizations_id_fk": {
- "name": "intake_emails_organization_id_organizations_id_fk",
- "tableFrom": "intake_emails",
- "tableTo": "organizations",
- "columnsFrom": [
- "organization_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "organization_subscriptions": {
- "name": "organization_subscriptions",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "organization_id": {
- "name": "organization_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "plan_id": {
- "name": "plan_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "stripe_subscription_id": {
- "name": "stripe_subscription_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "stripe_customer_id": {
- "name": "stripe_customer_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "seats_count": {
- "name": "seats_count",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "current_period_end": {
- "name": "current_period_end",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "current_period_start": {
- "name": "current_period_start",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "cancel_at_period_end": {
- "name": "cancel_at_period_end",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": false
- }
- },
- "indexes": {},
- "foreignKeys": {
- "organization_subscriptions_organization_id_organizations_id_fk": {
- "name": "organization_subscriptions_organization_id_organizations_id_fk",
- "tableFrom": "organization_subscriptions",
- "tableTo": "organizations",
- "columnsFrom": [
- "organization_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- }
- },
- "views": {},
- "enums": {},
- "_meta": {
- "schemas": {},
- "tables": {},
- "columns": {}
- },
- "internal": {
- "indexes": {}
- }
-}
diff --git a/apps/papra-server/migrations/meta/0010_snapshot.json b/apps/papra-server/migrations/meta/0010_snapshot.json
deleted file mode 100644
index a85ee914..00000000
--- a/apps/papra-server/migrations/meta/0010_snapshot.json
+++ /dev/null
@@ -1,1211 +0,0 @@
-{
- "version": "6",
- "dialect": "sqlite",
- "id": "7c18e991-3ae7-400a-9845-40a2e98a555c",
- "prevId": "1768e474-bea5-49ef-b2c9-6a4b05e1a949",
- "tables": {
- "documents": {
- "name": "documents",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "is_deleted": {
- "name": "is_deleted",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": false
- },
- "deleted_at": {
- "name": "deleted_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "organization_id": {
- "name": "organization_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "created_by": {
- "name": "created_by",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "deleted_by": {
- "name": "deleted_by",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "original_name": {
- "name": "original_name",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "original_size": {
- "name": "original_size",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": 0
- },
- "original_storage_key": {
- "name": "original_storage_key",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "original_sha256_hash": {
- "name": "original_sha256_hash",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "mime_type": {
- "name": "mime_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "content": {
- "name": "content",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": "''"
- }
- },
- "indexes": {
- "documents_organization_id_is_deleted_created_at_index": {
- "name": "documents_organization_id_is_deleted_created_at_index",
- "columns": [
- "organization_id",
- "is_deleted",
- "created_at"
- ],
- "isUnique": false
- },
- "documents_organization_id_is_deleted_index": {
- "name": "documents_organization_id_is_deleted_index",
- "columns": [
- "organization_id",
- "is_deleted"
- ],
- "isUnique": false
- },
- "documents_organization_id_original_sha256_hash_unique": {
- "name": "documents_organization_id_original_sha256_hash_unique",
- "columns": [
- "organization_id",
- "original_sha256_hash"
- ],
- "isUnique": true
- },
- "documents_original_sha256_hash_index": {
- "name": "documents_original_sha256_hash_index",
- "columns": [
- "original_sha256_hash"
- ],
- "isUnique": false
- },
- "documents_organization_id_size_index": {
- "name": "documents_organization_id_size_index",
- "columns": [
- "organization_id",
- "original_size"
- ],
- "isUnique": false
- }
- },
- "foreignKeys": {
- "documents_organization_id_organizations_id_fk": {
- "name": "documents_organization_id_organizations_id_fk",
- "tableFrom": "documents",
- "tableTo": "organizations",
- "columnsFrom": [
- "organization_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "documents_created_by_users_id_fk": {
- "name": "documents_created_by_users_id_fk",
- "tableFrom": "documents",
- "tableTo": "users",
- "columnsFrom": [
- "created_by"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "cascade"
- },
- "documents_deleted_by_users_id_fk": {
- "name": "documents_deleted_by_users_id_fk",
- "tableFrom": "documents",
- "tableTo": "users",
- "columnsFrom": [
- "deleted_by"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "organization_invitations": {
- "name": "organization_invitations",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "organization_id": {
- "name": "organization_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "email": {
- "name": "email",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "role": {
- "name": "role",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "expires_at": {
- "name": "expires_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "inviter_id": {
- "name": "inviter_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- }
- },
- "indexes": {},
- "foreignKeys": {
- "organization_invitations_organization_id_organizations_id_fk": {
- "name": "organization_invitations_organization_id_organizations_id_fk",
- "tableFrom": "organization_invitations",
- "tableTo": "organizations",
- "columnsFrom": [
- "organization_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "organization_invitations_inviter_id_users_id_fk": {
- "name": "organization_invitations_inviter_id_users_id_fk",
- "tableFrom": "organization_invitations",
- "tableTo": "users",
- "columnsFrom": [
- "inviter_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "organization_members": {
- "name": "organization_members",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "organization_id": {
- "name": "organization_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "role": {
- "name": "role",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- }
- },
- "indexes": {
- "organization_members_user_organization_unique": {
- "name": "organization_members_user_organization_unique",
- "columns": [
- "organization_id",
- "user_id"
- ],
- "isUnique": true
- }
- },
- "foreignKeys": {
- "organization_members_organization_id_organizations_id_fk": {
- "name": "organization_members_organization_id_organizations_id_fk",
- "tableFrom": "organization_members",
- "tableTo": "organizations",
- "columnsFrom": [
- "organization_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "organization_members_user_id_users_id_fk": {
- "name": "organization_members_user_id_users_id_fk",
- "tableFrom": "organization_members",
- "tableTo": "users",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "organizations": {
- "name": "organizations",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- }
- },
- "indexes": {},
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "user_roles": {
- "name": "user_roles",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "role": {
- "name": "role",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- }
- },
- "indexes": {
- "user_roles_role_index": {
- "name": "user_roles_role_index",
- "columns": [
- "role"
- ],
- "isUnique": false
- },
- "user_roles_user_id_role_unique_index": {
- "name": "user_roles_user_id_role_unique_index",
- "columns": [
- "user_id",
- "role"
- ],
- "isUnique": true
- }
- },
- "foreignKeys": {
- "user_roles_user_id_users_id_fk": {
- "name": "user_roles_user_id_users_id_fk",
- "tableFrom": "user_roles",
- "tableTo": "users",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "documents_tags": {
- "name": "documents_tags",
- "columns": {
- "document_id": {
- "name": "document_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "tag_id": {
- "name": "tag_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- }
- },
- "indexes": {},
- "foreignKeys": {
- "documents_tags_document_id_documents_id_fk": {
- "name": "documents_tags_document_id_documents_id_fk",
- "tableFrom": "documents_tags",
- "tableTo": "documents",
- "columnsFrom": [
- "document_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "documents_tags_tag_id_tags_id_fk": {
- "name": "documents_tags_tag_id_tags_id_fk",
- "tableFrom": "documents_tags",
- "tableTo": "tags",
- "columnsFrom": [
- "tag_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {
- "documents_tags_pkey": {
- "columns": [
- "document_id",
- "tag_id"
- ],
- "name": "documents_tags_pkey"
- }
- },
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "tags": {
- "name": "tags",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "organization_id": {
- "name": "organization_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "color": {
- "name": "color",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "description": {
- "name": "description",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- }
- },
- "indexes": {
- "tags_organization_id_name_unique": {
- "name": "tags_organization_id_name_unique",
- "columns": [
- "organization_id",
- "name"
- ],
- "isUnique": true
- }
- },
- "foreignKeys": {
- "tags_organization_id_organizations_id_fk": {
- "name": "tags_organization_id_organizations_id_fk",
- "tableFrom": "tags",
- "tableTo": "organizations",
- "columnsFrom": [
- "organization_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "users": {
- "name": "users",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "email": {
- "name": "email",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "email_verified": {
- "name": "email_verified",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": false
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "image": {
- "name": "image",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "max_organization_count": {
- "name": "max_organization_count",
- "type": "integer",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- }
- },
- "indexes": {
- "users_email_unique": {
- "name": "users_email_unique",
- "columns": [
- "email"
- ],
- "isUnique": true
- },
- "users_email_index": {
- "name": "users_email_index",
- "columns": [
- "email"
- ],
- "isUnique": false
- }
- },
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "auth_accounts": {
- "name": "auth_accounts",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "account_id": {
- "name": "account_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "provider_id": {
- "name": "provider_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "access_token": {
- "name": "access_token",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "refresh_token": {
- "name": "refresh_token",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "access_token_expires_at": {
- "name": "access_token_expires_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "refresh_token_expires_at": {
- "name": "refresh_token_expires_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "scope": {
- "name": "scope",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "id_token": {
- "name": "id_token",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "password": {
- "name": "password",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- }
- },
- "indexes": {},
- "foreignKeys": {
- "auth_accounts_user_id_users_id_fk": {
- "name": "auth_accounts_user_id_users_id_fk",
- "tableFrom": "auth_accounts",
- "tableTo": "users",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "auth_sessions": {
- "name": "auth_sessions",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "token": {
- "name": "token",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "expires_at": {
- "name": "expires_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "ip_address": {
- "name": "ip_address",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "user_agent": {
- "name": "user_agent",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "active_organization_id": {
- "name": "active_organization_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- }
- },
- "indexes": {
- "auth_sessions_token_index": {
- "name": "auth_sessions_token_index",
- "columns": [
- "token"
- ],
- "isUnique": false
- }
- },
- "foreignKeys": {
- "auth_sessions_user_id_users_id_fk": {
- "name": "auth_sessions_user_id_users_id_fk",
- "tableFrom": "auth_sessions",
- "tableTo": "users",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "auth_sessions_active_organization_id_organizations_id_fk": {
- "name": "auth_sessions_active_organization_id_organizations_id_fk",
- "tableFrom": "auth_sessions",
- "tableTo": "organizations",
- "columnsFrom": [
- "active_organization_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "auth_verifications": {
- "name": "auth_verifications",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "identifier": {
- "name": "identifier",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "value": {
- "name": "value",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "expires_at": {
- "name": "expires_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- }
- },
- "indexes": {
- "auth_verifications_identifier_index": {
- "name": "auth_verifications_identifier_index",
- "columns": [
- "identifier"
- ],
- "isUnique": false
- }
- },
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "intake_emails": {
- "name": "intake_emails",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "email_address": {
- "name": "email_address",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "organization_id": {
- "name": "organization_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "allowed_origins": {
- "name": "allowed_origins",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": "'[]'"
- },
- "is_enabled": {
- "name": "is_enabled",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": true
- }
- },
- "indexes": {
- "intake_emails_email_address_unique": {
- "name": "intake_emails_email_address_unique",
- "columns": [
- "email_address"
- ],
- "isUnique": true
- }
- },
- "foreignKeys": {
- "intake_emails_organization_id_organizations_id_fk": {
- "name": "intake_emails_organization_id_organizations_id_fk",
- "tableFrom": "intake_emails",
- "tableTo": "organizations",
- "columnsFrom": [
- "organization_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "organization_subscriptions": {
- "name": "organization_subscriptions",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "customer_id": {
- "name": "customer_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "organization_id": {
- "name": "organization_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "plan_id": {
- "name": "plan_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "seats_count": {
- "name": "seats_count",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "current_period_end": {
- "name": "current_period_end",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "current_period_start": {
- "name": "current_period_start",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "cancel_at_period_end": {
- "name": "cancel_at_period_end",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- }
- },
- "indexes": {},
- "foreignKeys": {
- "organization_subscriptions_organization_id_organizations_id_fk": {
- "name": "organization_subscriptions_organization_id_organizations_id_fk",
- "tableFrom": "organization_subscriptions",
- "tableTo": "organizations",
- "columnsFrom": [
- "organization_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- }
- },
- "views": {},
- "enums": {},
- "_meta": {
- "schemas": {},
- "tables": {},
- "columns": {
- "\"organization_subscriptions\".\"stripe_customer_id\"": "\"organization_subscriptions\".\"customer_id\""
- }
- },
- "internal": {
- "indexes": {}
- }
-}
diff --git a/apps/papra-server/migrations/meta/0011_snapshot.json b/apps/papra-server/migrations/meta/0011_snapshot.json
deleted file mode 100644
index 900905dd..00000000
--- a/apps/papra-server/migrations/meta/0011_snapshot.json
+++ /dev/null
@@ -1,1216 +0,0 @@
-{
- "version": "6",
- "dialect": "sqlite",
- "id": "9212b959-8c57-4df5-aeda-09c6e39a9062",
- "prevId": "7c18e991-3ae7-400a-9845-40a2e98a555c",
- "tables": {
- "documents": {
- "name": "documents",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "is_deleted": {
- "name": "is_deleted",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": false
- },
- "deleted_at": {
- "name": "deleted_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "organization_id": {
- "name": "organization_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "created_by": {
- "name": "created_by",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "deleted_by": {
- "name": "deleted_by",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "original_name": {
- "name": "original_name",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "original_size": {
- "name": "original_size",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": 0
- },
- "original_storage_key": {
- "name": "original_storage_key",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "original_sha256_hash": {
- "name": "original_sha256_hash",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "mime_type": {
- "name": "mime_type",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "content": {
- "name": "content",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": "''"
- }
- },
- "indexes": {
- "documents_organization_id_is_deleted_created_at_index": {
- "name": "documents_organization_id_is_deleted_created_at_index",
- "columns": [
- "organization_id",
- "is_deleted",
- "created_at"
- ],
- "isUnique": false
- },
- "documents_organization_id_is_deleted_index": {
- "name": "documents_organization_id_is_deleted_index",
- "columns": [
- "organization_id",
- "is_deleted"
- ],
- "isUnique": false
- },
- "documents_organization_id_original_sha256_hash_unique": {
- "name": "documents_organization_id_original_sha256_hash_unique",
- "columns": [
- "organization_id",
- "original_sha256_hash"
- ],
- "isUnique": true
- },
- "documents_original_sha256_hash_index": {
- "name": "documents_original_sha256_hash_index",
- "columns": [
- "original_sha256_hash"
- ],
- "isUnique": false
- },
- "documents_organization_id_size_index": {
- "name": "documents_organization_id_size_index",
- "columns": [
- "organization_id",
- "original_size"
- ],
- "isUnique": false
- }
- },
- "foreignKeys": {
- "documents_organization_id_organizations_id_fk": {
- "name": "documents_organization_id_organizations_id_fk",
- "tableFrom": "documents",
- "tableTo": "organizations",
- "columnsFrom": [
- "organization_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "documents_created_by_users_id_fk": {
- "name": "documents_created_by_users_id_fk",
- "tableFrom": "documents",
- "tableTo": "users",
- "columnsFrom": [
- "created_by"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "cascade"
- },
- "documents_deleted_by_users_id_fk": {
- "name": "documents_deleted_by_users_id_fk",
- "tableFrom": "documents",
- "tableTo": "users",
- "columnsFrom": [
- "deleted_by"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "organization_invitations": {
- "name": "organization_invitations",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "organization_id": {
- "name": "organization_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "email": {
- "name": "email",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "role": {
- "name": "role",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "expires_at": {
- "name": "expires_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "inviter_id": {
- "name": "inviter_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- }
- },
- "indexes": {},
- "foreignKeys": {
- "organization_invitations_organization_id_organizations_id_fk": {
- "name": "organization_invitations_organization_id_organizations_id_fk",
- "tableFrom": "organization_invitations",
- "tableTo": "organizations",
- "columnsFrom": [
- "organization_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "organization_invitations_inviter_id_users_id_fk": {
- "name": "organization_invitations_inviter_id_users_id_fk",
- "tableFrom": "organization_invitations",
- "tableTo": "users",
- "columnsFrom": [
- "inviter_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "organization_members": {
- "name": "organization_members",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "organization_id": {
- "name": "organization_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "role": {
- "name": "role",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- }
- },
- "indexes": {
- "organization_members_user_organization_unique": {
- "name": "organization_members_user_organization_unique",
- "columns": [
- "organization_id",
- "user_id"
- ],
- "isUnique": true
- }
- },
- "foreignKeys": {
- "organization_members_organization_id_organizations_id_fk": {
- "name": "organization_members_organization_id_organizations_id_fk",
- "tableFrom": "organization_members",
- "tableTo": "organizations",
- "columnsFrom": [
- "organization_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "organization_members_user_id_users_id_fk": {
- "name": "organization_members_user_id_users_id_fk",
- "tableFrom": "organization_members",
- "tableTo": "users",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "organizations": {
- "name": "organizations",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "customer_id": {
- "name": "customer_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- }
- },
- "indexes": {},
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "user_roles": {
- "name": "user_roles",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "role": {
- "name": "role",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- }
- },
- "indexes": {
- "user_roles_role_index": {
- "name": "user_roles_role_index",
- "columns": [
- "role"
- ],
- "isUnique": false
- },
- "user_roles_user_id_role_unique_index": {
- "name": "user_roles_user_id_role_unique_index",
- "columns": [
- "user_id",
- "role"
- ],
- "isUnique": true
- }
- },
- "foreignKeys": {
- "user_roles_user_id_users_id_fk": {
- "name": "user_roles_user_id_users_id_fk",
- "tableFrom": "user_roles",
- "tableTo": "users",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "documents_tags": {
- "name": "documents_tags",
- "columns": {
- "document_id": {
- "name": "document_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "tag_id": {
- "name": "tag_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- }
- },
- "indexes": {},
- "foreignKeys": {
- "documents_tags_document_id_documents_id_fk": {
- "name": "documents_tags_document_id_documents_id_fk",
- "tableFrom": "documents_tags",
- "tableTo": "documents",
- "columnsFrom": [
- "document_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "documents_tags_tag_id_tags_id_fk": {
- "name": "documents_tags_tag_id_tags_id_fk",
- "tableFrom": "documents_tags",
- "tableTo": "tags",
- "columnsFrom": [
- "tag_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {
- "documents_tags_pkey": {
- "columns": [
- "document_id",
- "tag_id"
- ],
- "name": "documents_tags_pkey"
- }
- },
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "tags": {
- "name": "tags",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "organization_id": {
- "name": "organization_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "color": {
- "name": "color",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "description": {
- "name": "description",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- }
- },
- "indexes": {
- "tags_organization_id_name_unique": {
- "name": "tags_organization_id_name_unique",
- "columns": [
- "organization_id",
- "name"
- ],
- "isUnique": true
- }
- },
- "foreignKeys": {
- "tags_organization_id_organizations_id_fk": {
- "name": "tags_organization_id_organizations_id_fk",
- "tableFrom": "tags",
- "tableTo": "organizations",
- "columnsFrom": [
- "organization_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "users": {
- "name": "users",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "email": {
- "name": "email",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "email_verified": {
- "name": "email_verified",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": false
- },
- "name": {
- "name": "name",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "image": {
- "name": "image",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "max_organization_count": {
- "name": "max_organization_count",
- "type": "integer",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- }
- },
- "indexes": {
- "users_email_unique": {
- "name": "users_email_unique",
- "columns": [
- "email"
- ],
- "isUnique": true
- },
- "users_email_index": {
- "name": "users_email_index",
- "columns": [
- "email"
- ],
- "isUnique": false
- }
- },
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "auth_accounts": {
- "name": "auth_accounts",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "account_id": {
- "name": "account_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "provider_id": {
- "name": "provider_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "access_token": {
- "name": "access_token",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "refresh_token": {
- "name": "refresh_token",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "access_token_expires_at": {
- "name": "access_token_expires_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "refresh_token_expires_at": {
- "name": "refresh_token_expires_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "scope": {
- "name": "scope",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "id_token": {
- "name": "id_token",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "password": {
- "name": "password",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- }
- },
- "indexes": {},
- "foreignKeys": {
- "auth_accounts_user_id_users_id_fk": {
- "name": "auth_accounts_user_id_users_id_fk",
- "tableFrom": "auth_accounts",
- "tableTo": "users",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "auth_sessions": {
- "name": "auth_sessions",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "token": {
- "name": "token",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "user_id": {
- "name": "user_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "expires_at": {
- "name": "expires_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "ip_address": {
- "name": "ip_address",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "user_agent": {
- "name": "user_agent",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- },
- "active_organization_id": {
- "name": "active_organization_id",
- "type": "text",
- "primaryKey": false,
- "notNull": false,
- "autoincrement": false
- }
- },
- "indexes": {
- "auth_sessions_token_index": {
- "name": "auth_sessions_token_index",
- "columns": [
- "token"
- ],
- "isUnique": false
- }
- },
- "foreignKeys": {
- "auth_sessions_user_id_users_id_fk": {
- "name": "auth_sessions_user_id_users_id_fk",
- "tableFrom": "auth_sessions",
- "tableTo": "users",
- "columnsFrom": [
- "user_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- },
- "auth_sessions_active_organization_id_organizations_id_fk": {
- "name": "auth_sessions_active_organization_id_organizations_id_fk",
- "tableFrom": "auth_sessions",
- "tableTo": "organizations",
- "columnsFrom": [
- "active_organization_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "set null",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "auth_verifications": {
- "name": "auth_verifications",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "identifier": {
- "name": "identifier",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "value": {
- "name": "value",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "expires_at": {
- "name": "expires_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- }
- },
- "indexes": {
- "auth_verifications_identifier_index": {
- "name": "auth_verifications_identifier_index",
- "columns": [
- "identifier"
- ],
- "isUnique": false
- }
- },
- "foreignKeys": {},
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "intake_emails": {
- "name": "intake_emails",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "email_address": {
- "name": "email_address",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "organization_id": {
- "name": "organization_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "allowed_origins": {
- "name": "allowed_origins",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": "'[]'"
- },
- "is_enabled": {
- "name": "is_enabled",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": true
- }
- },
- "indexes": {
- "intake_emails_email_address_unique": {
- "name": "intake_emails_email_address_unique",
- "columns": [
- "email_address"
- ],
- "isUnique": true
- }
- },
- "foreignKeys": {
- "intake_emails_organization_id_organizations_id_fk": {
- "name": "intake_emails_organization_id_organizations_id_fk",
- "tableFrom": "intake_emails",
- "tableTo": "organizations",
- "columnsFrom": [
- "organization_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- },
- "organization_subscriptions": {
- "name": "organization_subscriptions",
- "columns": {
- "id": {
- "name": "id",
- "type": "text",
- "primaryKey": true,
- "notNull": true,
- "autoincrement": false
- },
- "customer_id": {
- "name": "customer_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "organization_id": {
- "name": "organization_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "plan_id": {
- "name": "plan_id",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "status": {
- "name": "status",
- "type": "text",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "seats_count": {
- "name": "seats_count",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "current_period_end": {
- "name": "current_period_end",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "current_period_start": {
- "name": "current_period_start",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "cancel_at_period_end": {
- "name": "cancel_at_period_end",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false,
- "default": false
- },
- "created_at": {
- "name": "created_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- },
- "updated_at": {
- "name": "updated_at",
- "type": "integer",
- "primaryKey": false,
- "notNull": true,
- "autoincrement": false
- }
- },
- "indexes": {},
- "foreignKeys": {
- "organization_subscriptions_organization_id_organizations_id_fk": {
- "name": "organization_subscriptions_organization_id_organizations_id_fk",
- "tableFrom": "organization_subscriptions",
- "tableTo": "organizations",
- "columnsFrom": [
- "organization_id"
- ],
- "columnsTo": [
- "id"
- ],
- "onDelete": "cascade",
- "onUpdate": "cascade"
- }
- },
- "compositePrimaryKeys": {},
- "uniqueConstraints": {},
- "checkConstraints": {}
- }
- },
- "views": {},
- "enums": {},
- "_meta": {
- "schemas": {},
- "tables": {},
- "columns": {}
- },
- "internal": {
- "indexes": {}
- }
-}
diff --git a/apps/papra-server/migrations/meta/_journal.json b/apps/papra-server/migrations/meta/_journal.json
index a1a90cd2..f93b839b 100644
--- a/apps/papra-server/migrations/meta/_journal.json
+++ b/apps/papra-server/migrations/meta/_journal.json
@@ -5,86 +5,16 @@
{
"idx": 0,
"version": "6",
- "when": 1736857762863,
+ "when": 1743508385578,
"tag": "0000_initial_schema_setup",
"breakpoints": true
},
{
"idx": 1,
"version": "6",
- "when": 1736857770412,
+ "when": 1743508401881,
"tag": "0001_documents_fts",
"breakpoints": true
- },
- {
- "idx": 2,
- "version": "6",
- "when": 1737369265792,
- "tag": "0002_tags",
- "breakpoints": true
- },
- {
- "idx": 3,
- "version": "6",
- "when": 1737665080672,
- "tag": "0003_intake-emails",
- "breakpoints": true
- },
- {
- "idx": 4,
- "version": "6",
- "when": 1738706983829,
- "tag": "0004_auth-indexs",
- "breakpoints": true
- },
- {
- "idx": 5,
- "version": "6",
- "when": 1740570765157,
- "tag": "0005_intake-emails-addresses",
- "breakpoints": true
- },
- {
- "idx": 6,
- "version": "6",
- "when": 1740775396113,
- "tag": "0006_documents-hash",
- "breakpoints": true
- },
- {
- "idx": 7,
- "version": "6",
- "when": 1741343969980,
- "tag": "0007_better-auth-orgs",
- "breakpoints": true
- },
- {
- "idx": 8,
- "version": "6",
- "when": 1742246019130,
- "tag": "0008_max-user-organization-count",
- "breakpoints": true
- },
- {
- "idx": 9,
- "version": "6",
- "when": 1742335878357,
- "tag": "0009_subscriptions",
- "breakpoints": true
- },
- {
- "idx": 10,
- "version": "6",
- "when": 1742336671903,
- "tag": "0010_subscriptions-2",
- "breakpoints": true
- },
- {
- "idx": 11,
- "version": "6",
- "when": 1742339890093,
- "tag": "0011_orgs-customer-id",
- "breakpoints": true
}
]
}