Oli af0e9c1650
Import knex as type in TS migration template (#5741)
Co-authored-by: Igor Savin <iselwin@gmail.com>
2023-11-28 02:16:50 +02:00

22 lines
565 B
Plaintext

import type { Knex } from "knex";
<% if (d.tableName) { %>
export async function up(knex: Knex): Promise<Knex.SchemaBuilder> {
return knex.schema.createTable("<%= d.tableName %>", (t) => {
t.increments();
t.timestamps();
});
}
<% } else { %>
export async function up(knex: Knex): Promise<void> {
}
<% } %>
<% if (d.tableName) { %>
export async function down(knex: Knex): Promise<Knex.SchemaBuilder> {
return knex.schema.dropTable("<%= d.tableName %>");
}
<% } else { %>
export async function down(knex: Knex): Promise<void> {
}
<% } %>