inibase 1.0.0-rc.76 → 1.0.0-rc.77
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/index.js +10 -8
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -222,30 +222,32 @@ export default class Inibase {
|
|
|
222
222
|
const schemaFile = await readFile(tableSchemaPath, "utf8");
|
|
223
223
|
if (!schemaFile)
|
|
224
224
|
return undefined;
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
return [
|
|
225
|
+
let schema = JSON.parse(schemaFile);
|
|
226
|
+
const lastIdNumber = UtilsServer.findLastIdNumber(schema, this.salt);
|
|
227
|
+
schema = [
|
|
229
228
|
{
|
|
230
|
-
id:
|
|
229
|
+
id: 0,
|
|
231
230
|
key: "id",
|
|
232
231
|
type: "id",
|
|
233
232
|
required: true,
|
|
234
233
|
},
|
|
235
|
-
...
|
|
234
|
+
...schema,
|
|
236
235
|
{
|
|
237
|
-
id:
|
|
236
|
+
id: lastIdNumber + 1,
|
|
238
237
|
key: "createdAt",
|
|
239
238
|
type: "date",
|
|
240
239
|
required: true,
|
|
241
240
|
},
|
|
242
241
|
{
|
|
243
|
-
id:
|
|
242
|
+
id: lastIdNumber + 2,
|
|
244
243
|
key: "updatedAt",
|
|
245
244
|
type: "date",
|
|
246
245
|
required: false,
|
|
247
246
|
},
|
|
248
247
|
];
|
|
248
|
+
if (!encodeIDs)
|
|
249
|
+
return schema;
|
|
250
|
+
return UtilsServer.encodeSchemaID(schema, this.salt);
|
|
249
251
|
}
|
|
250
252
|
async throwErrorIfTableEmpty(tableName) {
|
|
251
253
|
const table = await this.getTable(tableName);
|