mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
fixes
This commit is contained in:
parent
728f3621eb
commit
cafe0e68c3
@ -199,14 +199,8 @@ export class SqlDumper implements AlterProcessor {
|
|||||||
|
|
||||||
selectScopeIdentity(table: TableInfo) {}
|
selectScopeIdentity(table: TableInfo) {}
|
||||||
|
|
||||||
columnDefinition(column: ColumnInfo, { includeDefault = true, includeNullable = true, includeCollate = true } = {}) {
|
columnType(dataType: string) {
|
||||||
if (column.computedExpression) {
|
const type = dataType || this.dialect.fallbackDataType;
|
||||||
this.put('^as %s', column.computedExpression);
|
|
||||||
if (column.isPersisted) this.put(' ^persisted');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const type = column.dataType || this.dialect.fallbackDataType;
|
|
||||||
const typeWithValues = type.match(/([^(]+)(\(.+[^)]\))/);
|
const typeWithValues = type.match(/([^(]+)(\(.+[^)]\))/);
|
||||||
|
|
||||||
if (typeWithValues?.length) {
|
if (typeWithValues?.length) {
|
||||||
@ -217,6 +211,17 @@ export class SqlDumper implements AlterProcessor {
|
|||||||
this.putRaw(SqlDumper.convertKeywordCase(type));
|
this.putRaw(SqlDumper.convertKeywordCase(type));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
columnDefinition(column: ColumnInfo, { includeDefault = true, includeNullable = true, includeCollate = true } = {}) {
|
||||||
|
if (column.computedExpression) {
|
||||||
|
this.put('^as %s', column.computedExpression);
|
||||||
|
if (column.isPersisted) this.put(' ^persisted');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.columnType(column.dataType);
|
||||||
|
|
||||||
if (column.autoIncrement) {
|
if (column.autoIncrement) {
|
||||||
this.autoIncrement();
|
this.autoIncrement();
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,15 @@ class Dumper extends SqlDumper {
|
|||||||
// oracle uses implicit transactions
|
// oracle uses implicit transactions
|
||||||
beginTransaction() {}
|
beginTransaction() {}
|
||||||
|
|
||||||
|
columnDefinition(col, options) {
|
||||||
|
if (col.autoIncrement) {
|
||||||
|
super.columnType(col.dataType);
|
||||||
|
this.put(' ^generated ^by ^default ^on ^null ^as ^identity');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
super.columnDefinition(col, options);
|
||||||
|
}
|
||||||
|
|
||||||
// /** @param type {import('dbgate-types').TransformType} */
|
// /** @param type {import('dbgate-types').TransformType} */
|
||||||
// transform(type, dumpExpr) {
|
// transform(type, dumpExpr) {
|
||||||
// switch (type) {
|
// switch (type) {
|
||||||
|
Loading…
Reference in New Issue
Block a user