20 lines
481 B
JavaScript
20 lines
481 B
JavaScript
|
exports.up = function(knex) {
|
||
|
return knex.schema.createTable('cities', function(cities) {
|
||
|
cities.increments();
|
||
|
|
||
|
cities.string('name', 128).notNullable();
|
||
|
cities
|
||
|
.integer('country_id')
|
||
|
.unsigned()
|
||
|
.notNullable()
|
||
|
.references('id')
|
||
|
.inTable('countries')
|
||
|
.onDelete('CASCADE')
|
||
|
.onUpdate('CASCADE');
|
||
|
});
|
||
|
};
|
||
|
|
||
|
exports.down = function(knex) {
|
||
|
return knex.schema.dropTableIfExists('cities');
|
||
|
};
|
||
|
|