@stacksjs/database 0.70.192 → 0.70.194

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/seeder.js +5 -2
  2. package/package.json +10 -10
package/dist/seeder.js CHANGED
@@ -160,7 +160,7 @@ async function relationColumns(model, options = {}) {
160
160
  const pools = [];
161
161
  for (const parent of parents) {
162
162
  const column = `${snakeCase(parent)}_id`;
163
- if (model.attributes[column] || model.attributes[parent])
163
+ if (model.attributes[parent])
164
164
  continue;
165
165
  if (isAccountModel(parent) && !options.allowProtected)
166
166
  continue;
@@ -194,7 +194,10 @@ export function chooseRelations(pools, count) {
194
194
  async function generateRecords(model, options = {}) {
195
195
  const records = [], relations = await relationColumns(model, options);
196
196
  for (let i = 0;i < model.count; i++) {
197
- const record = await generateRecord(model.attributes, model.name, i === 0), fixture = model.fixtures[i], withRelations = { ...record, ...relations[i] ?? {} };
197
+ const record = await generateRecord(model.attributes, model.name, i === 0), fixture = model.fixtures[i], relation = relations[i] ?? {}, withRelations = { ...record };
198
+ for (const [column, value] of Object.entries(relation))
199
+ if (withRelations[column] == null)
200
+ withRelations[column] = value;
198
201
  records.push(fixture ? { ...withRelations, ...fixtureToColumns(fixture) } : withRelations);
199
202
  }
200
203
  return records;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@stacksjs/database",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "0.70.192",
5
+ "version": "0.70.194",
6
6
  "description": "The Stacks database integration.",
7
7
  "author": "Chris Breuer",
8
8
  "contributors": [
@@ -60,15 +60,15 @@
60
60
  "dynamodb-tooling": "^0.3.2"
61
61
  },
62
62
  "devDependencies": {
63
- "@stacksjs/cli": "0.70.192",
64
- "@stacksjs/config": "0.70.192",
65
- "@stacksjs/logging": "0.70.192",
66
- "@stacksjs/router": "0.70.192",
63
+ "@stacksjs/cli": "0.70.194",
64
+ "@stacksjs/config": "0.70.194",
65
+ "@stacksjs/logging": "0.70.194",
66
+ "@stacksjs/router": "0.70.194",
67
67
  "better-dx": "^0.2.17",
68
- "@stacksjs/path": "0.70.192",
69
- "@stacksjs/query-builder": "0.70.192",
70
- "@stacksjs/storage": "0.70.192",
71
- "@stacksjs/strings": "0.70.192",
72
- "@stacksjs/utils": "0.70.192"
68
+ "@stacksjs/path": "0.70.194",
69
+ "@stacksjs/query-builder": "0.70.194",
70
+ "@stacksjs/storage": "0.70.194",
71
+ "@stacksjs/strings": "0.70.194",
72
+ "@stacksjs/utils": "0.70.194"
73
73
  }
74
74
  }