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

20 lines
481 B
JavaScript
Raw Normal View History

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');
};