exports.up = function (knex) { return knex.schema.createTable('visits', function (table) { table.timestamp('timestamp').defaultTo(knex.fn.now()); table.string('shortcode'); table.primary(['shortcode', 'timestamp']); table.foreign('shortcode').references('shortcode').inTable('urls'); }); }; exports.down = function (knex) { };