feat: add project budgets and rounding override columns

This commit is contained in:
Your Name
2026-02-18 02:02:13 +02:00
parent 26f1b19dde
commit 85c20247f5
4 changed files with 179 additions and 7 deletions

View File

@@ -46,6 +46,24 @@ pub fn init_db(conn: &Connection) -> Result<(), rusqlite::Error> {
[],
)?;
// Migrate projects table — add budget columns (safe to re-run)
let project_migrations = [
"ALTER TABLE projects ADD COLUMN budget_hours REAL DEFAULT NULL",
"ALTER TABLE projects ADD COLUMN budget_amount REAL DEFAULT NULL",
"ALTER TABLE projects ADD COLUMN rounding_override INTEGER DEFAULT NULL",
];
for sql in &project_migrations {
match conn.execute(sql, []) {
Ok(_) => {}
Err(e) => {
let msg = e.to_string();
if !msg.contains("duplicate column") {
return Err(e);
}
}
}
}
conn.execute(
"CREATE TABLE IF NOT EXISTS tasks (
id INTEGER PRIMARY KEY AUTOINCREMENT,