{ "version": "6", "dialect": "sqlite", "id": "a04a2098-8e10-4234-9a68-54d23273439a", "prevId": "00000000-0000-0000-0000-000000000000", "tables": { "doc_snapshots": { "name": "doc_snapshots", "columns": { "page_id": { "name": "page_id", "type": "text", "primaryKey": true, "notNull": true, "autoincrement": false }, "yjs_state": { "name": "yjs_state", "type": "blob", "primaryKey": false, "notNull": true, "autoincrement": false }, "snapshot_at": { "name": "snapshot_at", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "(datetime('now'))" } }, "indexes": {}, "foreignKeys": { "doc_snapshots_page_id_pages_id_fk": { "name": "doc_snapshots_page_id_pages_id_fk", "tableFrom": "doc_snapshots", "tableTo": "pages", "columnsFrom": [ "page_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "invites": { "name": "invites", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true, "autoincrement": false }, "email": { "name": "email", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "workspace_id": { "name": "workspace_id", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "invited_by": { "name": "invited_by", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "role": { "name": "role", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "'member'" }, "token": { "name": "token", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "accepted_at": { "name": "accepted_at", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "accepted_by": { "name": "accepted_by", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "revoked_at": { "name": "revoked_at", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "expires_at": { "name": "expires_at", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "created_at": { "name": "created_at", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "(datetime('now'))" } }, "indexes": { "invites_token_unique": { "name": "invites_token_unique", "columns": [ "token" ], "isUnique": true }, "idx_invites_token": { "name": "idx_invites_token", "columns": [ "token" ], "isUnique": false }, "idx_invites_email": { "name": "idx_invites_email", "columns": [ "email" ], "isUnique": false } }, "foreignKeys": { "invites_workspace_id_workspaces_id_fk": { "name": "invites_workspace_id_workspaces_id_fk", "tableFrom": "invites", "tableTo": "workspaces", "columnsFrom": [ "workspace_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" }, "invites_invited_by_users_id_fk": { "name": "invites_invited_by_users_id_fk", "tableFrom": "invites", "tableTo": "users", "columnsFrom": [ "invited_by" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" }, "invites_accepted_by_users_id_fk": { "name": "invites_accepted_by_users_id_fk", "tableFrom": "invites", "tableTo": "users", "columnsFrom": [ "accepted_by" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "memberships": { "name": "memberships", "columns": { "user_id": { "name": "user_id", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "workspace_id": { "name": "workspace_id", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "role": { "name": "role", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "joined_at": { "name": "joined_at", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "(datetime('now'))" } }, "indexes": {}, "foreignKeys": { "memberships_user_id_users_id_fk": { "name": "memberships_user_id_users_id_fk", "tableFrom": "memberships", "tableTo": "users", "columnsFrom": [ "user_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" }, "memberships_workspace_id_workspaces_id_fk": { "name": "memberships_workspace_id_workspaces_id_fk", "tableFrom": "memberships", "tableTo": "workspaces", "columnsFrom": [ "workspace_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": { "memberships_user_id_workspace_id_pk": { "columns": [ "user_id", "workspace_id" ], "name": "memberships_user_id_workspace_id_pk" } }, "uniqueConstraints": {}, "checkConstraints": {} }, "page_shares": { "name": "page_shares", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true, "autoincrement": false }, "page_id": { "name": "page_id", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "grantee_type": { "name": "grantee_type", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "grantee_id": { "name": "grantee_id", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "permission": { "name": "permission", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "link_token": { "name": "link_token", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "created_by": { "name": "created_by", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "created_at": { "name": "created_at", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "(datetime('now'))" } }, "indexes": { "page_shares_link_token_unique": { "name": "page_shares_link_token_unique", "columns": [ "link_token" ], "isUnique": true }, "idx_page_shares_page": { "name": "idx_page_shares_page", "columns": [ "page_id" ], "isUnique": false }, "idx_page_shares_grantee": { "name": "idx_page_shares_grantee", "columns": [ "grantee_type", "grantee_id" ], "isUnique": false } }, "foreignKeys": { "page_shares_page_id_pages_id_fk": { "name": "page_shares_page_id_pages_id_fk", "tableFrom": "page_shares", "tableTo": "pages", "columnsFrom": [ "page_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" }, "page_shares_created_by_users_id_fk": { "name": "page_shares_created_by_users_id_fk", "tableFrom": "page_shares", "tableTo": "users", "columnsFrom": [ "created_by" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "pages": { "name": "pages", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true, "autoincrement": false }, "workspace_id": { "name": "workspace_id", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "parent_id": { "name": "parent_id", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "title": { "name": "title", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "'Untitled'" }, "icon": { "name": "icon", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "cover_url": { "name": "cover_url", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "position": { "name": "position", "type": "real", "primaryKey": false, "notNull": true, "autoincrement": false }, "created_by": { "name": "created_by", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "created_at": { "name": "created_at", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "(datetime('now'))" }, "updated_at": { "name": "updated_at", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "(datetime('now'))" }, "archived_at": { "name": "archived_at", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false } }, "indexes": { "idx_pages_parent": { "name": "idx_pages_parent", "columns": [ "workspace_id", "parent_id", "position" ], "isUnique": false }, "idx_pages_workspace": { "name": "idx_pages_workspace", "columns": [ "workspace_id", "archived_at" ], "isUnique": false } }, "foreignKeys": { "pages_workspace_id_workspaces_id_fk": { "name": "pages_workspace_id_workspaces_id_fk", "tableFrom": "pages", "tableTo": "workspaces", "columnsFrom": [ "workspace_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" }, "pages_parent_id_pages_id_fk": { "name": "pages_parent_id_pages_id_fk", "tableFrom": "pages", "tableTo": "pages", "columnsFrom": [ "parent_id" ], "columnsTo": [ "id" ], "onDelete": "set null", "onUpdate": "no action" }, "pages_created_by_users_id_fk": { "name": "pages_created_by_users_id_fk", "tableFrom": "pages", "tableTo": "users", "columnsFrom": [ "created_by" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "uploads": { "name": "uploads", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true, "autoincrement": false }, "workspace_id": { "name": "workspace_id", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "page_id": { "name": "page_id", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "uploaded_by": { "name": "uploaded_by", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "filename": { "name": "filename", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "content_type": { "name": "content_type", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "size_bytes": { "name": "size_bytes", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false }, "r2_key": { "name": "r2_key", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "created_at": { "name": "created_at", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "(datetime('now'))" } }, "indexes": {}, "foreignKeys": { "uploads_workspace_id_workspaces_id_fk": { "name": "uploads_workspace_id_workspaces_id_fk", "tableFrom": "uploads", "tableTo": "workspaces", "columnsFrom": [ "workspace_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" }, "uploads_page_id_pages_id_fk": { "name": "uploads_page_id_pages_id_fk", "tableFrom": "uploads", "tableTo": "pages", "columnsFrom": [ "page_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" }, "uploads_uploaded_by_users_id_fk": { "name": "uploads_uploaded_by_users_id_fk", "tableFrom": "uploads", "tableTo": "users", "columnsFrom": [ "uploaded_by" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "users": { "name": "users", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true, "autoincrement": false }, "email": { "name": "email", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "password_hash": { "name": "password_hash", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "name": { "name": "name", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "avatar_url": { "name": "avatar_url", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "created_at": { "name": "created_at", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "(datetime('now'))" }, "updated_at": { "name": "updated_at", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "(datetime('now'))" } }, "indexes": { "users_email_unique": { "name": "users_email_unique", "columns": [ "email" ], "isUnique": true } }, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "workspaces": { "name": "workspaces", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true, "autoincrement": false }, "name": { "name": "name", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "slug": { "name": "slug", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "icon": { "name": "icon", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "owner_id": { "name": "owner_id", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "created_at": { "name": "created_at", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "(datetime('now'))" } }, "indexes": { "workspaces_slug_unique": { "name": "workspaces_slug_unique", "columns": [ "slug" ], "isUnique": true } }, "foreignKeys": { "workspaces_owner_id_users_id_fk": { "name": "workspaces_owner_id_users_id_fk", "tableFrom": "workspaces", "tableTo": "users", "columnsFrom": [ "owner_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} } }, "views": {}, "enums": {}, "_meta": { "schemas": {}, "tables": {}, "columns": {} }, "internal": { "indexes": {} } }