vona-module-a-version 5.0.44 → 5.0.46
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 -17
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { BeanInfo, $Class, BeanBase, BeanScopeBase } from 'vona';
|
|
2
|
-
import { Api, v } from 'vona-module-a-
|
|
2
|
+
import { Api, v } from 'vona-module-a-openapiutils';
|
|
3
3
|
import { Entity, EntityBaseSimple, Model, BeanModelBase } from 'vona-module-a-orm';
|
|
4
4
|
import chalk from 'chalk';
|
|
5
|
-
import
|
|
5
|
+
import { DateTime } from 'luxon';
|
|
6
6
|
import { Service, Scope } from 'vona-module-a-bean';
|
|
7
7
|
import { Event, BeanEventBase } from 'vona-module-a-event';
|
|
8
8
|
import fse from 'fs-extra';
|
|
@@ -124,7 +124,7 @@ let ModelViewRecord = (_dec$8 = Model({
|
|
|
124
124
|
|
|
125
125
|
var _dec$7, _dec2$7, _class$7;
|
|
126
126
|
const __separator = '-';
|
|
127
|
-
const __timeFormat = `
|
|
127
|
+
const __timeFormat = `yyyyMMdd${__separator}HHmmss`;
|
|
128
128
|
let ServiceDatabase = (_dec$7 = Service(), _dec2$7 = BeanInfo({
|
|
129
129
|
module: "a-version"
|
|
130
130
|
}), _dec$7(_class$7 = _dec2$7(_class$7 = class ServiceDatabase extends BeanBase {
|
|
@@ -150,22 +150,12 @@ let ServiceDatabase = (_dec$7 = Service(), _dec2$7 = BeanInfo({
|
|
|
150
150
|
}
|
|
151
151
|
async __fetchDatabases(client, instanceName, configInstanceBase) {
|
|
152
152
|
const databasePrefix = this.getDatabasePrefix(instanceName, configInstanceBase);
|
|
153
|
-
|
|
154
|
-
let dbs = await client.connection.schema.fetchDatabases(databasePrefix);
|
|
155
|
-
// filter
|
|
156
|
-
dbs = dbs.filter(db => {
|
|
157
|
-
const _time = db.name.substring(databasePrefix.length);
|
|
158
|
-
return _time.length === __timeFormat.length;
|
|
159
|
-
});
|
|
160
|
-
// ok
|
|
161
|
-
return dbs;
|
|
153
|
+
return await client.connection.schema.fetchDatabases(databasePrefix);
|
|
162
154
|
}
|
|
163
155
|
async __createDatabase(client, instanceName, configInstanceBase) {
|
|
164
156
|
const databasePrefix = this.getDatabasePrefix(instanceName, configInstanceBase);
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
await client.connection.schema.createDatabase(databaseName);
|
|
168
|
-
return databaseName;
|
|
157
|
+
const databaseName = `${databasePrefix}${DateTime.now().toFormat(__timeFormat)}`;
|
|
158
|
+
return await client.connection.schema.createDatabase(databaseName);
|
|
169
159
|
}
|
|
170
160
|
async __prepareDatabases(versionStart) {
|
|
171
161
|
// default
|
|
@@ -196,7 +186,7 @@ let ServiceDatabase = (_dec$7 = Service(), _dec2$7 = BeanInfo({
|
|
|
196
186
|
const client = this.bean.database.current.client;
|
|
197
187
|
// get current database name
|
|
198
188
|
let databaseName = client.getDatabaseName();
|
|
199
|
-
const isTestDatabase = databaseName.
|
|
189
|
+
const isTestDatabase = databaseName.includes(databasePrefix);
|
|
200
190
|
// dev/debug db
|
|
201
191
|
if (this.app.meta.isDev) {
|
|
202
192
|
// if enable testDatabase
|