Combine settings and workspaces tables

This commit is contained in:
2024-10-27 16:00:06 +01:00
parent ab7b018f88
commit 4544af8f0f
11 changed files with 281 additions and 306 deletions

View File

@@ -26,21 +26,23 @@ var migrations = []Migration{
last_opened_file_path TEXT
);
-- Create workspaces table
-- Create workspaces table with integrated settings
CREATE TABLE IF NOT EXISTS workspaces (
id INTEGER PRIMARY KEY AUTOINCREMENT,
user_id INTEGER NOT NULL,
name TEXT NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
-- Settings fields
theme TEXT NOT NULL DEFAULT 'light' CHECK(theme IN ('light', 'dark')),
auto_save BOOLEAN NOT NULL DEFAULT 0,
git_enabled BOOLEAN NOT NULL DEFAULT 0,
git_url TEXT,
git_user TEXT,
git_token TEXT,
git_auto_commit BOOLEAN NOT NULL DEFAULT 0,
git_commit_msg_template TEXT DEFAULT '${action} ${filename}',
FOREIGN KEY (user_id) REFERENCES users (id)
);
-- Create workspace_settings table
CREATE TABLE IF NOT EXISTS workspace_settings (
workspace_id INTEGER PRIMARY KEY,
settings JSON NOT NULL,
FOREIGN KEY (workspace_id) REFERENCES workspaces (id)
);
`,
},
}