Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
c69527c
feat: add comma expression node
hdnax Jan 13, 2026
790d67c
feat: add comma expression node to markInvalid
hdnax Jan 13, 2026
87906aa
feat: support parsing comma expression
hdnax Jan 13, 2026
a26bd93
test: update comments
hdnax Jan 14, 2026
c7cea2c
feat: add Records element kind
hdnax Jan 14, 2026
7373ec7
feat: init Records validator and binder
hdnax Jan 14, 2026
fdb41d6
feat: implement records validator
hdnax Jan 14, 2026
77f932e
feat: implement records binder
hdnax Jan 14, 2026
0ec11b8
feat: init RecordsChecker
hdnax Jan 14, 2026
8efea46
feat: support scientific notation
hdnax Jan 14, 2026
906b2cf
feat: basic interpretation of records & type checking
hdnax Jan 14, 2026
7ba7dcd
feat: add suggestions for records and enum in records fields
hdnax Jan 15, 2026
bf10c58
feat: add suggestions for records
hdnax Jan 15, 2026
4a3b3ba
fix: disallow spaces between callee and args in call expressions & pr…
hdnax Jan 15, 2026
b53041d
fix: update some tests & fix some suggestion services
hdnax Jan 15, 2026
405356f
test: cover more cases related to records
hdnax Jan 15, 2026
3c2acf3
refactor: use ElementKind.Records for more robust comparison
hdnax Jan 15, 2026
590900e
feat: allow non-null column to have null if there is increment
hdnax Jan 15, 2026
00095d6
fix: handle mixed records and records inside tables
hdnax Jan 15, 2026
0be81f5
feat: make datetime error message clearer
hdnax Jan 15, 2026
f676e97
feat: add option to expand all columns
hdnax Jan 15, 2026
7b2edb9
fix: fail to expand * in Records tuple nested in table
hdnax Jan 15, 2026
2221336
feat: add basic hover provider
hdnax Jan 15, 2026
eb2e9e4
fix: enhance error message and fk violation detection when the target…
hdnax Jan 15, 2026
e6c3bad
fix: remove unnecessary comments
hdnax Jan 15, 2026
896c20b
Revert "feat: add basic hover provider"
hdnax Jan 15, 2026
59228cd
fix: remove unused getRefRelation
hdnax Jan 16, 2026
002216a
fix: simplify default handling
hdnax Jan 16, 2026
3e2fdcb
doc: refactor comments of fk validator
hdnax Jan 16, 2026
27b5a94
refactor: simplify
hdnax Jan 16, 2026
813c5f1
refactor: DbmlExporter logic for sample data
hdnax Jan 16, 2026
d8030ac
refactor: simplify sample data handling
hdnax Jan 16, 2026
21d96dd
fix: remove is_expression from RecordValue
hdnax Jan 16, 2026
ec4e61f
feat: add insert statement handling to snowflake parser
hdnax Jan 16, 2026
9cfd59b
feat: disallow duplicate column in records
hdnax Jan 16, 2026
10dd287
feat: add string to string types
hdnax Jan 16, 2026
ee4a90a
feat: add sql exporters for INSERT
hdnax Jan 16, 2026
4cb1c25
fix: disable * suggestion in records that already has some columns
hdnax Jan 16, 2026
94d29f6
fix: disallow newline in csv
hdnax Jan 16, 2026
34d9c15
test: update errorneous tests
hdnax Jan 16, 2026
f94cf12
fix: infinite loop in comma expression parsing
hdnax Jan 16, 2026
e1f10df
refactor: use @dbml/parse utils for value formatter in dbml exporter
hdnax Jan 16, 2026
3b1510e
fix: make @dbml/parse Database compatible with @dbml/core RawDatabase
hdnax Jan 16, 2026
2f421d6
chore: lint and rename
hdnax Jan 18, 2026
80486fa
test: update snapshots
hdnax Jan 18, 2026
20f2cb1
chore: lint issues
hdnax Jan 18, 2026
a70956d
fix: improve unknown columns in records error messages
hdnax Jan 19, 2026
c131027
fix: handle record validation using constraints from table partials
hdnax Jan 19, 2026
77d344f
fix: improve error messages
hdnax Jan 19, 2026
800e54d
refactor: inline messages.ts into each constraints validator
hdnax Jan 19, 2026
e821b7f
fix: properly handle enum value validation
hdnax Jan 19, 2026
3a1a13c
feat: validate type params
hdnax Jan 19, 2026
7029db2
feat: add snippet for records and correctly validate string length us…
hdnax Jan 19, 2026
bd3d48e
chore: lint issues
hdnax Jan 19, 2026
436de5f
feat: convert records validation errors to warning
hdnax Jan 19, 2026
55e6c30
feat: add Diagnostics provider
hdnax Jan 19, 2026
14fe55d
doc: remove outdated comment
hdnax Jan 19, 2026
b8cc0e7
test: update test expectations
hdnax Jan 20, 2026
b4e2dd0
fix: revert add snippets
hdnax Jan 20, 2026
4e999c0
fix: handle newlines in records
hdnax Jan 20, 2026
9b7ae57
fix: handle backslash in dbml/exporter
hdnax Jan 20, 2026
0f9e854
test: add more tests for sample data export and import
hdnax Jan 20, 2026
20da443
fix: make dbml exporter value extraction more robust
hdnax Jan 20, 2026
54b935a
feat: add snippet for record entries
hdnax Jan 20, 2026
c8cd72b
fix: improve inline completion provider
hdnax Jan 21, 2026
db9e827
fix: only trigger inline completion for records on empty line
hdnax Jan 21, 2026
0f0498e
fix: fallback values for data type mismatches
hdnax Jan 21, 2026
2e67c48
fix: resolve enum in table partial column type
hdnax Jan 21, 2026
7d29967
fix: export record value type
hdnax Jan 21, 2026
7b7ec3f
feat: separate warnings for composite constraints violation
hdnax Jan 21, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Table users {
id integer [pk]
name varchar
email varchar
active boolean
created_at timestamp
}

Table posts {
id integer [pk]
user_id integer
title varchar
content text
}

Ref: users.id < posts.user_id

Records users(id, name, email, active, created_at) {
1, "Alice", "alice@example.com", true, "2024-01-15 10:30:00"
2, "Bob", "bob@example.com", false, "2024-01-16 14:20:00"
3, "Charlie", null, true, "2024-01-17 09:15:00"
}

Records posts(id, user_id, title, content) {
1, 1, "First Post", "Hello World"
2, 1, "Second Post", "It's a beautiful day"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
CREATE TABLE [users] (
[id] integer PRIMARY KEY,
[name] nvarchar(255),
[email] nvarchar(255),
[active] boolean,
[created_at] timestamp
)
GO

CREATE TABLE [posts] (
[id] integer PRIMARY KEY,
[user_id] integer,
[title] nvarchar(255),
[content] text
)
GO

ALTER TABLE [users] ADD FOREIGN KEY ([id]) REFERENCES [posts] ([user_id])
GO

-- Disable constraint checks for INSERT (SQL Server does not support DEFERRED)
EXEC sp_MSforeachtable "ALTER TABLE ? NOCHECK CONSTRAINT all";
GO

INSERT INTO [users] ([id], [name], [email], [active], [created_at])
VALUES
(1, 'Alice', 'alice@example.com', 1, '2024-01-15 10:30:00'),
(2, 'Bob', 'bob@example.com', 0, '2024-01-16 14:20:00'),
(3, 'Charlie', NULL, 1, '2024-01-17 09:15:00');
GO
INSERT INTO [posts] ([id], [user_id], [title], [content])
VALUES
(1, 1, 'First Post', 'Hello World'),
(2, 1, 'Second Post', 'It''s a beautiful day');
GO

-- Re-enable constraint checks
EXEC sp_MSforeachtable "ALTER TABLE ? WITH CHECK CHECK CONSTRAINT all";
GO
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Table users {
id integer [pk]
name varchar
email varchar
active boolean
created_at timestamp
}

Table posts {
id integer [pk]
user_id integer
title varchar
content text
}

Ref: users.id < posts.user_id

Records users(id, name, email, active, created_at) {
1, "Alice", "alice@example.com", true, "2024-01-15 10:30:00"
2, "Bob", "bob@example.com", false, "2024-01-16 14:20:00"
3, "Charlie", null, true, "2024-01-17 09:15:00"
}

Records posts(id, user_id, title, content) {
1, 1, "First Post", "Hello World"
2, 1, "Second Post", "It's a beautiful day"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Table edge_cases {
id integer [pk]
scientific_notation_pos float
scientific_notation_neg float
signed_positive integer
signed_negative integer
sql_function_default varchar
dbml_expr_default integer
datetime_value timestamp
string_with_newline text
string_with_backslash varchar
string_with_escape_seq varchar
string_with_quotes varchar
null_value varchar
}

Records edge_cases(id, scientific_notation_pos, scientific_notation_neg, signed_positive, signed_negative, sql_function_default, dbml_expr_default, datetime_value, string_with_newline, string_with_backslash, string_with_escape_seq, string_with_quotes, null_value) {
1, 1.23e5, -4.56e-3, +42, -100, `NOW()`, `1 + 2 * 3`, "2024-01-15 10:30:00.123456", "Line 1\nLine 2\nLine 3", "C:\\Users\\path\\file.txt", "Tab:\tNewline:\nCarriage return:\r", "She said \"Hello\" and 'Hi'", null
2, 9.99e10, -1.11e-10, +0, -0, `CURRENT_TIMESTAMP`, `LENGTH('test')`, "2023-12-31 23:59:59", "First line\n\nThird line", "Escaped backslash: \\\\", "Quote: \" Apostrophe: ' Backslash: \\", "O'Reilly's \"book\"", null
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
CREATE TABLE `users` (
`id` integer PRIMARY KEY,
`name` varchar(255),
`email` varchar(255),
`active` boolean,
`created_at` timestamp
);

CREATE TABLE `posts` (
`id` integer PRIMARY KEY,
`user_id` integer,
`title` varchar(255),
`content` text
);

ALTER TABLE `users` ADD FOREIGN KEY (`id`) REFERENCES `posts` (`user_id`);

-- Disable foreign key checks for INSERT (MySQL does not support DEFERRED)
SET FOREIGN_KEY_CHECKS = 0;

INSERT INTO `users` (`id`, `name`, `email`, `active`, `created_at`)
VALUES
(1, 'Alice', 'alice@example.com', 1, '2024-01-15 10:30:00'),
(2, 'Bob', 'bob@example.com', 0, '2024-01-16 14:20:00'),
(3, 'Charlie', NULL, 1, '2024-01-17 09:15:00');
INSERT INTO `posts` (`id`, `user_id`, `title`, `content`)
VALUES
(1, 1, 'First Post', 'Hello World'),
(2, 1, 'Second Post', 'It''s a beautiful day');

-- Re-enable foreign key checks
SET FOREIGN_KEY_CHECKS = 1;
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
CREATE TABLE `edge_cases` (
`id` integer PRIMARY KEY,
`scientific_notation_pos` float,
`scientific_notation_neg` float,
`signed_positive` integer,
`signed_negative` integer,
`sql_function_default` varchar(255),
`dbml_expr_default` integer,
`datetime_value` timestamp,
`string_with_newline` text,
`string_with_backslash` varchar(255),
`string_with_escape_seq` varchar(255),
`string_with_quotes` varchar(255),
`null_value` varchar(255)
);

-- Disable foreign key checks for INSERT (MySQL does not support DEFERRED)
SET FOREIGN_KEY_CHECKS = 0;

INSERT INTO `edge_cases` (`id`, `scientific_notation_pos`, `scientific_notation_neg`, `signed_positive`, `signed_negative`, `sql_function_default`, `dbml_expr_default`, `datetime_value`, `string_with_newline`, `string_with_backslash`, `string_with_escape_seq`, `string_with_quotes`, `null_value`)
VALUES
(1, 123000, -0.00456, 42, -100, NOW(), 1 + 2 * 3, '2024-01-15 10:30:00.123456', 'Line 1
Line 2
Line 3', 'C:\\Users\\path\\file.txt', 'Tab: Newline:
Carriage return:', 'She said "Hello" and ''Hi''', NULL),
(2, 99900000000, -1.11e-10, 0, 0, CURRENT_TIMESTAMP, LENGTH('test'), '2023-12-31 23:59:59', 'First line

Third line', 'Escaped backslash: \\\\', 'Quote: " Apostrophe: '' Backslash: \\', 'O''Reilly''s "book"', NULL);

-- Re-enable foreign key checks
SET FOREIGN_KEY_CHECKS = 1;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Table users {
id integer [pk]
name varchar
email varchar
active boolean
created_at timestamp
}

Table posts {
id integer [pk]
user_id integer
title varchar
content text
}

Ref: users.id < posts.user_id

Records users(id, name, email, active, created_at) {
1, "Alice", "alice@example.com", true, "2024-01-15 10:30:00"
2, "Bob", "bob@example.com", false, "2024-01-16 14:20:00"
3, "Charlie", null, true, "2024-01-17 09:15:00"
}

Records posts(id, user_id, title, content) {
1, 1, "First Post", "Hello World"
2, 1, "Second Post", "It's a beautiful day"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
CREATE TABLE "users" (
"id" integer PRIMARY KEY,
"name" varchar,
"email" varchar,
"active" boolean,
"created_at" timestamp
);

CREATE TABLE "posts" (
"id" integer PRIMARY KEY,
"user_id" integer,
"title" varchar,
"content" text
);

ALTER TABLE "users" ADD FOREIGN KEY ("id") REFERENCES "posts" ("user_id");

-- Use deferred constraints for INSERT
SET CONSTRAINTS ALL DEFERRED;

INSERT ALL
INTO "users" ("id", "name", "email", "active", "created_at") VALUES (1, 'Alice', 'alice@example.com', 1, '2024-01-15 10:30:00')
INTO "users" ("id", "name", "email", "active", "created_at") VALUES (2, 'Bob', 'bob@example.com', 0, '2024-01-16 14:20:00')
INTO "users" ("id", "name", "email", "active", "created_at") VALUES (3, 'Charlie', NULL, 1, '2024-01-17 09:15:00')
SELECT * FROM dual;
INSERT ALL
INTO "posts" ("id", "user_id", "title", "content") VALUES (1, 1, 'First Post', 'Hello World')
INTO "posts" ("id", "user_id", "title", "content") VALUES (2, 1, 'Second Post', 'It''s a beautiful day')
SELECT * FROM dual;

COMMIT;
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Table users {
id integer [pk]
name varchar
email varchar
active boolean
created_at timestamp
}

Table posts {
id integer [pk]
user_id integer
title varchar
content text
}

Ref: users.id < posts.user_id

Records users(id, name, email, active, created_at) {
1, "Alice", "alice@example.com", true, "2024-01-15 10:30:00"
2, "Bob", "bob@example.com", false, "2024-01-16 14:20:00"
3, "Charlie", null, true, "2024-01-17 09:15:00"
}

Records posts(id, user_id, title, content) {
1, 1, "First Post", "Hello World"
2, 1, "Second Post", "It's a beautiful day"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Table edge_cases {
id integer [pk]
scientific_notation_pos float
scientific_notation_neg float
signed_positive integer
signed_negative integer
sql_function_default varchar
dbml_expr_default integer
datetime_value timestamp
string_with_newline text
string_with_backslash varchar
string_with_escape_seq varchar
string_with_quotes varchar
null_value varchar
}

Records edge_cases(id, scientific_notation_pos, scientific_notation_neg, signed_positive, signed_negative, sql_function_default, dbml_expr_default, datetime_value, string_with_newline, string_with_backslash, string_with_escape_seq, string_with_quotes, null_value) {
1, 1.23e5, -4.56e-3, +42, -100, `NOW()`, `1 + 2 * 3`, "2024-01-15 10:30:00.123456", "Line 1\nLine 2\nLine 3", "C:\\Users\\path\\file.txt", "Tab:\tNewline:\nCarriage return:\r", "She said \"Hello\" and 'Hi'", null
2, 9.99e10, -1.11e-10, +0, -0, `CURRENT_TIMESTAMP`, `LENGTH('test')`, "2023-12-31 23:59:59", "First line\n\nThird line", "Escaped backslash: \\\\", "Quote: \" Apostrophe: ' Backslash: \\", "O'Reilly's \"book\"", null
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
CREATE TABLE "users" (
"id" integer PRIMARY KEY,
"name" varchar,
"email" varchar,
"active" boolean,
"created_at" timestamp
);

CREATE TABLE "posts" (
"id" integer PRIMARY KEY,
"user_id" integer,
"title" varchar,
"content" text
);

ALTER TABLE "users" ADD FOREIGN KEY ("id") REFERENCES "posts" ("user_id");

-- Use deferred constraints for INSERT
BEGIN;
SET CONSTRAINTS ALL DEFERRED;

INSERT INTO "users" ("id", "name", "email", "active", "created_at")
VALUES
(1, 'Alice', 'alice@example.com', TRUE, '2024-01-15 10:30:00'),
(2, 'Bob', 'bob@example.com', FALSE, '2024-01-16 14:20:00'),
(3, 'Charlie', NULL, TRUE, '2024-01-17 09:15:00');
INSERT INTO "posts" ("id", "user_id", "title", "content")
VALUES
(1, 1, 'First Post', 'Hello World'),
(2, 1, 'Second Post', 'It''s a beautiful day');

COMMIT;
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
CREATE TABLE "edge_cases" (
"id" integer PRIMARY KEY,
"scientific_notation_pos" float,
"scientific_notation_neg" float,
"signed_positive" integer,
"signed_negative" integer,
"sql_function_default" varchar,
"dbml_expr_default" integer,
"datetime_value" timestamp,
"string_with_newline" text,
"string_with_backslash" varchar,
"string_with_escape_seq" varchar,
"string_with_quotes" varchar,
"null_value" varchar
);

-- Use deferred constraints for INSERT
BEGIN;
SET CONSTRAINTS ALL DEFERRED;

INSERT INTO "edge_cases" ("id", "scientific_notation_pos", "scientific_notation_neg", "signed_positive", "signed_negative", "sql_function_default", "dbml_expr_default", "datetime_value", "string_with_newline", "string_with_backslash", "string_with_escape_seq", "string_with_quotes", "null_value")
VALUES
(1, 123000, -0.00456, 42, -100, NOW(), 1 + 2 * 3, '2024-01-15 10:30:00.123456', 'Line 1
Line 2
Line 3', 'C:\Users\path\file.txt', 'Tab: Newline:
Carriage return:', 'She said "Hello" and ''Hi''', NULL),
(2, 99900000000, -1.11e-10, 0, 0, CURRENT_TIMESTAMP, LENGTH('test'), '2023-12-31 23:59:59', 'First line

Third line', 'Escaped backslash: \\', 'Quote: " Apostrophe: '' Backslash: \', 'O''Reilly''s "book"', NULL);

COMMIT;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
-- Test edge cases for data types: scientific notation in defaults, signed numbers, datetime
CREATE TABLE [sample_data_test] (
[id] int,
[scientific_num] decimal(20,10) DEFAULT 1.23e-5,
[signed_positive] int DEFAULT +42,
[signed_negative] int DEFAULT -99,
[sql_func_default] datetime DEFAULT (GETDATE()),
[datetime_val] datetime DEFAULT '2024-01-15 10:30:00',
[string_simple] nvarchar(200) DEFAULT 'test value',
[computed_expr] AS ([id] + 10) PERSISTED
)
GO
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Table "sample_data_test" {
"id" int
"scientific_num" decimal(20,10) [default: 1.23e-5]
"signed_positive" int [default: +42]
"signed_negative" int [default: -99]
"sql_func_default" datetime [default: `GETDATE()`]
"datetime_val" datetime [default: '2024-01-15 10:30:00']
"string_simple" nvarchar(200) [default: 'test value']
"computed_expr" "AS [id] + 10 PERSISTED"
}
Loading
Loading