mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-17 22:36:01 +00:00
@@ -46,6 +46,8 @@ const dialect = {
|
||||
dropReferencesWhenDropTable: false,
|
||||
requireStandaloneSelectForScopeIdentity: true,
|
||||
|
||||
dropColumnDependencies: ['dependencies'],
|
||||
|
||||
columnProperties: {
|
||||
columnComment: true,
|
||||
isUnsigned: true,
|
||||
|
||||
@@ -64,6 +64,21 @@ class Dumper extends SqlDumper {
|
||||
this.putCmd('^alter ^table %f ^rename ^column %i ^to %i', column, column.columnName, newcol);
|
||||
}
|
||||
|
||||
createForeignKeyFore(fk) {
|
||||
if (fk.constraintName != null && !this.dialect.anonymousForeignKey) {
|
||||
this.put('^constraint %i ', fk.constraintName);
|
||||
}
|
||||
this.put(
|
||||
'^foreign ^key (%,i) ^references %f (%,i)',
|
||||
fk.columns.map(x => x.columnName),
|
||||
{ schemaName: fk.refSchemaName, pureName: fk.refTableName },
|
||||
fk.columns.map(x => x.refColumnName)
|
||||
);
|
||||
if (fk.deleteAction && fk.deleteAction.toUpperCase() !== 'NO ACTION') {
|
||||
this.put(' ^on ^delete %k', fk.deleteAction);
|
||||
}
|
||||
}
|
||||
|
||||
// dropTable(obj, options = {}) {
|
||||
// this.put('^drop ^table');
|
||||
// if (options.testIfExists) this.put(' ^if ^exists');
|
||||
|
||||
@@ -129,6 +129,7 @@ class Analyser extends DatabaseAnalyser {
|
||||
updateAction: fkcol.on_update,
|
||||
deleteAction: fkcol.on_delete,
|
||||
constraintName: `FK_${tableName}_${fkcol.id}`,
|
||||
constraintType: 'foreignKey',
|
||||
};
|
||||
return fk;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user