Implemented a simple table for storing visits
This commit is contained in:
parent
6680ce7e50
commit
5e9dec640a
|
@ -1,7 +1,10 @@
|
|||
|
||||
exports.up = function (knex) {
|
||||
return knex.schema.table('urls', function (table) {
|
||||
table.integer('visits');
|
||||
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');
|
||||
});
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue