Answer the question
In order to leave comments, you need to log in
How to make a rolling migration to knex.js?
I am writing a migration using knex.js and the question is how to write it correctly for several tables, for example, there is a nav table and for it the migration will look like this
exports.up = function(knex, Promise) {
return knex.schema.createTable('nav', (table) => {
table.increments();
table.string('name').unique().notNullable();
table.string('path').unique().notNullable();
}).then(() => {
return knex('nav').insert([
{ name: 'A', path: 'A' },
{ name: 'B', path: 'BB' },
{ name: 'C', path: 'CCC' },
{ name: 'D', path: 'DDDD' }
])
})
};
Answer the question
In order to leave comments, you need to log in
So write the code for creating the second table in the following then
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question