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

17 lines
492 B
TypeScript

import type { Knex } from "knex";
export async function up(knex: Knex): Promise<void> {
const hasCol = await knex.schema.hasColumn("incidents", "incident_source");
if (!hasCol) {
await knex.schema.alterTable("incidents", function (table) {
table.text("incident_source").defaultTo("DASHBOARD");
});
}
}
export async function down(knex: Knex): Promise<void> {
await knex.schema.alterTable("incidents", function (table) {
table.dropColumn("incident_source");
});
}