mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
further optimalization of frontend plugins
This commit is contained in:
parent
42e573a3ae
commit
0200c7c78b
@ -1,6 +1,5 @@
|
||||
const { SqlDumper } = require('dbgate-tools');
|
||||
const SqlDumper = require('dbgate-tools/lib/SqlDumper');
|
||||
|
||||
class Dumper extends SqlDumper {
|
||||
}
|
||||
class Dumper extends SqlDumper {}
|
||||
|
||||
module.exports = Dumper;
|
||||
|
@ -1,4 +1,4 @@
|
||||
const { driverBase } = require('dbgate-tools');
|
||||
const driverBase = require('dbgate-tools/lib/driverBase');
|
||||
const Dumper = require('./Dumper');
|
||||
|
||||
const mongoIdRegex = /^[0-9a-f]{24}$/;
|
||||
|
@ -1,4 +1,4 @@
|
||||
const { SqlDumper } = require('dbgate-tools');
|
||||
const SqlDumper = require('dbgate-tools/lib/SqlDumper');
|
||||
|
||||
class MsSqlDumper extends SqlDumper {
|
||||
autoIncrement() {
|
||||
@ -67,12 +67,12 @@ class MsSqlDumper extends SqlDumper {
|
||||
|
||||
dropDefault(col) {
|
||||
if (col.defaultConstraint) {
|
||||
this.putCmd("^alter ^table %f ^drop ^constraint %i", col, col.defaultConstraint);
|
||||
this.putCmd('^alter ^table %f ^drop ^constraint %i', col, col.defaultConstraint);
|
||||
}
|
||||
}
|
||||
|
||||
guessDefaultName(col) {
|
||||
return col.defaultConstraint || `DF${col.schemaName || 'dbo'}_${col.pureName}_col.columnName`
|
||||
return col.defaultConstraint || `DF${col.schemaName || 'dbo'}_${col.pureName}_col.columnName`;
|
||||
}
|
||||
|
||||
createDefault(col) {
|
||||
@ -80,7 +80,7 @@ class MsSqlDumper extends SqlDumper {
|
||||
const defsql = col.defaultValue;
|
||||
if (!defsql) {
|
||||
const defname = this.guessDefaultName(col);
|
||||
this.putCmd("^alter ^table %f ^add ^constraint %i ^default %s for %i", col, defname, defsql, col.columnName);
|
||||
this.putCmd('^alter ^table %f ^add ^constraint %i ^default %s for %i', col, defname, defsql, col.columnName);
|
||||
}
|
||||
}
|
||||
|
||||
@ -89,8 +89,14 @@ class MsSqlDumper extends SqlDumper {
|
||||
}
|
||||
|
||||
renameConstraint(cnt, newname) {
|
||||
if (cnt.constraintType == 'index') this.putCmd("^execute sp_rename '%f.%i', '%s', 'INDEX'", cnt, cnt.constraintName, newname);
|
||||
else this.putCmd("^execute sp_rename '%f', '%s', 'OBJECT'", { schemaName: cnt.schemaName, pureName: cnt.constraintName }, newname);
|
||||
if (cnt.constraintType == 'index')
|
||||
this.putCmd("^execute sp_rename '%f.%i', '%s', 'INDEX'", cnt, cnt.constraintName, newname);
|
||||
else
|
||||
this.putCmd(
|
||||
"^execute sp_rename '%f', '%s', 'OBJECT'",
|
||||
{ schemaName: cnt.schemaName, pureName: cnt.constraintName },
|
||||
newname
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -109,5 +115,4 @@ MsSqlDumper.prototype.changeTriggerSchema = MsSqlDumper.prototype.changeObjectSc
|
||||
MsSqlDumper.prototype.renameTable = MsSqlDumper.prototype.renameObject;
|
||||
MsSqlDumper.prototype.changeTableSchema = MsSqlDumper.prototype.changeObjectSchema;
|
||||
|
||||
|
||||
module.exports = MsSqlDumper;
|
||||
|
@ -1,4 +1,4 @@
|
||||
const { driverBase } = require('dbgate-tools');
|
||||
const driverBase = require('dbgate-tools/lib/driverBase');
|
||||
const MsSqlDumper = require('./MsSqlDumper');
|
||||
|
||||
/** @type {import('dbgate-types').SqlDialect} */
|
||||
|
@ -1,4 +1,4 @@
|
||||
const { SqlDumper } = require('dbgate-tools');
|
||||
const SqlDumper = require('dbgate-tools/lib/SqlDumper');
|
||||
|
||||
class Dumper extends SqlDumper {
|
||||
/** @param type {import('dbgate-types').TransformType} */
|
||||
|
@ -1,4 +1,4 @@
|
||||
const { driverBase } = require('dbgate-tools');
|
||||
const driverBase = require('dbgate-tools/lib/driverBase');
|
||||
const Dumper = require('./Dumper');
|
||||
|
||||
/** @type {import('dbgate-types').SqlDialect} */
|
||||
|
@ -1,4 +1,4 @@
|
||||
const { SqlDumper } = require('dbgate-tools');
|
||||
const SqlDumper = require('dbgate-tools/lib/SqlDumper');
|
||||
|
||||
class Dumper extends SqlDumper {
|
||||
/** @param type {import('dbgate-types').TransformType} */
|
||||
|
@ -1,4 +1,4 @@
|
||||
const { driverBase } = require('dbgate-tools');
|
||||
const driverBase = require('dbgate-tools/lib/driverBase');
|
||||
const Dumper = require('./Dumper');
|
||||
|
||||
/** @type {import('dbgate-types').SqlDialect} */
|
||||
|
@ -1,6 +1,5 @@
|
||||
const { SqlDumper } = require('dbgate-tools');
|
||||
const SqlDumper = require('dbgate-tools/lib/SqlDumper');
|
||||
|
||||
class Dumper extends SqlDumper {
|
||||
}
|
||||
class Dumper extends SqlDumper {}
|
||||
|
||||
module.exports = Dumper;
|
||||
|
@ -1,4 +1,4 @@
|
||||
const { driverBase } = require('dbgate-tools');
|
||||
const driverBase = require('dbgate-tools/lib/driverBase');
|
||||
const Dumper = require('./Dumper');
|
||||
|
||||
function getDatabaseFileLabel(databaseFile) {
|
||||
|
Loading…
Reference in New Issue
Block a user