@@ -11,6 +11,7 @@ import EntityType from "../../entity-query/EntityType.js";
1111import DateTime from "../../types/DateTime.js" ;
1212import IColumnSchema from "../../common/IColumnSchema.js" ;
1313import type EntityContext from "../../model/EntityContext.js" ;
14+ import ExistingSchema from "../base/ExistingSchema.js" ;
1415
1516export type ISqlServerConnectionString = IDbConnectionString & sql . config ;
1617
@@ -129,48 +130,6 @@ export class SqlServerConnection extends BaseConnection {
129130 super ( driver ) ;
130131 }
131132
132- async getColumnSchema ( schema : string ) : Promise < IColumnSchema [ ] > {
133- const text = `
134- SELECT
135- COLUMN_NAME as [name],
136- CASE DATA_TYPE
137- WHEN 'bit' THEN 'Boolean'
138- WHEN 'int' Then 'Int'
139- WHEN 'bigint' THEN 'BigInt'
140- WHEN 'date' then 'DateTime'
141- WHEN 'datetime' then 'DateTime'
142- WHEN 'datetime2' then 'DateTime'
143- WHEN 'real' then 'Float'
144- WHEN 'double' then 'Double'
145- WHEN 'decimal' then 'Decimal'
146- WHEN 'identity' then 'UUID'
147- WHEN 'varbinary' then 'ByteArray'
148- WHEN 'geometry' then 'Geometry'
149- ELSE 'Char'
150- END as [dataType],
151- CASE WHEN IS_NULLABLE = 'YES' THEN 1 ELSE 0 END as [nullable],
152- CHARACTER_MAXIMUM_LENGTH as [length],
153- CASE
154- WHEN COLUMN_DEFAULT = 'getutcdate()' then '() => Sql.date.now()'
155- WHEN COLUMN_DEFAULT = '(getutcdate())' then '() => Sql.date.now()'
156- WHEN COLUMN_DEFAULT = '(newid())' then '() => Sql.crypto.randomUUID()'
157- WHEN (COLUMN_DEFAULT = '(0)' OR COLUMN_DEFAULT = '((0))')
158- AND DATA_TYPE = 'bit' THEN '() => false'
159- WHEN (COLUMN_DEFAULT = '(1)' OR COLUMN_DEFAULT = '((1))')
160- AND DATA_TYPE = 'bit' THEN '() => true'
161- WHEN COLUMN_DEFAULT is NULL THEN ''
162- ELSE '() => ' + COLUMN_DEFAULT
163- END as [default],
164- ColumnProperty(OBJECT_ID(TABLE_SCHEMA+'.'+TABLE_NAME),COLUMN_NAME,'IsComputed') as [computed],
165- TABLE_NAME as [ownerName],
166- 'table' as [ownerType]
167- FROM INFORMATION_SCHEMA.COLUMNS
168- WHERE TABLE_SCHEMA = $1
169- ` ;
170- const r = await this . executeQuery ( { text, values : [ schema ] } ) ;
171- return r . rows ;
172- }
173-
174133 public async executeReader ( command : IQuery , signal ?: AbortSignal ) : Promise < IDbReader > {
175134 command = toQuery ( command ) ;
176135 let rq = await this . newRequest ( signal ) ;
0 commit comments