mirror of
https://github.com/knex/knex.git
synced 2025-07-13 03:50:42 +00:00

* 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>
22 lines
560 B
Plaintext
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> {
|
|
}
|
|
<% } %>
|