Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript migration stub #2816

Merged
merged 2 commits into from Sep 27, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/migrate/stub/ts.stub
@@ -1,15 +1,15 @@
import * as Knex from "knex";

exports.up = function (knex: Knex): Promise<any> {
export async function up(knex: Knex): Promise<Knex.SchemaBuilder> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't thing tat typing is right. AFAIK Migration does not always resolve with Knex.SchemaBuilder instance.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

<% if (d.tableName) { %>
return knex.schema.createTable("<%= d.tableName %>", function (t) {
return knex.schema.createTable("<%= d.tableName %>", function (t: Knex.AlterTableBuilder) {
t.increments();
t.timestamps();
});
<% } %>
};

exports.down = function (knex: Knex): Promise<any> {
export async function down(knex: Knex): Promise<Knex.SchemaBuilder> {
<% if (d.tableName) { %>
return knex.schema.dropTable("<%= d.tableName %>");
<% } %>
Expand Down