Skip to content

default modifier: support function-call syntax and quoted string literals#5

Merged
nemorize merged 3 commits into
mainfrom
copilot/remove-quotes-default-modifier
Apr 13, 2026
Merged

default modifier: support function-call syntax and quoted string literals#5
nemorize merged 3 commits into
mainfrom
copilot/remove-quotes-default-modifier

Conversation

Copilot AI commented Apr 13, 2026

Copy link
Copy Markdown
Contributor

SQL function calls like NOW() should not require quoting in default(...). String typed values should carry their quotes in the AST. Two related fixes:

Parser

  • Added TOKEN_STRING case — stores value with surrounding double quotes (e.g. "active")
  • Added function-call detection for IDENT — when followed by (), stores as NOW() instead of requiring "NOW()"

Usage

created_at timestamp not-null default(NOW())   # function call — no quotes needed
status     varchar   not-null default("draft") # string literal — quotes preserved
sort_order int       not-null default(0)       # number

Updated

  • All example .erdn files: default("NOW()")default(NOW())
  • website/syntax.md, website/guide.md, README.md: docs and examples updated to reflect both forms; syntax description now mentions function calls as a supported value kind
  • Parser tests: added TestParseDefaultFunctionCall; updated TestParseDefaultModifier to use quoted string form

@github-actions

Copy link
Copy Markdown

🗂 ER Diagram Render

Tests passedgo test ./...

advanced.erdn

  • SVG rendered successfully (34.1 KB)

blog.erdn

  • SVG rendered successfully (85.4 KB)

cjk.erdn

  • SVG rendered successfully (80.6 KB)

ecommerce.erdn

  • SVG rendered successfully (104.8 KB)

simple.erdn

  • SVG rendered successfully (16.0 KB)

📦 Download diagrams — open the workflow run and expand Artifacts to download the SVG archive.

@nemorize nemorize marked this pull request as ready for review April 13, 2026 23:34
@nemorize nemorize merged commit 3dbfbf4 into main Apr 13, 2026
2 checks passed
@nemorize nemorize deleted the copilot/remove-quotes-default-modifier branch April 13, 2026 23:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants