feat: add 'can_be_assigned' column to users with default settings for admin users

This commit is contained in:
2025-10-09 15:01:01 +02:00
parent cdfc37c273
commit ce3c53b4a8

18
add-assignable-column.mjs Normal file
View File

@@ -0,0 +1,18 @@
import db from "./src/lib/db.js";
console.log("Adding can_be_assigned column to users table...");
// Add the new column
db.prepare(`
ALTER TABLE users
ADD COLUMN can_be_assigned INTEGER DEFAULT 1
`).run();
// Set admin users to not be assignable by default
db.prepare(`
UPDATE users
SET can_be_assigned = 0
WHERE role = 'admin'
`).run();
console.log("Migration completed. Admin users are now not assignable by default.");