knex migrate:latest hangs
See original GitHub issueHere is my knexfile.js
module.exports = {
development: {
client: 'pg',
connection: {
"host": "my_host",
"database": "my_db",
"user": "my_db_user",
"password": "my_db_password"
}
}
};
and my migrations
user
'use strict';
exports.up = function(knex, Promise) {
return knex.schema.createTable('users', function (table) {
table.increments('id').primary();
table.integer('profile_id').references('profiles.id');
table.dateTime('created_at');
table.dateTime('updated_at');
table.string('user_name');
table.string('password');
table.integer('is_enabled');
table.uuid('token');
});
};
exports.down = function(knex, Promise) {
return knex.schema.dropTable('users');
};
profile
'use strict';
exports.up = function(knex, Promise) {
return knex.schema.createTable('profiles', function (table) {
table.increments('id').primary();
table.integer('user_id').references('users.id');
table.dateTime('created_at');
table.dateTime('updated_at');
table.string('name');
table.string('email');
table.string('photo');
table.string('location');
table.string('website');
table.text('bio');
});
};
exports.down = function(knex, Promise) {
return knex.schema.dropTable('profiles');
};
role
'use strict';
exports.up = function(knex, Promise) {
return knex.schema.createTable('roles', function (table) {
table.increments('id').primary();
table.dateTime('created_at');
table.dateTime('updated_at');
table.string('name');
});
};
exports.down = function(knex, Promise) {
return knex.schema.dropTable('roles');
};
roles_users
'use strict';
exports.up = function(knex, Promise) {
return knex.createTable('roles_users', function (table) {
table.integer('role_id').references('roles.id');
table.integer('user_id').references('users.id');
});
};
exports.down = function(knex, Promise) {
return knex.schema.dropTable('roles_users');
};
When I run: knex migrate:latest it just hangs, no error, no output whatsoever, even with --debug. I’ve traced it down to this line:
https://github.com/tgriesser/knex/blob/master/lib/migrate/index.js#L120
The call to hasTable does return 0:
https://github.com/tgriesser/knex/blob/master/lib/dialects/postgres/schema/schema.js#L35
But I would have thought it would have resolved 0 there, but it does not. Any ideas?
Issue Analytics
- State:
- Created 9 years ago
- Comments:9 (1 by maintainers)
Top Results From Across the Web
knex migrate:latest hangs · Issue #608 - GitHub
When I run: knex migrate:latest it just hangs, no error, no output whatsoever, even with --debug. I've traced it down to this line:....
Read more >javascript - Knex Migrations cause gulp process to hang - Stack ...
Documentation on knex's connection pooling and the explicit destroy command are here. The gulp task becomes this: gulp.task('migrate:latest', function () ...
Read more >Migrations | Knex.js
Creating new migration files can be achieved by running: ... Please note that if your process unfortunately crashes, the lock will have to...
Read more >Database Migrations with Knex - Perk
Step 1: Create a new migration file with knex cli ... You can refer back to the Creating a migration file section of...
Read more >tgriesser/knex - Gitter
@elhigu Ok, but when i use: knex.migrate.latest({ migrationSource: new WebpackMigrationSource(require.context('./migrations', false, /.ts$/)) }).
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Now that I have some output I was able to fix my migrations and everything is working well now:
Not sure what I had all jacked up, but working well now.
I still see this issue when I run migrations. Tested with knex
0.21.1
, pg8.2.1
, running the migrations via JS code (not the CLI)