-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Description
Feature proposal
Automatically generate models like
https://github.com/sequelize/sequelize-auto
from existing database
something like for mssql:
Declare @TableName varchar(128)
Set @TableName = 'myTable'
--@property({
-- type: 'number',
-- required: true,
--})
--Id: number;
select char(13)+'@property({ '+char(13)+
' type: '''+
case DATA_TYPE
when 'int' then 'number'
when 'varchar' then 'string'
when 'datetime' then 'date'
when 'bit' then 'boolean'
when 'smallint' then 'number'
when 'float' then 'number'
when 'text' then 'string'
else 'any' end
+''', '+char(13)+
' required: ' +case IS_NULLABLE when 'YES' then 'false' else 'true' end +', '+char(13)+
'})'+char(13)+
''++COLUMN_NAME+case IS_NULLABLE when '' then 'false' else '?' end+':'+
case DATA_TYPE
when 'int' then 'number'
when 'varchar' then 'string'
when 'datetime' then 'date'
when 'bit' then 'boolean'
when 'smallint' then 'number'
when 'float' then 'number'
when 'text' then 'string'
else 'any' end +';'
from INFORMATION_SCHEMA.COLUMNS
where TABLE_NAME=@TableName
Metadata
Metadata
Assignees
Labels
No labels