dijkstra-backend/data/migrations/20200207160031_cities.js

20 lines
481 B
JavaScript
Raw Normal View History

2020-02-07 16:55:43 +00:00
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');
};