blakus/apps/blakus-api/migrations/20250310143023_places.js
Broks Randolfs Gailītis 1c2d245f7c
Some checks failed
CI / main (push) Failing after 4m54s
Initial places and map implementation
2025-03-15 12:52:17 +02:00

24 lines
618 B
JavaScript

/**
* @param { import("knex").Knex } knex
* @returns { Promise<void> }
*/
exports.up = function(knex) {
return knex.schema
.createTable('places', function (table) {
table.uuid('id').primary().defaultTo(knex.raw(`gen_random_uuid()`));
table.string('name', 255).notNullable();
table.specificType('coordinates', 'GEOGRAPHY(Point, 4326)').notNullable();
table.string('externalId', 255);
table.timestamps(true, true);
})
};
/**
* @param { import("knex").Knex } knex
* @returns { Promise<void> }
*/
exports.down = function(knex) {
return knex.schema.dropTable('places');
};