1 year ago
#383233
kastaplastislife
Add a new column and also index it using knex?
I have a simple knext migration to add a new column:
import * as Knex from "knex";
export async function up(knex: Knex): Promise<void> {
await knex.schema.alterTable("bins", (table) => {
table.bigInteger("parent_lsn").defaultTo(null).after("lsn").index();
});
}
export async function down(knex: Knex): Promise<void> {
await knex.schema.alterTable("bins", (table) => {
table.dropColumns("parent_lsn");
});
}
I tried adding the .index() in there, but it's not seeming to reflect as an indexed column in the database. Not sure where I'm going wrong here?
mysql
knex.js
0 Answers
Your Answer