@stacksjs/database 0.63.1 → 0.64.0

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/database",
3
3
  "type": "module",
4
- "version": "0.63.1",
4
+ "version": "0.64.0",
5
5
  "description": "The Stacks database integration.",
6
6
  "author": "Chris Breuer",
7
7
  "license": "MIT",
@@ -177,13 +177,11 @@ export async function getRelations(model: Model, modelPath: string): Promise<Rel
177
177
  relationModel = relationInstance
178
178
  }
179
179
 
180
- const modelRelationPath = path.userModelsPath(`${relationModel}.ts`)
180
+ const modelRelationPath = path.userModelsPath(relationModel)
181
181
  const modelRelation = (await import(modelRelationPath)).default
182
-
183
182
  const modelName = getModelName(model, modelPath)
184
183
  const formattedModelName = modelName.toLowerCase()
185
184
  const tableName = getTableName(model, modelPath)
186
-
187
185
  const modelRelationTable = getModelName(modelRelation, modelRelationPath)
188
186
 
189
187
  relationships.push({
@@ -207,17 +205,13 @@ export async function getRelations(model: Model, modelPath: string): Promise<Rel
207
205
 
208
206
  export async function fetchOtherModelRelations(model: Model, modelPath: string): Promise<RelationConfig[]> {
209
207
  const modelFiles = glob.sync(path.userModelsPath('*.ts'))
210
-
211
208
  const modelRelations = []
212
209
 
213
210
  for (let i = 0; i < modelFiles.length; i++) {
214
211
  const modelFileElement = modelFiles[i] as string
215
-
216
212
  const modelFile = (await import(modelFileElement)).default as Model
217
-
218
213
  const tableName = getTableName(model, modelPath)
219
214
  const modelName = getModelName(model, modelPath)
220
-
221
215
  const modelFileName = getTableName(modelFile, modelFileElement)
222
216
 
223
217
  if (tableName === modelFileName) continue