Skip to content

Commit

Permalink
Make TS stubs modern (#3080)
Browse files Browse the repository at this point in the history
  • Loading branch information
felixmosh authored and kibertoad committed Mar 5, 2019
1 parent 68723e0 commit f3f0750
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/migrate/stub/ts.stub
Expand Up @@ -2,20 +2,20 @@ import * as Knex from "knex";

<% if (d.tableName) { %>
export async function up(knex: Knex): Promise<Knex.SchemaBuilder> {
return knex.schema.createTable("<%= d.tableName %>", function (t: Knex.AlterTableBuilder) {
return knex.schema.createTable("<%= d.tableName %>", (t: Knex.AlterTableBuilder) => {
t.increments();
t.timestamps();
});
};
}
<% } else { %>
export async function up(knex: Knex): Promise<any> {
};
}
<% } %>
<% 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<any> {
};
}
<% } %>
4 changes: 2 additions & 2 deletions src/seed/stub/ts.stub
@@ -1,9 +1,9 @@
import * as Knex from "knex";

exports.seed = function (knex: Knex): Promise<any> {
export async function seed(knex: Knex): Promise<any> {
// Deletes ALL existing entries
return knex("table_name").del()
.then(function () {
.then(() => {
// Inserts seed entries
return knex("table_name").insert([
{ id: 1, colName: "rowValue1" },
Expand Down

0 comments on commit f3f0750

Please sign in to comment.