mirror of
https://github.com/knex/knex.git
synced 2025-07-13 12:00:55 +00:00

* Add test for drop-and-recreate with async/await * Add some tests with schema * Use correct migrations * Add tests with promise chains for comparison * Fix migration * Fix Node 6 compatibility
20 lines
468 B
JavaScript
20 lines
468 B
JavaScript
exports.up = (knex) => {
|
|
return knex.raw('CREATE SCHEMA dummy_schema').then(() => {
|
|
return knex.schema
|
|
.withSchema('dummy_schema')
|
|
.createTable('old_users', (table) => {
|
|
table.string('name');
|
|
table.string('officeId');
|
|
});
|
|
});
|
|
};
|
|
|
|
exports.down = (knex) => {
|
|
return knex.schema
|
|
.withSchema('dummy_schema')
|
|
.dropTable('old_users')
|
|
.then(() => {
|
|
return knex.raw('DROP SCHEMA dummy_schema CASCADE');
|
|
});
|
|
};
|