mirror of
https://github.com/rajnandan1/kener.git
synced 2026-06-23 04:10:22 +00:00
20 lines
606 B
TypeScript
20 lines
606 B
TypeScript
import type { Knex } from "knex";
|
|
|
|
export async function up(knex: Knex): Promise<void> {
|
|
const hasColumn = await knex.schema.hasColumn("pages_monitors", "position");
|
|
if (!hasColumn) {
|
|
await knex.schema.alterTable("pages_monitors", (table) => {
|
|
table.integer("position").unsigned().notNullable().defaultTo(0);
|
|
});
|
|
}
|
|
}
|
|
|
|
export async function down(knex: Knex): Promise<void> {
|
|
const hasColumn = await knex.schema.hasColumn("pages_monitors", "position");
|
|
if (hasColumn) {
|
|
await knex.schema.alterTable("pages_monitors", (table) => {
|
|
table.dropColumn("position");
|
|
});
|
|
}
|
|
}
|