Adding networks and sites as entities,

This commit is contained in:
2020-06-04 01:03:02 +02:00
parent 8abcc7194a
commit 09d849eb9d
9 changed files with 283 additions and 221 deletions

View File

@@ -430,7 +430,7 @@ const networks = [
exports.seed = knex => Promise.resolve()
.then(async () => {
const { inserted, updated } = await upsert('networks', parentNetworks, 'slug', knex);
const { inserted, updated } = await upsert('entities', parentNetworks, 'slug', knex);
const parentNetworksBySlug = [].concat(inserted, updated).reduce((acc, network) => ({ ...acc, [network.slug]: network.id }), {});
const networksWithParent = networks.map(network => ({
@@ -443,5 +443,5 @@ exports.seed = knex => Promise.resolve()
parent_id: parentNetworksBySlug[network.parent] || null,
}));
return upsert('networks', networksWithParent, 'slug', knex);
return upsert('entities', networksWithParent, 'slug', knex);
});