inibase 1.0.0-rc.106 → 1.0.0-rc.107
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 +7 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -142,7 +142,9 @@ export default class Inibase {
|
|
|
142
142
|
let schemaIdFilePath;
|
|
143
143
|
for await (const filePath of glob("*.schema", { cwd: this.databasePath }))
|
|
144
144
|
schemaIdFilePath = filePath;
|
|
145
|
-
const lastSchemaId =
|
|
145
|
+
const lastSchemaId = schemaIdFilePath
|
|
146
|
+
? Number(parse(schemaIdFilePath).name)
|
|
147
|
+
: 0;
|
|
146
148
|
if (await File.isExists(join(tablePath, "schema.json"))) {
|
|
147
149
|
// update columns files names based on field id
|
|
148
150
|
schema = UtilsServer.addIdToSchema(schema, lastSchemaId, this.salt);
|
|
@@ -158,7 +160,10 @@ export default class Inibase {
|
|
|
158
160
|
else
|
|
159
161
|
schema = UtilsServer.addIdToSchema(schema, lastSchemaId, this.salt);
|
|
160
162
|
await writeFile(join(tablePath, "schema.json"), JSON.stringify(schema, null, 2));
|
|
161
|
-
|
|
163
|
+
if (schemaIdFilePath)
|
|
164
|
+
await rename(schemaIdFilePath, join(tablePath, `${lastSchemaId}.schema`));
|
|
165
|
+
else
|
|
166
|
+
await writeFile(join(tablePath, `${lastSchemaId}.schema`), "");
|
|
162
167
|
}
|
|
163
168
|
if (config) {
|
|
164
169
|
if (config.compression !== undefined &&
|