mirror of
https://github.com/knex/knex.git
synced 2025-07-03 07:04:07 +00:00
22 lines
565 B
Plaintext
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> {
|
|
}
|
|
<% } %>
|