Can't convert microsoft sql server script to dbml
I maintainer di solito rispondono entro 1 giorno
@huydo862003 ci sta già lavorando.
Dal 6/11/2025.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
I try to use js module to convert sql script to dbml.
Here is my sql script
CREATE TABLE dbo.hello (
id int IDENTITY(1,1) NOT NULL,
created_at datetime2(3) DEFAULT getdate() NOT NULL,
updated_at datetime2(3) DEFAULT getdate() NOT NULL,
deleted_at datetime2(3) NULL,
[key] nvarchar(225) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[value] int NOT NULL,
[w_id] int NOT NULL,
CONSTRAINT PK_8a11c3956fec7db6df1a0244e5f PRIMARY KEY (id)
);
CREATE UNIQUE NONCLUSTERED INDEX UQ_393c557e09ac67c724f8ec7334f ON dbo.hello ([key]);
CREATE UNIQUE NONCLUSTERED INDEX REL_4a6194b005c383df6539faa3f3 ON dbo.hello ( w_id ASC )
WHERE ([w_id] IS NOT NULL)
WITH ( PAD_INDEX = OFF ,FILLFACTOR = 100 ,SORT_IN_TEMPDB = OFF , IGNORE_DUP_KEY = OFF , STATISTICS_NORECOMPUTE = OFF , ONLINE = OFF , ALLOW_ROW_LOCKS = ON , ALLOW_PAGE_LOCKS = ON )
ON [PRIMARY ] ;
Here is my js script
const ddl = fs.readFileSync('./dbdocs/database.ddl', 'utf-8')
fs.writeFileSync('./dbdocs/database.dbml', importer.import(ddl, 'mssql'))
And I got an error message:
Error:
-- PARSING FAILED --------------------------------------------------
11 | CREATE UNIQUE NONCLUSTERED INDEX UQ_393c557e09ac67c724f8ec7334f ON dbo.hello ([key]);
12 | CREATE UNIQUE NONCLUSTERED INDEX REL_4a6194b005c383df6539faa3f3 ON dbo.hello ( w_id ASC )
> 13 | WHERE ([w_id] IS NOT NULL)
| ^
14 | WITH ( PAD_INDEX = OFF ,FILLFACTOR = 100 ,SORT_IN_TEMPDB = OFF , IGNORE_DUP_KEY = OFF , STATISTICS_NORECOMPUTE = OFF , ONLINE = OFF , ALLOW_ROW_LOCKS = ON , ALLOW_PAGE_LOCKS = ON )
15 | ON [PRIMARY ] ;
Expected one of the following:
comments, identifier, whitespaces
at Parsimmon._.tryParse (/Users/eugene/code/sto/sto-dapp/node_modules/parsimmon/src/parsimmon.js:928:15)
at Parsimmon.mssqlParser.parseWithPegError (/Users/eugene/code/sto/sto-dapp/node_modules/@dbml/core/lib/parse/mssql/index.js:7:24)
at Function.parseMSSQLToJSON (/Users/eugene/code/sto/sto-dapp/node_modules/@dbml/core/lib/parse/Parser.js:64:38)
at Function.parse (/Users/eugene/code/sto/sto-dapp/node_modules/@dbml/core/lib/parse/Parser.js:89:32)
at Object._import [as import] (/Users/eugene/code/sto/sto-dapp/node_modules/@dbml/core/lib/import/index.js:15:37)
at Object.<anonymous> (/Users/eugene/code/sto/sto-dapp/dbdocs/convert.ts:6:59)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Module.m._compile (/Users/eugene/code/sto/sto-dapp/node_modules/ts-node/src/index.ts:1455:23)
at Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Object.require.extensions.<computed> [as .ts] (/Users/eugene/code/sto/sto-dapp/node_modules/ts-node/src/index.ts:1458:12) {
type: 'ParsimmonError',
result: {
status: false,
index: { offset: 557, line: 13, column: 9 },
expected: [ 'comments', 'identifier', 'whitespaces' ]
}
}
{
name: 'SyntaxError',
location: { start: { offset: 557, line: 13, column: 9 } },
found: '(',
message: 'Expected comments, identifier, or whitespaces but "(" found.'
}
I have tried to run this sql script on sql server, and it can success create table and index
- Lingua principale
- JavaScript
- Stelle
- 3.7k
- Fork
- 233
- Merge medio
- 2g 4h
- PR unite (30g)
- 23
Preparare l'ambiente
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di holistics/dbml
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
@dbml/core 12.0.0 Postgres importer: timestamptz becomes timestamp, schema-qualified type doubled, Ref with ?<? rejected by parserForse già presa @zzoraemon043 l’ha presa 2 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 38/100
holistics/dbml#884 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 48/100
holistics/dbml#880 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
holistics/dbml#868 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di holistics/dbml
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
mailcow/mailcow-dockerized#7677 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
gcivil-nyu-org/team5-mon-fall26#145 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
needs discussion
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
openfga/openfga.dev#1436 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni