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

17 lines
485 B
TypeScript

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