feat: add 'can_be_assigned' column to users with default settings for admin users
This commit is contained in:
18
add-assignable-column.mjs
Normal file
18
add-assignable-column.mjs
Normal 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.");
|
||||||
Reference in New Issue
Block a user