Santi Albo 548471de0a
fix TypeScript migration stub after 0.95.0 changes (#4366)
* fix TypeScript migration stub after 0.95.0 changes

Release 0.95.0 changed how types have to be imported when using TypeScript. This PR fixes the migration stub so new migrations are created correctly.

* Add test for Knex.AlterTableBuilder

Co-authored-by: Igor Savin <iselwin@gmail.com>
2021-03-11 19:58:00 +02:00

22 lines
560 B
Plaintext

import { 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> {
}
<% } %>