23 lines
670 B
JavaScript
23 lines
670 B
JavaScript
/**
|
|
* @param { import("knex").Knex } knex
|
|
* @returns { Promise<void> }
|
|
*/
|
|
exports.up = function(knex) {
|
|
return knex.schema
|
|
.createTable('place_ratings', function (table) {
|
|
table.uuid('id').primary().defaultTo(knex.raw(`gen_random_uuid()`));
|
|
table.uuid('place_id').references('id').inTable('places').onDelete('CASCADE');
|
|
table.uuid('user_id').references('id').inTable('users').onDelete('CASCADE');
|
|
table.integer('rating').notNullable();
|
|
table.timestamps(true, true);
|
|
})
|
|
};
|
|
|
|
/**
|
|
* @param { import("knex").Knex } knex
|
|
* @returns { Promise<void> }
|
|
*/
|
|
exports.down = function(knex) {
|
|
knex.schema.dropTable('place_ratings');
|
|
};
|