Files
kener/migrations/20260114120000_remove_monitors_name_unique.ts
2026-02-24 23:46:15 +05:30

20 lines
533 B
TypeScript

import type { Knex } from "knex";
export async function up(knex: Knex): Promise<void> {
// Remove unique constraint from monitors.name (safe to fail if already dropped)
try {
await knex.schema.alterTable("monitors", (table) => {
table.dropUnique(["name"]);
});
} catch (_e) {
// Constraint already removed
}
}
export async function down(knex: Knex): Promise<void> {
// Re-add unique constraint to monitors.name
await knex.schema.alterTable("monitors", (table) => {
table.unique(["name"]);
});
}