Added index to shortcode for easier queriing

This commit is contained in:
Nicolai Ort 2021-08-14 09:27:39 +02:00
parent c4c22a7405
commit 08140742ed
Signed by: niggl
GPG Key ID: 13AFA55AF62F269F

View File

@ -3,7 +3,7 @@ exports.up = function (knex) {
return knex.schema.createTable('visits', function (table) { return knex.schema.createTable('visits', function (table) {
table.increments('id').primary(); table.increments('id').primary();
table.timestamp('timestamp').defaultTo(knex.fn.now()); table.timestamp('timestamp').defaultTo(knex.fn.now());
table.string('shortcode'); table.string('shortcode').index();
table.foreign('shortcode').references('shortcode').inTable('urls'); table.foreign('shortcode').references('shortcode').inTable('urls');
}); });
}; };