@stacksjs/database 0.70.193 → 0.70.195
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.
- package/dist/seeder.js +5 -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[
|
|
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],
|
|
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.
|
|
5
|
+
"version": "0.70.195",
|
|
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.
|
|
64
|
-
"@stacksjs/config": "0.70.
|
|
65
|
-
"@stacksjs/logging": "0.70.
|
|
66
|
-
"@stacksjs/router": "0.70.
|
|
63
|
+
"@stacksjs/cli": "0.70.195",
|
|
64
|
+
"@stacksjs/config": "0.70.195",
|
|
65
|
+
"@stacksjs/logging": "0.70.195",
|
|
66
|
+
"@stacksjs/router": "0.70.195",
|
|
67
67
|
"better-dx": "^0.2.17",
|
|
68
|
-
"@stacksjs/path": "0.70.
|
|
69
|
-
"@stacksjs/query-builder": "0.70.
|
|
70
|
-
"@stacksjs/storage": "0.70.
|
|
71
|
-
"@stacksjs/strings": "0.70.
|
|
72
|
-
"@stacksjs/utils": "0.70.
|
|
68
|
+
"@stacksjs/path": "0.70.195",
|
|
69
|
+
"@stacksjs/query-builder": "0.70.195",
|
|
70
|
+
"@stacksjs/storage": "0.70.195",
|
|
71
|
+
"@stacksjs/strings": "0.70.195",
|
|
72
|
+
"@stacksjs/utils": "0.70.195"
|
|
73
73
|
}
|
|
74
74
|
}
|