{ "version": "6", "dialect": "sqlite", "id": "a9370796-3530-46f7-a701-d2910836c639", "prevId": "785b6b61-24b1-4350-b0ca-18946b41e2ad", "tables": { "api_keys": { "name": "api_keys", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true, "autoincrement": false }, "user_id": { "name": "user_id", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false }, "name": { "name": "name", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "key_hash": { "name": "key_hash", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "key_prefix": { "name": "key_prefix", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "created_at": { "name": "created_at", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false }, "last_used_at": { "name": "last_used_at", "type": "integer", "primaryKey": false, "notNull": false, "autoincrement": false } }, "indexes": {}, "foreignKeys": { "api_keys_user_id_users_id_fk": { "name": "api_keys_user_id_users_id_fk", "tableFrom": "api_keys", "tableTo": "users", "columnsFrom": [ "user_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "attachments": { "name": "attachments", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true, "autoincrement": false }, "user_id": { "name": "user_id", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": 0 }, "note_id": { "name": "note_id", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "filename": { "name": "filename", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "mime_type": { "name": "mime_type", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "size": { "name": "size", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false }, "path": { "name": "path", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "thumbnail_path": { "name": "thumbnail_path", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "featured": { "name": "featured", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": false }, "created_at": { "name": "created_at", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false } }, "indexes": {}, "foreignKeys": { "attachments_user_id_users_id_fk": { "name": "attachments_user_id_users_id_fk", "tableFrom": "attachments", "tableTo": "users", "columnsFrom": [ "user_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" }, "attachments_note_id_notes_id_fk": { "name": "attachments_note_id_notes_id_fk", "tableFrom": "attachments", "tableTo": "notes", "columnsFrom": [ "note_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "login_attempts": { "name": "login_attempts", "columns": { "id": { "name": "id", "type": "integer", "primaryKey": true, "notNull": true, "autoincrement": true }, "ip": { "name": "ip", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "email": { "name": "email", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "success": { "name": "success", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false }, "timestamp": { "name": "timestamp", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false } }, "indexes": { "login_attempts_ip_timestamp_idx": { "name": "login_attempts_ip_timestamp_idx", "columns": [ "ip", "timestamp" ], "isUnique": false } }, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "note_collaborators": { "name": "note_collaborators", "columns": { "note_id": { "name": "note_id", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "user_id": { "name": "user_id", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false }, "added_by": { "name": "added_by", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false }, "added_at": { "name": "added_at", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false } }, "indexes": { "note_collaborators_unique": { "name": "note_collaborators_unique", "columns": [ "note_id", "user_id" ], "isUnique": true }, "note_collaborators_user_id_idx": { "name": "note_collaborators_user_id_idx", "columns": [ "user_id" ], "isUnique": false } }, "foreignKeys": { "note_collaborators_note_id_notes_id_fk": { "name": "note_collaborators_note_id_notes_id_fk", "tableFrom": "note_collaborators", "tableTo": "notes", "columnsFrom": [ "note_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "note_collaborators_user_id_users_id_fk": { "name": "note_collaborators_user_id_users_id_fk", "tableFrom": "note_collaborators", "tableTo": "users", "columnsFrom": [ "user_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" }, "note_collaborators_added_by_users_id_fk": { "name": "note_collaborators_added_by_users_id_fk", "tableFrom": "note_collaborators", "tableTo": "users", "columnsFrom": [ "added_by" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "note_links": { "name": "note_links", "columns": { "source_note_id": { "name": "source_note_id", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "target_note_id": { "name": "target_note_id", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false } }, "indexes": { "note_links_source_idx": { "name": "note_links_source_idx", "columns": [ "source_note_id" ], "isUnique": false }, "note_links_target_idx": { "name": "note_links_target_idx", "columns": [ "target_note_id" ], "isUnique": false } }, "foreignKeys": { "note_links_source_note_id_notes_id_fk": { "name": "note_links_source_note_id_notes_id_fk", "tableFrom": "note_links", "tableTo": "notes", "columnsFrom": [ "source_note_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "note_links_target_note_id_notes_id_fk": { "name": "note_links_target_note_id_notes_id_fk", "tableFrom": "note_links", "tableTo": "notes", "columnsFrom": [ "target_note_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "note_tags": { "name": "note_tags", "columns": { "note_id": { "name": "note_id", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "tag_id": { "name": "tag_id", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false } }, "indexes": { "note_tags_note_id_idx": { "name": "note_tags_note_id_idx", "columns": [ "note_id" ], "isUnique": false }, "note_tags_tag_id_idx": { "name": "note_tags_tag_id_idx", "columns": [ "tag_id" ], "isUnique": false } }, "foreignKeys": { "note_tags_note_id_notes_id_fk": { "name": "note_tags_note_id_notes_id_fk", "tableFrom": "note_tags", "tableTo": "notes", "columnsFrom": [ "note_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "note_tags_tag_id_tags_id_fk": { "name": "note_tags_tag_id_tags_id_fk", "tableFrom": "note_tags", "tableTo": "tags", "columnsFrom": [ "tag_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "note_user_state": { "name": "note_user_state", "columns": { "note_id": { "name": "note_id", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "user_id": { "name": "user_id", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false }, "pinned": { "name": "pinned", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": false }, "archived": { "name": "archived", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": false }, "sort_order": { "name": "sort_order", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": 0 } }, "indexes": { "note_user_state_unique": { "name": "note_user_state_unique", "columns": [ "note_id", "user_id" ], "isUnique": true } }, "foreignKeys": { "note_user_state_note_id_notes_id_fk": { "name": "note_user_state_note_id_notes_id_fk", "tableFrom": "note_user_state", "tableTo": "notes", "columnsFrom": [ "note_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" }, "note_user_state_user_id_users_id_fk": { "name": "note_user_state_user_id_users_id_fk", "tableFrom": "note_user_state", "tableTo": "users", "columnsFrom": [ "user_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "note_versions": { "name": "note_versions", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true, "autoincrement": false }, "note_id": { "name": "note_id", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "version": { "name": "version", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false }, "title": { "name": "title", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "''" }, "content": { "name": "content", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "''" }, "checklist_mode": { "name": "checklist_mode", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": false }, "color": { "name": "color", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "'default'" }, "created_at": { "name": "created_at", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false } }, "indexes": { "note_versions_note_id_idx": { "name": "note_versions_note_id_idx", "columns": [ "note_id" ], "isUnique": false }, "note_versions_note_id_version_unique": { "name": "note_versions_note_id_version_unique", "columns": [ "note_id", "version" ], "isUnique": true } }, "foreignKeys": { "note_versions_note_id_notes_id_fk": { "name": "note_versions_note_id_notes_id_fk", "tableFrom": "note_versions", "tableTo": "notes", "columnsFrom": [ "note_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "notes": { "name": "notes", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true, "autoincrement": false }, "user_id": { "name": "user_id", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": 0 }, "title": { "name": "title", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "''" }, "content": { "name": "content", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "''" }, "color": { "name": "color", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "'default'" }, "pinned": { "name": "pinned", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": false }, "archived": { "name": "archived", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": false }, "trashed": { "name": "trashed", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": false }, "trashed_at": { "name": "trashed_at", "type": "integer", "primaryKey": false, "notNull": false, "autoincrement": false }, "checklist_mode": { "name": "checklist_mode", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": false }, "sort_order": { "name": "sort_order", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": 0 }, "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 }, "version": { "name": "version", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": 1 } }, "indexes": { "notes_user_id_idx": { "name": "notes_user_id_idx", "columns": [ "user_id" ], "isUnique": false }, "notes_trashed_archived_idx": { "name": "notes_trashed_archived_idx", "columns": [ "trashed", "archived" ], "isUnique": false }, "notes_updated_at_idx": { "name": "notes_updated_at_idx", "columns": [ "updated_at" ], "isUnique": false } }, "foreignKeys": { "notes_user_id_users_id_fk": { "name": "notes_user_id_users_id_fk", "tableFrom": "notes", "tableTo": "users", "columnsFrom": [ "user_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "sessions": { "name": "sessions", "columns": { "id": { "name": "id", "type": "text", "primaryKey": true, "notNull": true, "autoincrement": false }, "user_id": { "name": "user_id", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false }, "expires_at": { "name": "expires_at", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false }, "created_at": { "name": "created_at", "type": "integer", "primaryKey": false, "notNull": false, "autoincrement": false }, "user_agent": { "name": "user_agent", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "ip": { "name": "ip", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "last_used_at": { "name": "last_used_at", "type": "integer", "primaryKey": false, "notNull": false, "autoincrement": false } }, "indexes": {}, "foreignKeys": { "sessions_user_id_users_id_fk": { "name": "sessions_user_id_users_id_fk", "tableFrom": "sessions", "tableTo": "users", "columnsFrom": [ "user_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "shared_notes": { "name": "shared_notes", "columns": { "note_id": { "name": "note_id", "type": "text", "primaryKey": true, "notNull": true, "autoincrement": false }, "token": { "name": "token", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "created_at": { "name": "created_at", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false }, "expires_at": { "name": "expires_at", "type": "integer", "primaryKey": false, "notNull": false, "autoincrement": false } }, "indexes": { "shared_notes_token_unique": { "name": "shared_notes_token_unique", "columns": [ "token" ], "isUnique": true } }, "foreignKeys": { "shared_notes_note_id_notes_id_fk": { "name": "shared_notes_note_id_notes_id_fk", "tableFrom": "shared_notes", "tableTo": "notes", "columnsFrom": [ "note_id" ], "columnsTo": [ "id" ], "onDelete": "cascade", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "sync_log": { "name": "sync_log", "columns": { "id": { "name": "id", "type": "integer", "primaryKey": true, "notNull": true, "autoincrement": true }, "user_id": { "name": "user_id", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": 0 }, "note_id": { "name": "note_id", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "operation": { "name": "operation", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "timestamp": { "name": "timestamp", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false }, "client_id": { "name": "client_id", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false } }, "indexes": { "sync_log_timestamp_idx": { "name": "sync_log_timestamp_idx", "columns": [ "timestamp" ], "isUnique": false } }, "foreignKeys": { "sync_log_user_id_users_id_fk": { "name": "sync_log_user_id_users_id_fk", "tableFrom": "sync_log", "tableTo": "users", "columnsFrom": [ "user_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" }, "sync_log_note_id_notes_id_fk": { "name": "sync_log_note_id_notes_id_fk", "tableFrom": "sync_log", "tableTo": "notes", "columnsFrom": [ "note_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "tags": { "name": "tags", "columns": { "id": { "name": "id", "type": "integer", "primaryKey": true, "notNull": true, "autoincrement": true }, "user_id": { "name": "user_id", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": 0 }, "name": { "name": "name", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false } }, "indexes": { "tags_name_user_unique": { "name": "tags_name_user_unique", "columns": [ "name", "user_id" ], "isUnique": true } }, "foreignKeys": { "tags_user_id_users_id_fk": { "name": "tags_user_id_users_id_fk", "tableFrom": "tags", "tableTo": "users", "columnsFrom": [ "user_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "user_preferences": { "name": "user_preferences", "columns": { "id": { "name": "id", "type": "integer", "primaryKey": true, "notNull": true, "autoincrement": true }, "user_id": { "name": "user_id", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false }, "key": { "name": "key", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "value": { "name": "value", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false }, "updated_at": { "name": "updated_at", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false } }, "indexes": { "user_preferences_user_key_unique": { "name": "user_preferences_user_key_unique", "columns": [ "user_id", "key" ], "isUnique": true } }, "foreignKeys": { "user_preferences_user_id_users_id_fk": { "name": "user_preferences_user_id_users_id_fk", "tableFrom": "user_preferences", "tableTo": "users", "columnsFrom": [ "user_id" ], "columnsTo": [ "id" ], "onDelete": "no action", "onUpdate": "no action" } }, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} }, "users": { "name": "users", "columns": { "id": { "name": "id", "type": "integer", "primaryKey": true, "notNull": true, "autoincrement": true }, "email": { "name": "email", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "''" }, "display_name": { "name": "display_name", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "''" }, "role": { "name": "role", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "'user'" }, "password_hash": { "name": "password_hash", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "password_login_enabled": { "name": "password_login_enabled", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false, "default": false }, "auth_provider": { "name": "auth_provider", "type": "text", "primaryKey": false, "notNull": true, "autoincrement": false, "default": "'password'" }, "provider_id": { "name": "provider_id", "type": "text", "primaryKey": false, "notNull": false, "autoincrement": false }, "created_at": { "name": "created_at", "type": "integer", "primaryKey": false, "notNull": true, "autoincrement": false } }, "indexes": {}, "foreignKeys": {}, "compositePrimaryKeys": {}, "uniqueConstraints": {}, "checkConstraints": {} } }, "views": {}, "enums": {}, "_meta": { "schemas": {}, "tables": {}, "columns": {} }, "internal": { "indexes": {} } }