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 +1 -1
- package/src/data_types.js +2 -1
- package/src/realm.js +4 -0
package/package.json
CHANGED
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,
|
|
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);
|