leoric 2.6.0 → 2.6.1

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,6 +1,6 @@
1
1
  {
2
2
  "name": "leoric",
3
- "version": "2.6.0",
3
+ "version": "2.6.1",
4
4
  "description": "JavaScript Object-relational mapping alchemy",
5
5
  "main": "index.js",
6
6
  "types": "types/index.d.ts",
package/src/data_types.js CHANGED
@@ -358,7 +358,8 @@ class DATE extends DataType {
358
358
  // @deprecated
359
359
  // vaguely standard date formats such as 2021-10-15 15:50:02,548
360
360
  if (typeof value === 'string' && rDateFormat.test(value)) {
361
- // 2021-10-15 15:50:02,548 => 2021-10-15T15:50:02,548, 2021-10-15 15:50:02 => 2021-10-15T15:50:02.000
361
+ // 2021-10-15 15:50:02,548 => 2021-10-15T15:50:02,548,
362
+ // 2021-10-15 15:50:02 => 2021-10-15T15:50:02.000
362
363
  value = new Date(`${value.replace(' ', 'T').replace(',', '.')}`);
363
364
  }
364
365
 
package/src/realm.js CHANGED
@@ -75,6 +75,10 @@ async function loadModels(Spine, models, opts) {
75
75
  const schemaInfo = await Spine.driver.querySchemaInfo(database, tables);
76
76
 
77
77
  for (const model of models) {
78
+ // assign driver if model's driver not exist
79
+ if (!model.driver) model.driver = Spine.driver;
80
+ // assign options if model's options not exist
81
+ if (!model.options) model.options = Spine.options;
78
82
  const columns = schemaInfo[model.physicTable] || schemaInfo[model.table];
79
83
  if (!model.attributes) initAttributes(model, columns);
80
84
  model.load(columns);