Public: anyone can read this; the crew can change it.
A `.sql` file in a repository opens as its schema: each CREATE TABLE as its columns, other statements one per row #11196
A .sql file now opens as one block per statement, with the raw source still one tap away. I did not call keepplan, so the plan on the issue was never updated. tsc, scripts/gate.ts, design-lint and 248 render/file tests pass.
stopped closed without shipping deploy 7f9502e
A .sql file now opens as one block per statement, with the raw source still one tap away. I did not call keep_plan, so the plan on the issue was never updated. tsc, scripts/gate.ts, design-lint and 248 render/file tests pass. I did not run the full suite or open a file in a running app.
What changed
- Parser: the new
src/web/render/sql.tsis plain TypeScript with no dependency. It splits statements outside quotes, comments and parentheses. CREATE TABLE: it shows anh3with the table name and a dense.tablewith a row per column (name, type, NOT NULL, PRIMARY KEY, DEFAULT). A table-levelPRIMARY KEY (a, b)marks those columns, and the other table-level constraints are listed under the table.- Other statements: each is one row with its first line.
- Fallback: a file with no recognisable SQL, or an unterminated quote or comment, shows the plain source with a reason instead of an error. A
CREATE TABLEit can't parse becomes one ordinary row. - Escaping and cap: every name is escaped by the template. The file size cap is 1 MB, and at most 500 statements and 500 columns per table are drawn, then "N more not shown".
- Wiring:
sqlis added as a kind inkinds.tsandrenderers.ts. Only the.sqlextension reaches it, so other kinds are unaffected. - Docs and tests:
test/render-sql.test.tscovers constraints, comments, a quoted name containing<, an unparsable file, malformed tables and the cap.test/render-kinds.test.tsgets a one-line.sqlsample entry.docs/features/file-sql.mdsays what a reader sees, anddocs/design/areas/render.mdgets a short section.
Chose not to do
- There is no dollar-quoted (
$$) body handling or dialect-specific parsing; unusual syntax falls to the one-row form. - There is no terminal (TUI) view, which the env renderer has.
Push note: the pre-push hook wanted a Try: commit, so there's an empty one at the end of the branch.
Try it: open any db/*.sql or migration file in a repository. Add ?view=source to see the raw text.
🤖 Generated with Claude Code
Declined: the preview deploy did not fail. The log ends done: https://lab--11196--forge-trevato-apps.open-platform.sh, the process was up in 4.2 s, and / on the preview answers 200. "No tests declared, none run" is a note, not an error. It is there because forge.json has no test command; the tests run through check, which the forge runs on each push. There is nothing in the pull to fix. Run log: https://forge.open-platform.sh/trevato/forge/runs/01m745q54hpjqkgewq1hk0j829
A
.sqlfile now opens as one block per statement, with the raw source still one tap away. I did not callkeep_plan, so the plan on the issue was never updated.tsc,scripts/gate.ts,design-lintand 248 render/file tests pass. I did not run the full suite or open a file in a running app.What changed
src/web/render/sql.tsis plain TypeScript with no dependency. It splits statements outside quotes, comments and parentheses.CREATE TABLE: it shows anh3with the table name and a dense.tablewith a row per column (name, type, NOT NULL, PRIMARY KEY, DEFAULT). A table-levelPRIMARY KEY (a, b)marks those columns, and the other table-level constraints are listed under the table.CREATE TABLEit can't parse becomes one ordinary row.sqlis added as a kind inkinds.tsandrenderers.ts. Only the.sqlextension reaches it, so other kinds are unaffected.test/render-sql.test.tscovers constraints, comments, a quoted name containing<, an unparsable file, malformed tables and the cap.test/render-kinds.test.tsgets a one-line.sqlsample entry.docs/features/file-sql.mdsays what a reader sees, anddocs/design/areas/render.mdgets a short section.Chose not to do
$$) body handling or dialect-specific parsing; unusual syntax falls to the one-row form.Push note: the pre-push hook wanted a
Try:commit, so there's an empty one at the end of the branch.Try it: open any
db/*.sqlor migration file in a repository. Add?view=sourceto see the raw text.🤖 Generated with Claude Code
Closes #11187