Add place addresses
Some checks failed
CI / main (push) Failing after 3m59s

This commit is contained in:
Broks Randolfs Gailītis 2025-03-15 14:19:01 +02:00
parent 1c2d245f7c
commit 6e76293a94
2 changed files with 40 additions and 0 deletions

View File

@ -0,0 +1,33 @@
/**
* @param { import("knex").Knex } knex
* @returns { Promise<void> }
*/
exports.up = function(knex) {
return knex.schema
.alterTable('places', function (table) {
table.string('country', 2);
table.string('county');
table.string('district');
table.string('city');
table.string('street');
table.string('house');
table.string('postalCode');
});
};
/**
* @param { import("knex").Knex } knex
* @returns { Promise<void> }
*/
exports.down = function(knex) {
return knex.schema
.alterTable('places', function (table) {
table.dropColumn('country');
table.dropColumn('county');
table.dropColumn('district');
table.dropColumn('city');
table.dropColumn('street');
table.dropColumn('house');
table.dropColumn('postalCode')
});
};

View File

@ -19,6 +19,13 @@ exports.seed = async function(knex) {
return {
name: faker.company.name(),
coordinates: knex.raw('ST_SetSRID(ST_MakePoint(?, ?), 4326)', coords),
country: 'LV',
county: faker.helpers.arrayElement(['Kurzemes', 'Latgales', 'Rīgas', 'Vidzemes', 'Zemgales']),
district: faker.location.state(),
city: faker.location.city(),
street: faker.location.street(),
house: faker.helpers.maybe(() => faker.person.lastName(), { probability: 0.1 }) || faker.location.buildingNumber(),
postalCode: faker.location.zipCode(),
}
};