refactor(naming): unify service abbreviations (cmk, semaphore)
Standardise CheckMK variables to the cmk prefix (checkMkUrl -> cmkUrl, checkmk* -> cmk*) and resolve the ansible/semaphore split by renaming all booking fields to semaphore*. Includes DB migrations 0001/0002 for existing databases.
This commit is contained in:
@ -8,13 +8,21 @@ interface Migration {
|
||||
// Append only. Never reorder or remove entries — that would corrupt tracking.
|
||||
// Each `up` function receives the open DB handle inside an already-open transaction.
|
||||
const migrations: Migration[] = [
|
||||
// Example:
|
||||
// {
|
||||
// id: '0001_bookings_add_color',
|
||||
// up: (db) => {
|
||||
// db.exec(`ALTER TABLE bookings ADD COLUMN color TEXT NOT NULL DEFAULT 'blue'`);
|
||||
// },
|
||||
// },
|
||||
{
|
||||
id: '0001_rename_device_checkMkUrl_to_cmkUrl',
|
||||
up: (db) => {
|
||||
db.exec(`ALTER TABLE devices RENAME COLUMN checkMkUrl TO cmkUrl`);
|
||||
},
|
||||
},
|
||||
{
|
||||
id: '0002_rename_booking_ansible_to_semaphore',
|
||||
up: (db) => {
|
||||
db.exec(`ALTER TABLE bookings RENAME COLUMN ansibleSetupTriggered TO semaphoreSetupTriggered`);
|
||||
db.exec(`ALTER TABLE bookings RENAME COLUMN ansibleTeardownTriggered TO semaphoreTeardownTriggered`);
|
||||
db.exec(`ALTER TABLE bookings RENAME COLUMN ansibleSetupJobId TO semaphoreSetupJobId`);
|
||||
db.exec(`ALTER TABLE bookings RENAME COLUMN ansibleTeardownJobId TO semaphoreTeardownJobId`);
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
export function runMigrations(db: InstanceType<typeof Database>): void {
|
||||
|
||||
Reference in New Issue
Block a user