@cchistory/lite 0.4.4 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/INSTALL.md +1 -1
- package/apps/lite-cli/dist/agent-contract.d.ts +4 -5
- package/apps/lite-cli/dist/agent-contract.d.ts.map +1 -1
- package/apps/lite-cli/dist/agent-contract.js +35 -28
- package/apps/lite-cli/dist/agent-contract.js.map +1 -1
- package/apps/lite-cli/dist/bin.js +3 -3
- package/apps/lite-cli/dist/bin.js.map +1 -1
- package/apps/lite-cli/dist/index.d.ts.map +1 -1
- package/apps/lite-cli/dist/index.js +155 -81
- package/apps/lite-cli/dist/index.js.map +1 -1
- package/apps/lite-cli/dist/index.test.js +87 -63
- package/apps/lite-cli/dist/index.test.js.map +1 -1
- package/apps/lite-cli/dist/query.d.ts +4 -1
- package/apps/lite-cli/dist/query.d.ts.map +1 -1
- package/apps/lite-cli/dist/query.js +45 -29
- package/apps/lite-cli/dist/query.js.map +1 -1
- package/apps/lite-cli/dist/resource-errors.d.ts +3 -0
- package/apps/lite-cli/dist/resource-errors.d.ts.map +1 -0
- package/apps/lite-cli/dist/resource-errors.js +17 -0
- package/apps/lite-cli/dist/resource-errors.js.map +1 -0
- package/apps/lite-cli/dist/shell.d.ts +12 -2
- package/apps/lite-cli/dist/shell.d.ts.map +1 -1
- package/apps/lite-cli/dist/shell.js +129 -57
- package/apps/lite-cli/dist/shell.js.map +1 -1
- package/apps/lite-cli/dist/sql-query.test.d.ts +2 -0
- package/apps/lite-cli/dist/sql-query.test.d.ts.map +1 -0
- package/apps/lite-cli/dist/sql-query.test.js +290 -0
- package/apps/lite-cli/dist/sql-query.test.js.map +1 -0
- package/apps/lite-cli/dist/version.d.ts +1 -1
- package/apps/lite-cli/dist/version.js +1 -1
- package/apps/lite-tui/dist/bin.js +3 -3
- package/apps/lite-tui/dist/bin.js.map +1 -1
- package/apps/lite-tui/dist/index.d.ts.map +1 -1
- package/apps/lite-tui/dist/index.js +2 -2
- package/apps/lite-tui/dist/index.js.map +1 -1
- package/apps/lite-tui/dist/index.test.js +5 -3
- package/apps/lite-tui/dist/index.test.js.map +1 -1
- package/apps/lite-tui/dist/render.d.ts +1 -1
- package/apps/lite-tui/dist/version.d.ts +1 -1
- package/apps/lite-tui/dist/version.js +1 -1
- package/bin/cchistory-lite-tui.mjs +3 -3
- package/bin/cchistory-lite.mjs +3 -3
- package/docs/guide/for-agents.md +65 -42
- package/docs/guide/lite.md +64 -24
- package/docs/guide/queries/latest-sessions.sql +4 -0
- package/docs/guide/queries/latest-turns.sql +1 -0
- package/docs/guide/queries/list-sessions.sql +2 -0
- package/docs/guide/query.md +153 -0
- package/node_modules/@cchistory/canonical/dist/directory-scope.d.ts +7 -0
- package/node_modules/@cchistory/canonical/dist/directory-scope.d.ts.map +1 -1
- package/node_modules/@cchistory/canonical/dist/directory-scope.js +11 -0
- package/node_modules/@cchistory/canonical/dist/directory-scope.js.map +1 -1
- package/node_modules/@cchistory/canonical/dist/index.d.ts +5 -1
- package/node_modules/@cchistory/canonical/dist/index.d.ts.map +1 -1
- package/node_modules/@cchistory/canonical/dist/index.js +5 -1
- package/node_modules/@cchistory/canonical/dist/index.js.map +1 -1
- package/node_modules/@cchistory/canonical/dist/query.d.ts +15 -0
- package/node_modules/@cchistory/canonical/dist/query.d.ts.map +1 -0
- package/node_modules/@cchistory/canonical/dist/query.js +208 -0
- package/node_modules/@cchistory/canonical/dist/query.js.map +1 -0
- package/node_modules/@cchistory/canonical/dist/session-family.d.ts +1 -0
- package/node_modules/@cchistory/canonical/dist/session-family.d.ts.map +1 -1
- package/node_modules/@cchistory/canonical/dist/session-family.js +3 -0
- package/node_modules/@cchistory/canonical/dist/session-family.js.map +1 -1
- package/node_modules/@cchistory/canonical/dist/session-family.test.js +61 -0
- package/node_modules/@cchistory/canonical/dist/session-family.test.js.map +1 -1
- package/node_modules/@cchistory/canonical/dist/session-interpreter.d.ts +30 -0
- package/node_modules/@cchistory/canonical/dist/session-interpreter.d.ts.map +1 -0
- package/node_modules/@cchistory/canonical/dist/session-interpreter.js +713 -0
- package/node_modules/@cchistory/canonical/dist/session-interpreter.js.map +1 -0
- package/node_modules/@cchistory/canonical/dist/session-interpreter.test.d.ts +2 -0
- package/node_modules/@cchistory/canonical/dist/session-interpreter.test.d.ts.map +1 -0
- package/node_modules/@cchistory/canonical/dist/session-interpreter.test.js +56 -0
- package/node_modules/@cchistory/canonical/dist/session-interpreter.test.js.map +1 -0
- package/node_modules/@cchistory/canonical/package.json +1 -1
- package/node_modules/@cchistory/domain/dist/evidence-atoms.d.ts +7 -0
- package/node_modules/@cchistory/domain/dist/evidence-atoms.d.ts.map +1 -0
- package/node_modules/@cchistory/domain/dist/evidence-atoms.js +36 -0
- package/node_modules/@cchistory/domain/dist/evidence-atoms.js.map +1 -0
- package/node_modules/@cchistory/domain/dist/evidence-values.d.ts +26 -0
- package/node_modules/@cchistory/domain/dist/evidence-values.d.ts.map +1 -0
- package/node_modules/@cchistory/domain/dist/evidence-values.js +80 -0
- package/node_modules/@cchistory/domain/dist/evidence-values.js.map +1 -0
- package/node_modules/@cchistory/domain/dist/index.d.ts +6 -0
- package/node_modules/@cchistory/domain/dist/index.d.ts.map +1 -1
- package/node_modules/@cchistory/domain/dist/index.js +5 -0
- package/node_modules/@cchistory/domain/dist/index.js.map +1 -1
- package/node_modules/@cchistory/domain/dist/masks.d.ts +31 -0
- package/node_modules/@cchistory/domain/dist/masks.d.ts.map +1 -0
- package/node_modules/@cchistory/domain/dist/masks.js +342 -0
- package/node_modules/@cchistory/domain/dist/masks.js.map +1 -0
- package/node_modules/@cchistory/domain/dist/parsed-session.d.ts +58 -0
- package/node_modules/@cchistory/domain/dist/parsed-session.d.ts.map +1 -0
- package/node_modules/@cchistory/domain/dist/parsed-session.js +2 -0
- package/node_modules/@cchistory/domain/dist/parsed-session.js.map +1 -0
- package/node_modules/@cchistory/domain/dist/query.d.ts +67 -0
- package/node_modules/@cchistory/domain/dist/query.d.ts.map +1 -0
- package/node_modules/@cchistory/domain/dist/query.js +2 -0
- package/node_modules/@cchistory/domain/dist/query.js.map +1 -0
- package/node_modules/@cchistory/domain/dist/token-evidence.d.ts +14 -0
- package/node_modules/@cchistory/domain/dist/token-evidence.d.ts.map +1 -0
- package/node_modules/@cchistory/domain/dist/token-evidence.js +247 -0
- package/node_modules/@cchistory/domain/dist/token-evidence.js.map +1 -0
- package/node_modules/@cchistory/domain/package.json +1 -1
- package/node_modules/@cchistory/live-runtime/dist/bootstrap.d.ts +0 -1
- package/node_modules/@cchistory/live-runtime/dist/bootstrap.d.ts.map +1 -1
- package/node_modules/@cchistory/live-runtime/dist/bootstrap.js +0 -1
- package/node_modules/@cchistory/live-runtime/dist/bootstrap.js.map +1 -1
- package/node_modules/@cchistory/live-runtime/dist/index.d.ts +30 -9
- package/node_modules/@cchistory/live-runtime/dist/index.d.ts.map +1 -1
- package/node_modules/@cchistory/live-runtime/dist/index.js +263 -58
- package/node_modules/@cchistory/live-runtime/dist/index.js.map +1 -1
- package/node_modules/@cchistory/live-runtime/dist/index.test.js +177 -20
- package/node_modules/@cchistory/live-runtime/dist/index.test.js.map +1 -1
- package/node_modules/@cchistory/live-runtime/dist/preparation-metadata.d.ts +16 -0
- package/node_modules/@cchistory/live-runtime/dist/preparation-metadata.d.ts.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/preparation-metadata.js +55 -0
- package/node_modules/@cchistory/live-runtime/dist/preparation-metadata.js.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/preparation-metadata.test.d.ts +2 -0
- package/node_modules/@cchistory/live-runtime/dist/preparation-metadata.test.d.ts.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/preparation-metadata.test.js +192 -0
- package/node_modules/@cchistory/live-runtime/dist/preparation-metadata.test.js.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/scan-guard.d.ts +32 -23
- package/node_modules/@cchistory/live-runtime/dist/scan-guard.d.ts.map +1 -1
- package/node_modules/@cchistory/live-runtime/dist/scan-guard.js +65 -45
- package/node_modules/@cchistory/live-runtime/dist/scan-guard.js.map +1 -1
- package/node_modules/@cchistory/live-runtime/dist/scan-guard.test.js +363 -59
- package/node_modules/@cchistory/live-runtime/dist/scan-guard.test.js.map +1 -1
- package/node_modules/@cchistory/live-runtime/dist/selective-query.d.ts +47 -0
- package/node_modules/@cchistory/live-runtime/dist/selective-query.d.ts.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/selective-query.js +15 -0
- package/node_modules/@cchistory/live-runtime/dist/selective-query.js.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/selective-query.test.d.ts +2 -0
- package/node_modules/@cchistory/live-runtime/dist/selective-query.test.d.ts.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/selective-query.test.js +166 -0
- package/node_modules/@cchistory/live-runtime/dist/selective-query.test.js.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/sql-query.d.ts +37 -0
- package/node_modules/@cchistory/live-runtime/dist/sql-query.d.ts.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/sql-query.js +301 -0
- package/node_modules/@cchistory/live-runtime/dist/sql-query.js.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/sql-query.test.d.ts +2 -0
- package/node_modules/@cchistory/live-runtime/dist/sql-query.test.d.ts.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/sql-query.test.js +67 -0
- package/node_modules/@cchistory/live-runtime/dist/sql-query.test.js.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/sql-worker.d.ts +2 -0
- package/node_modules/@cchistory/live-runtime/dist/sql-worker.d.ts.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/sql-worker.js +14 -0
- package/node_modules/@cchistory/live-runtime/dist/sql-worker.js.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/system-memory.d.ts +13 -10
- package/node_modules/@cchistory/live-runtime/dist/system-memory.d.ts.map +1 -1
- package/node_modules/@cchistory/live-runtime/dist/system-memory.js +61 -34
- package/node_modules/@cchistory/live-runtime/dist/system-memory.js.map +1 -1
- package/node_modules/@cchistory/live-runtime/dist/system-memory.test.d.ts +2 -0
- package/node_modules/@cchistory/live-runtime/dist/system-memory.test.d.ts.map +1 -0
- package/node_modules/@cchistory/live-runtime/dist/system-memory.test.js +76 -0
- package/node_modules/@cchistory/live-runtime/dist/system-memory.test.js.map +1 -0
- package/node_modules/@cchistory/live-runtime/package.json +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/discovery.test.js +2 -1
- package/node_modules/@cchistory/source-adapters/dist/core/discovery.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/factories.d.ts +2 -4
- package/node_modules/@cchistory/source-adapters/dist/core/factories.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/factories.js +1 -23
- package/node_modules/@cchistory/source-adapters/dist/core/factories.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/file-read-plan.d.ts +25 -0
- package/node_modules/@cchistory/source-adapters/dist/core/file-read-plan.d.ts.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/core/file-read-plan.js +80 -0
- package/node_modules/@cchistory/source-adapters/dist/core/file-read-plan.js.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/core/file-read-plan.test.d.ts +2 -0
- package/node_modules/@cchistory/source-adapters/dist/core/file-read-plan.test.d.ts.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/core/file-read-plan.test.js +122 -0
- package/node_modules/@cchistory/source-adapters/dist/core/file-read-plan.test.js.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/core/git-project.d.ts +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/git-project.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/git-project.js +2 -11
- package/node_modules/@cchistory/source-adapters/dist/core/git-project.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/parser.d.ts +2 -1
- package/node_modules/@cchistory/source-adapters/dist/core/parser.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/parser.js +4 -4
- package/node_modules/@cchistory/source-adapters/dist/core/parser.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/probe.d.ts +8 -6
- package/node_modules/@cchistory/source-adapters/dist/core/probe.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/probe.js +54 -36
- package/node_modules/@cchistory/source-adapters/dist/core/probe.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/projections.d.ts +2 -28
- package/node_modules/@cchistory/source-adapters/dist/core/projections.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/projections.js +2 -695
- package/node_modules/@cchistory/source-adapters/dist/core/projections.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/projections.test.js +2 -1
- package/node_modules/@cchistory/source-adapters/dist/core/projections.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/read-budget.d.ts +18 -0
- package/node_modules/@cchistory/source-adapters/dist/core/read-budget.d.ts.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/core/read-budget.js +27 -0
- package/node_modules/@cchistory/source-adapters/dist/core/read-budget.js.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/core/read-budget.test.d.ts +2 -0
- package/node_modules/@cchistory/source-adapters/dist/core/read-budget.test.d.ts.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/core/read-budget.test.js +75 -0
- package/node_modules/@cchistory/source-adapters/dist/core/read-budget.test.js.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/core/session-grouping.d.ts +6 -0
- package/node_modules/@cchistory/source-adapters/dist/core/session-grouping.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/session-grouping.js +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/session-grouping.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/session-grouping.test.js +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/session-grouping.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/source-identity.d.ts +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/source-identity.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/source-identity.js +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/source-identity.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/token-usage.d.ts +1 -13
- package/node_modules/@cchistory/source-adapters/dist/core/token-usage.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/token-usage.js +1 -246
- package/node_modules/@cchistory/source-adapters/dist/core/token-usage.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/tokens.test.js +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/tokens.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/type-guards.d.ts +1 -25
- package/node_modules/@cchistory/source-adapters/dist/core/type-guards.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/type-guards.js +1 -79
- package/node_modules/@cchistory/source-adapters/dist/core/type-guards.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/types.d.ts +6 -35
- package/node_modules/@cchistory/source-adapters/dist/core/types.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/vscode-state.d.ts +2 -1
- package/node_modules/@cchistory/source-adapters/dist/core/vscode-state.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/core/vscode-state.js +14 -10
- package/node_modules/@cchistory/source-adapters/dist/core/vscode-state.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/index.d.ts +6 -0
- package/node_modules/@cchistory/source-adapters/dist/index.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/index.js +4 -0
- package/node_modules/@cchistory/source-adapters/dist/index.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/index.test.d.ts +2 -0
- package/node_modules/@cchistory/source-adapters/dist/index.test.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/index.test.js +2 -0
- package/node_modules/@cchistory/source-adapters/dist/index.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/masks.d.ts +1 -30
- package/node_modules/@cchistory/source-adapters/dist/masks.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/masks.js +1 -341
- package/node_modules/@cchistory/source-adapters/dist/masks.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/accio.test.js +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/accio.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/amp.test.js +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/amp.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/antigravity.test.js +2 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/antigravity.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/claude.test.js +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/claude.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/codebuddy.test.js +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/codebuddy.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/codex/activity-evidence.d.ts +14 -0
- package/node_modules/@cchistory/source-adapters/dist/platforms/codex/activity-evidence.d.ts.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/platforms/codex/activity-evidence.js +103 -0
- package/node_modules/@cchistory/source-adapters/dist/platforms/codex/activity-evidence.js.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/platforms/codex.test.js +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/codex.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/cursor/runtime.d.ts +2 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/cursor/runtime.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/cursor/runtime.js +5 -3
- package/node_modules/@cchistory/source-adapters/dist/platforms/cursor/runtime.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/cursor-agent.test.js +2 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/cursor-agent.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/cursor.test.js +2 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/cursor.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/factory-droid.test.js +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/factory-droid.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/gemini.test.js +2 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/gemini.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/grok.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/grok.js +24 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/grok.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/grok.test.js +2 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/grok.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/kimi.test.js +2 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/kimi.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/lobechat.test.js +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/lobechat.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/openclaw.test.js +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/openclaw.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/opencode.test.js +2 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/opencode.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/zcode/runtime.d.ts +2 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/zcode/runtime.d.ts.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/zcode/runtime.js +11 -9
- package/node_modules/@cchistory/source-adapters/dist/platforms/zcode/runtime.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/zcode.test.js +2 -1
- package/node_modules/@cchistory/source-adapters/dist/platforms/zcode.test.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/dist/probe-reference.test.d.ts +8 -0
- package/node_modules/@cchistory/source-adapters/dist/probe-reference.test.d.ts.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/probe-reference.test.js +7 -0
- package/node_modules/@cchistory/source-adapters/dist/probe-reference.test.js.map +1 -0
- package/node_modules/@cchistory/source-adapters/dist/test-helpers.js.map +1 -1
- package/node_modules/@cchistory/source-adapters/package.json +1 -1
- package/node_modules/commander/LICENSE +22 -0
- package/node_modules/commander/Readme.md +428 -0
- package/node_modules/commander/index.js +1224 -0
- package/node_modules/commander/package.json +38 -0
- package/node_modules/commander/typings/index.d.ts +310 -0
- package/node_modules/discontinuous-range/.npmignore +28 -0
- package/node_modules/discontinuous-range/.travis.yml +4 -0
- package/node_modules/discontinuous-range/LICENSE +21 -0
- package/node_modules/discontinuous-range/README.md +23 -0
- package/node_modules/discontinuous-range/index.js +144 -0
- package/node_modules/discontinuous-range/package.json +27 -0
- package/node_modules/discontinuous-range/test/main-test.js +96 -0
- package/node_modules/moo/LICENSE +29 -0
- package/node_modules/moo/README.md +385 -0
- package/node_modules/moo/moo.js +645 -0
- package/node_modules/moo/package.json +29 -0
- package/node_modules/nearley/LICENSE.txt +21 -0
- package/node_modules/nearley/README.md +80 -0
- package/node_modules/nearley/bin/nearley-railroad.js +121 -0
- package/node_modules/nearley/bin/nearley-test.js +64 -0
- package/node_modules/nearley/bin/nearley-unparse.js +29 -0
- package/node_modules/nearley/bin/nearleyc.js +38 -0
- package/node_modules/nearley/builtin/cow.ne +2 -0
- package/node_modules/nearley/builtin/number.ne +51 -0
- package/node_modules/nearley/builtin/postprocessors.ne +36 -0
- package/node_modules/nearley/builtin/string.ne +26 -0
- package/node_modules/nearley/builtin/whitespace.ne +5 -0
- package/node_modules/nearley/lib/compile.js +307 -0
- package/node_modules/nearley/lib/generate.js +244 -0
- package/node_modules/nearley/lib/lint.js +28 -0
- package/node_modules/nearley/lib/nearley-language-bootstrapped.js +132 -0
- package/node_modules/nearley/lib/nearley-language-bootstrapped.ne +126 -0
- package/node_modules/nearley/lib/nearley.js +564 -0
- package/node_modules/nearley/lib/stream.js +18 -0
- package/node_modules/nearley/lib/unparse.js +139 -0
- package/node_modules/nearley/package.json +63 -0
- package/node_modules/pgsql-ast-parser/ast-mapper.d.ts +237 -0
- package/node_modules/pgsql-ast-parser/ast-mapper.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/ast-mapper.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/ast-mapper.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/ast-visitor.d.ts +33 -0
- package/node_modules/pgsql-ast-parser/ast-visitor.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/ast-visitor.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/ast-visitor.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/index.d.ts +11 -0
- package/node_modules/pgsql-ast-parser/index.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/index.js +6484 -0
- package/node_modules/pgsql-ast-parser/index.js.map +1 -0
- package/node_modules/pgsql-ast-parser/interfaces.d.ts +1 -0
- package/node_modules/pgsql-ast-parser/interfaces.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/keywords.d.ts +2 -0
- package/node_modules/pgsql-ast-parser/keywords.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/lexer.d.ts +15 -0
- package/node_modules/pgsql-ast-parser/lexer.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/lexer.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/lexer.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/array-lexer.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/array-lexer.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/array.ne.d.ts +29 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/array.ne.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/array.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/array.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/geometric-lexer.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/geometric-lexer.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/geometric.ne.d.ts +29 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/geometric.ne.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/geometric.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/geometric.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/interval-builder.d.ts +10 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/interval-builder.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/interval-iso-lexer.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/interval-iso-lexer.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/interval-iso.ne.d.ts +29 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/interval-iso.ne.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/interval-lexer.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/interval-lexer.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/interval.ne.d.ts +29 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/interval.ne.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/interval.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/literal-syntaxes/interval.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/package.json +69 -0
- package/node_modules/pgsql-ast-parser/parser.d.ts +33 -0
- package/node_modules/pgsql-ast-parser/parser.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/pg-escape.d.ts +2 -0
- package/node_modules/pgsql-ast-parser/pg-escape.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/readme.md +255 -0
- package/node_modules/pgsql-ast-parser/src/ast-mapper.spec.ts +296 -0
- package/node_modules/pgsql-ast-parser/src/ast-mapper.ts +1378 -0
- package/node_modules/pgsql-ast-parser/src/ast-visitor.spec.ts +57 -0
- package/node_modules/pgsql-ast-parser/src/ast-visitor.ts +101 -0
- package/node_modules/pgsql-ast-parser/src/index.ts +10 -0
- package/node_modules/pgsql-ast-parser/src/interfaces.ts +0 -0
- package/node_modules/pgsql-ast-parser/src/keywords.ts +8 -0
- package/node_modules/pgsql-ast-parser/src/lexer.spec.ts +245 -0
- package/node_modules/pgsql-ast-parser/src/lexer.ts +267 -0
- package/node_modules/pgsql-ast-parser/src/literal-syntaxes/array-lexer.ts +27 -0
- package/node_modules/pgsql-ast-parser/src/literal-syntaxes/array.ne +18 -0
- package/node_modules/pgsql-ast-parser/src/literal-syntaxes/array.spec.ts +55 -0
- package/node_modules/pgsql-ast-parser/src/literal-syntaxes/geometric-lexer.ts +26 -0
- package/node_modules/pgsql-ast-parser/src/literal-syntaxes/geometric.ne +88 -0
- package/node_modules/pgsql-ast-parser/src/literal-syntaxes/geometric.spec.ts +131 -0
- package/node_modules/pgsql-ast-parser/src/literal-syntaxes/interval-builder.ts +148 -0
- package/node_modules/pgsql-ast-parser/src/literal-syntaxes/interval-iso-lexer.ts +17 -0
- package/node_modules/pgsql-ast-parser/src/literal-syntaxes/interval-iso.ne +53 -0
- package/node_modules/pgsql-ast-parser/src/literal-syntaxes/interval-lexer.ts +26 -0
- package/node_modules/pgsql-ast-parser/src/literal-syntaxes/interval.ne +54 -0
- package/node_modules/pgsql-ast-parser/src/literal-syntaxes/interval.spec.ts +106 -0
- package/node_modules/pgsql-ast-parser/src/parser.ts +142 -0
- package/node_modules/pgsql-ast-parser/src/pg-escape.ts +14 -0
- package/node_modules/pgsql-ast-parser/src/syntax/alter-index.ne +29 -0
- package/node_modules/pgsql-ast-parser/src/syntax/alter-index.spec.ts +35 -0
- package/node_modules/pgsql-ast-parser/src/syntax/alter-table.ne +123 -0
- package/node_modules/pgsql-ast-parser/src/syntax/alter-table.spec.ts +476 -0
- package/node_modules/pgsql-ast-parser/src/syntax/alter-type.ne +33 -0
- package/node_modules/pgsql-ast-parser/src/syntax/alter-type.spec.ts +29 -0
- package/node_modules/pgsql-ast-parser/src/syntax/ast.ts +1150 -0
- package/node_modules/pgsql-ast-parser/src/syntax/base.ne +369 -0
- package/node_modules/pgsql-ast-parser/src/syntax/create-extension.ne +17 -0
- package/node_modules/pgsql-ast-parser/src/syntax/create-extension.spec.ts +37 -0
- package/node_modules/pgsql-ast-parser/src/syntax/create-index.ne +62 -0
- package/node_modules/pgsql-ast-parser/src/syntax/create-index.spec.ts +245 -0
- package/node_modules/pgsql-ast-parser/src/syntax/create-table.ne +174 -0
- package/node_modules/pgsql-ast-parser/src/syntax/create-table.spec.ts +761 -0
- package/node_modules/pgsql-ast-parser/src/syntax/create-type.ne +40 -0
- package/node_modules/pgsql-ast-parser/src/syntax/create-type.spec.ts +32 -0
- package/node_modules/pgsql-ast-parser/src/syntax/create-view.ne +68 -0
- package/node_modules/pgsql-ast-parser/src/syntax/create-view.spec.ts +187 -0
- package/node_modules/pgsql-ast-parser/src/syntax/deallocate.ne +13 -0
- package/node_modules/pgsql-ast-parser/src/syntax/deallocate.spec.ts +19 -0
- package/node_modules/pgsql-ast-parser/src/syntax/delete.ne +36 -0
- package/node_modules/pgsql-ast-parser/src/syntax/delete.spec.ts +71 -0
- package/node_modules/pgsql-ast-parser/src/syntax/drop.ne +28 -0
- package/node_modules/pgsql-ast-parser/src/syntax/drop.spec.ts +77 -0
- package/node_modules/pgsql-ast-parser/src/syntax/edge-cases.spec.ts +41 -0
- package/node_modules/pgsql-ast-parser/src/syntax/expr.ne +350 -0
- package/node_modules/pgsql-ast-parser/src/syntax/expr.spec.ts +1638 -0
- package/node_modules/pgsql-ast-parser/src/syntax/functions.ne +114 -0
- package/node_modules/pgsql-ast-parser/src/syntax/functions.spec.ts +235 -0
- package/node_modules/pgsql-ast-parser/src/syntax/insert.ne +63 -0
- package/node_modules/pgsql-ast-parser/src/syntax/insert.spec.ts +292 -0
- package/node_modules/pgsql-ast-parser/src/syntax/main.ne +77 -0
- package/node_modules/pgsql-ast-parser/src/syntax/nearley.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/src/syntax/prepare.ne +8 -0
- package/node_modules/pgsql-ast-parser/src/syntax/prepare.spec.ts +44 -0
- package/node_modules/pgsql-ast-parser/src/syntax/refresh-materialized-view.ne +19 -0
- package/node_modules/pgsql-ast-parser/src/syntax/refresh-materialized-view.spec.ts +42 -0
- package/node_modules/pgsql-ast-parser/src/syntax/select.ne +223 -0
- package/node_modules/pgsql-ast-parser/src/syntax/select.spec.ts +1063 -0
- package/node_modules/pgsql-ast-parser/src/syntax/sequence.ne +101 -0
- package/node_modules/pgsql-ast-parser/src/syntax/sequence.spec.ts +103 -0
- package/node_modules/pgsql-ast-parser/src/syntax/simple-statements.ne +168 -0
- package/node_modules/pgsql-ast-parser/src/syntax/simple-statements.spec.ts +327 -0
- package/node_modules/pgsql-ast-parser/src/syntax/spec-utils.ts +333 -0
- package/node_modules/pgsql-ast-parser/src/syntax/union.ne +18 -0
- package/node_modules/pgsql-ast-parser/src/syntax/union.spec.ts +125 -0
- package/node_modules/pgsql-ast-parser/src/syntax/update.ne +56 -0
- package/node_modules/pgsql-ast-parser/src/syntax/update.spec.ts +87 -0
- package/node_modules/pgsql-ast-parser/src/syntax/with.ne +41 -0
- package/node_modules/pgsql-ast-parser/src/syntax/with.spec.ts +155 -0
- package/node_modules/pgsql-ast-parser/src/to-sql.spec.ts +85 -0
- package/node_modules/pgsql-ast-parser/src/to-sql.ts +1555 -0
- package/node_modules/pgsql-ast-parser/src/utils.ts +47 -0
- package/node_modules/pgsql-ast-parser/syntax/alter-index.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/alter-index.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/alter-table.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/alter-table.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/alter-type.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/alter-type.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/ast.d.ts +826 -0
- package/node_modules/pgsql-ast-parser/syntax/ast.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/create-extension.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/create-extension.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/create-index.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/create-index.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/create-table.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/create-table.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/create-type.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/create-type.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/create-view.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/create-view.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/deallocate.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/deallocate.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/delete.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/delete.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/drop.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/drop.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/edge-cases.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/edge-cases.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/expr.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/expr.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/functions.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/functions.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/insert.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/insert.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/main.ne.d.ts +29 -0
- package/node_modules/pgsql-ast-parser/syntax/main.ne.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/prepare.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/prepare.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/refresh-materialized-view.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/refresh-materialized-view.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/select.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/select.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/sequence.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/sequence.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/simple-statements.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/simple-statements.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/spec-utils.d.ts +35 -0
- package/node_modules/pgsql-ast-parser/syntax/spec-utils.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/union.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/union.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/update.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/update.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/syntax/with.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/syntax/with.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/to-sql.d.ts +7 -0
- package/node_modules/pgsql-ast-parser/to-sql.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/to-sql.spec.d.ts +3 -0
- package/node_modules/pgsql-ast-parser/to-sql.spec.d.ts.map +1 -0
- package/node_modules/pgsql-ast-parser/utils.d.ts +16 -0
- package/node_modules/pgsql-ast-parser/utils.d.ts.map +1 -0
- package/node_modules/railroad-diagrams/.gitattributes +22 -0
- package/node_modules/railroad-diagrams/.npmignore +163 -0
- package/node_modules/railroad-diagrams/README.md +86 -0
- package/node_modules/railroad-diagrams/css-example.py-js +183 -0
- package/node_modules/railroad-diagrams/example.html +141 -0
- package/node_modules/railroad-diagrams/generator.html +59 -0
- package/node_modules/railroad-diagrams/package.json +23 -0
- package/node_modules/railroad-diagrams/railroad-diagrams.css +23 -0
- package/node_modules/railroad-diagrams/railroad-diagrams.js +524 -0
- package/node_modules/railroad-diagrams/railroad_diagrams.py +427 -0
- package/node_modules/randexp/LICENSE +19 -0
- package/node_modules/randexp/README.md +134 -0
- package/node_modules/randexp/lib/randexp.js +245 -0
- package/node_modules/randexp/package.json +48 -0
- package/node_modules/ret/LICENSE +19 -0
- package/node_modules/ret/README.md +183 -0
- package/node_modules/ret/lib/index.js +282 -0
- package/node_modules/ret/lib/positions.js +17 -0
- package/node_modules/ret/lib/sets.js +82 -0
- package/node_modules/ret/lib/types.js +10 -0
- package/node_modules/ret/lib/util.js +111 -0
- package/node_modules/ret/package.json +35 -0
- package/package.json +22 -6
- package/schemas/cchistory-lite-agent-v1.schema.json +6 -7
- package/schemas/cchistory-lite-error-v1.schema.json +58 -8
- package/schemas/cchistory-lite-query-result-v2.schema.json +66 -11
- package/schemas/cchistory-lite-query-result-v3.schema.json +219 -0
- package/schemas/cchistory-lite-query-v3.schema.json +57 -0
- package/schemas/cchistory-lite-source-inventory-v1.schema.json +72 -0
- package/skills/using-cchistory-lite/SKILL.md +125 -53
- package/node_modules/@cchistory/live-runtime/dist/node-memory.d.ts +0 -8
- package/node_modules/@cchistory/live-runtime/dist/node-memory.d.ts.map +0 -1
- package/node_modules/@cchistory/live-runtime/dist/node-memory.js +0 -110
- package/node_modules/@cchistory/live-runtime/dist/node-memory.js.map +0 -1
|
@@ -0,0 +1,761 @@
|
|
|
1
|
+
import 'mocha';
|
|
2
|
+
import 'chai';
|
|
3
|
+
import { checkCreateTable, checkCreateTableLoc, checkInvalid } from './spec-utils';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
describe('Create table', () => {
|
|
7
|
+
|
|
8
|
+
checkCreateTableLoc(['create table test(value text)'], {
|
|
9
|
+
_location: { start: 0, end: 29 },
|
|
10
|
+
type: 'create table',
|
|
11
|
+
name: {
|
|
12
|
+
_location: { start: 13, end: 17 },
|
|
13
|
+
name: 'test',
|
|
14
|
+
},
|
|
15
|
+
columns: [{
|
|
16
|
+
_location: { start: 18, end: 28 },
|
|
17
|
+
kind: 'column',
|
|
18
|
+
name: {
|
|
19
|
+
_location: { start: 18, end: 23 },
|
|
20
|
+
name: 'value'
|
|
21
|
+
},
|
|
22
|
+
dataType: {
|
|
23
|
+
_location: { start: 24, end: 28 },
|
|
24
|
+
name: 'text'
|
|
25
|
+
},
|
|
26
|
+
}],
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
checkCreateTable(['create table test(value pg_catalog.text)'], {
|
|
30
|
+
type: 'create table',
|
|
31
|
+
name: { name: 'test', },
|
|
32
|
+
columns: [{
|
|
33
|
+
kind: 'column',
|
|
34
|
+
name: { name: 'value' },
|
|
35
|
+
dataType: {
|
|
36
|
+
name: 'text',
|
|
37
|
+
schema: 'pg_catalog',
|
|
38
|
+
},
|
|
39
|
+
}],
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
checkInvalid('create temp unlogged table test (id text)');
|
|
44
|
+
checkInvalid('create global unlogged table test (id text)');
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
checkCreateTable(['create temp table test(value text)', 'create temporary table test(value text)'], {
|
|
49
|
+
type: 'create table',
|
|
50
|
+
name: { name: 'test', },
|
|
51
|
+
temporary: true,
|
|
52
|
+
columns: [{
|
|
53
|
+
kind: 'column',
|
|
54
|
+
name: { name: 'value' },
|
|
55
|
+
dataType: {
|
|
56
|
+
name: 'text',
|
|
57
|
+
},
|
|
58
|
+
}],
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
checkCreateTable(['create unlogged table test(value text)'], {
|
|
63
|
+
type: 'create table',
|
|
64
|
+
name: { name: 'test', },
|
|
65
|
+
unlogged: true,
|
|
66
|
+
columns: [{
|
|
67
|
+
kind: 'column',
|
|
68
|
+
name: { name: 'value' },
|
|
69
|
+
dataType: {
|
|
70
|
+
name: 'text',
|
|
71
|
+
},
|
|
72
|
+
}],
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
checkCreateTable(['create global table test(value text)', 'create GLOBAL table test(value text)'], {
|
|
77
|
+
type: 'create table',
|
|
78
|
+
name: { name: 'test', },
|
|
79
|
+
locality: 'global',
|
|
80
|
+
columns: [{
|
|
81
|
+
kind: 'column',
|
|
82
|
+
name: { name: 'value' },
|
|
83
|
+
dataType: {
|
|
84
|
+
name: 'text',
|
|
85
|
+
},
|
|
86
|
+
}],
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
checkCreateTable(['create local table test(value text)'], {
|
|
90
|
+
type: 'create table',
|
|
91
|
+
name: { name: 'test', },
|
|
92
|
+
locality: 'local',
|
|
93
|
+
columns: [{
|
|
94
|
+
kind: 'column',
|
|
95
|
+
name: { name: 'value' },
|
|
96
|
+
dataType: {
|
|
97
|
+
name: 'text',
|
|
98
|
+
},
|
|
99
|
+
}],
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
checkCreateTable(['create local temp table test(value text)'], {
|
|
103
|
+
type: 'create table',
|
|
104
|
+
name: { name: 'test', },
|
|
105
|
+
locality: 'local',
|
|
106
|
+
temporary: true,
|
|
107
|
+
columns: [{
|
|
108
|
+
kind: 'column',
|
|
109
|
+
name: { name: 'value' },
|
|
110
|
+
dataType: {
|
|
111
|
+
name: 'text',
|
|
112
|
+
},
|
|
113
|
+
}],
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
checkCreateTable(`CREATE TABLE capitals (
|
|
117
|
+
state char(2)
|
|
118
|
+
) INHERITS (cities)`, {
|
|
119
|
+
type: 'create table',
|
|
120
|
+
name: { name: 'capitals', },
|
|
121
|
+
columns: [{
|
|
122
|
+
kind: 'column', name: { name: 'state' }, dataType: { name: 'char', config: [2] }
|
|
123
|
+
}],
|
|
124
|
+
inherits: [{ name: 'cities' }],
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
checkCreateTableLoc(`CREATE TABLE capitals (
|
|
129
|
+
state char(2)
|
|
130
|
+
) INHERITS (global.cities, named)`, {
|
|
131
|
+
_location: { start: 0, end: 93 },
|
|
132
|
+
type: 'create table',
|
|
133
|
+
name: {
|
|
134
|
+
_location: { start: 13, end: 21 },
|
|
135
|
+
name: 'capitals',
|
|
136
|
+
},
|
|
137
|
+
columns: [{
|
|
138
|
+
_location: { start: 32, end: 54 },
|
|
139
|
+
kind: 'column',
|
|
140
|
+
name: {
|
|
141
|
+
_location: { start: 32, end: 37 },
|
|
142
|
+
name: 'state'
|
|
143
|
+
},
|
|
144
|
+
dataType: {
|
|
145
|
+
_location: { start: 48, end: 54 },
|
|
146
|
+
name: 'char', config: [2]
|
|
147
|
+
}
|
|
148
|
+
}],
|
|
149
|
+
inherits: [{
|
|
150
|
+
_location: { start: 72, end: 85 },
|
|
151
|
+
name: 'cities', schema: 'global'
|
|
152
|
+
}, {
|
|
153
|
+
_location: { start: 87, end: 92 },
|
|
154
|
+
name: 'named'
|
|
155
|
+
}],
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
checkCreateTable(['create table test(value pg_catalog.varchar(12))'], {
|
|
159
|
+
type: 'create table',
|
|
160
|
+
name: { name: 'test', },
|
|
161
|
+
columns: [{
|
|
162
|
+
kind: 'column',
|
|
163
|
+
name: { name: 'value' },
|
|
164
|
+
dataType: {
|
|
165
|
+
schema: 'pg_catalog',
|
|
166
|
+
name: 'varchar',
|
|
167
|
+
config: [12],
|
|
168
|
+
},
|
|
169
|
+
}],
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
checkCreateTable(['create table test(value numeric(1, 2))'], {
|
|
174
|
+
type: 'create table',
|
|
175
|
+
name: { name: 'test', },
|
|
176
|
+
columns: [{
|
|
177
|
+
kind: 'column',
|
|
178
|
+
name: { name: 'value' },
|
|
179
|
+
dataType: {
|
|
180
|
+
name: 'numeric',
|
|
181
|
+
config: [1, 2],
|
|
182
|
+
},
|
|
183
|
+
}],
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
checkCreateTable(['create table if not exists test(value text)'], {
|
|
187
|
+
type: 'create table',
|
|
188
|
+
name: { name: 'test', },
|
|
189
|
+
ifNotExists: true,
|
|
190
|
+
columns: [{
|
|
191
|
+
kind: 'column',
|
|
192
|
+
name: { name: 'value' },
|
|
193
|
+
dataType: { name: 'text' },
|
|
194
|
+
}],
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
checkCreateTableLoc(['create table"test"(value text primary key)'], {
|
|
198
|
+
_location: { start: 0, end: 42 },
|
|
199
|
+
type: 'create table',
|
|
200
|
+
name: {
|
|
201
|
+
_location: { start: 12, end: 18 },
|
|
202
|
+
name: 'test',
|
|
203
|
+
},
|
|
204
|
+
columns: [{
|
|
205
|
+
_location: { start: 19, end: 41 },
|
|
206
|
+
kind: 'column',
|
|
207
|
+
name: {
|
|
208
|
+
_location: { start: 19, end: 24 },
|
|
209
|
+
name: 'value',
|
|
210
|
+
},
|
|
211
|
+
dataType: {
|
|
212
|
+
_location: { start: 25, end: 29 },
|
|
213
|
+
name: 'text'
|
|
214
|
+
},
|
|
215
|
+
constraints: [{
|
|
216
|
+
_location: { start: 30, end: 41 },
|
|
217
|
+
type: 'primary key',
|
|
218
|
+
}],
|
|
219
|
+
}],
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
checkCreateTable(['create table"test"(value text unique)'], {
|
|
224
|
+
type: 'create table',
|
|
225
|
+
name: { name: 'test', },
|
|
226
|
+
columns: [{
|
|
227
|
+
kind: 'column',
|
|
228
|
+
name: { name: 'value' },
|
|
229
|
+
dataType: { name: 'text' },
|
|
230
|
+
constraints: [{ type: 'unique' }],
|
|
231
|
+
}],
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
checkCreateTable(['create table"test"(value text unique not null)'], {
|
|
236
|
+
type: 'create table',
|
|
237
|
+
name: { name: 'test', },
|
|
238
|
+
columns: [{
|
|
239
|
+
kind: 'column',
|
|
240
|
+
name: { name: 'value' },
|
|
241
|
+
dataType: { name: 'text' },
|
|
242
|
+
constraints: [{ type: 'unique' }, { type: 'not null' }],
|
|
243
|
+
}],
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
checkCreateTable(['create table"test"(value text[])'], {
|
|
248
|
+
type: 'create table',
|
|
249
|
+
name: { name: 'test', },
|
|
250
|
+
columns: [{
|
|
251
|
+
kind: 'column',
|
|
252
|
+
name: { name: 'value' },
|
|
253
|
+
dataType: {
|
|
254
|
+
kind: 'array',
|
|
255
|
+
arrayOf: { name: 'text' }
|
|
256
|
+
},
|
|
257
|
+
}],
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
checkCreateTable(['create table"test"(value text[][])'], {
|
|
262
|
+
type: 'create table',
|
|
263
|
+
name: { name: 'test', },
|
|
264
|
+
columns: [{
|
|
265
|
+
kind: 'column',
|
|
266
|
+
name: { name: 'value' },
|
|
267
|
+
dataType: {
|
|
268
|
+
kind: 'array',
|
|
269
|
+
arrayOf: {
|
|
270
|
+
kind: 'array',
|
|
271
|
+
arrayOf: { name: 'text' }
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
}],
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
checkCreateTable(['create table"test"(value timestamp with time zone)'], {
|
|
278
|
+
type: 'create table',
|
|
279
|
+
name: { name: 'test', },
|
|
280
|
+
columns: [{
|
|
281
|
+
kind: 'column',
|
|
282
|
+
name: { name: 'value' },
|
|
283
|
+
dataType: { name: 'timestamp with time zone' },
|
|
284
|
+
}],
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
checkInvalid('create table"test"(value "timestamp" with time zone)');
|
|
288
|
+
checkInvalid('create table"test"(value timestamp with "time" zone)');
|
|
289
|
+
|
|
290
|
+
checkCreateTable(['create table"test"(value "timestamp")'], {
|
|
291
|
+
type: 'create table',
|
|
292
|
+
name: { name: 'test', },
|
|
293
|
+
columns: [{
|
|
294
|
+
kind: 'column',
|
|
295
|
+
name: { name: 'value' },
|
|
296
|
+
dataType: { name: 'timestamp', doubleQuoted: true },
|
|
297
|
+
}],
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
checkCreateTable(['create table"test"(id"text"primary key, value text unique not null)'
|
|
302
|
+
, 'create table"test"(id "text" primary key, value text unique not null)'], {
|
|
303
|
+
type: 'create table',
|
|
304
|
+
name: { name: 'test', },
|
|
305
|
+
columns: [{
|
|
306
|
+
kind: 'column',
|
|
307
|
+
name: { name: 'id' },
|
|
308
|
+
dataType: { name: 'text', doubleQuoted: true },
|
|
309
|
+
constraints: [{ type: 'primary key' }],
|
|
310
|
+
}, {
|
|
311
|
+
kind: 'column',
|
|
312
|
+
name: { name: 'value' },
|
|
313
|
+
dataType: { name: 'text' },
|
|
314
|
+
constraints: [{ type: 'unique' }, { type: 'not null' }],
|
|
315
|
+
}],
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
checkCreateTable(['create table"test"(id serial not null)'], {
|
|
319
|
+
type: 'create table',
|
|
320
|
+
name: { name: 'test', },
|
|
321
|
+
columns: [{
|
|
322
|
+
kind: 'column',
|
|
323
|
+
name: { name: 'id' },
|
|
324
|
+
dataType: { name: 'serial' },
|
|
325
|
+
constraints: [{ type: 'not null' }],
|
|
326
|
+
}],
|
|
327
|
+
});
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
checkCreateTable(['create table"test"(a text, constraint pkey primary key(a), b text)'], {
|
|
332
|
+
type: 'create table',
|
|
333
|
+
name: { name: 'test', },
|
|
334
|
+
columns: [{
|
|
335
|
+
kind: 'column',
|
|
336
|
+
name: { name: 'a' },
|
|
337
|
+
dataType: { name: 'text' },
|
|
338
|
+
}, {
|
|
339
|
+
kind: 'column',
|
|
340
|
+
name: { name: 'b' },
|
|
341
|
+
dataType: { name: 'text' },
|
|
342
|
+
}],
|
|
343
|
+
constraints: [{
|
|
344
|
+
type: 'primary key',
|
|
345
|
+
constraintName: { name: 'pkey' },
|
|
346
|
+
columns: [{ name: 'a' }],
|
|
347
|
+
}]
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
checkCreateTable([`CREATE TABLE products ( price numeric CONSTRAINT positive_price CHECK (price > 0) )`], {
|
|
352
|
+
type: 'create table',
|
|
353
|
+
name: { name: 'products', },
|
|
354
|
+
columns: [{
|
|
355
|
+
kind: 'column',
|
|
356
|
+
name: { name: 'price' },
|
|
357
|
+
dataType: { name: 'numeric' },
|
|
358
|
+
constraints: [{
|
|
359
|
+
type: 'check',
|
|
360
|
+
constraintName: { name: 'positive_price' },
|
|
361
|
+
expr: {
|
|
362
|
+
type: 'binary',
|
|
363
|
+
op: '>',
|
|
364
|
+
left: { type: 'ref', name: 'price' },
|
|
365
|
+
right: { type: 'integer', value: 0 },
|
|
366
|
+
}
|
|
367
|
+
}]
|
|
368
|
+
}],
|
|
369
|
+
});
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
// must have parenthesis
|
|
373
|
+
checkInvalid(`create table"test"(a text, constraint cname check a != 'a')`);
|
|
374
|
+
|
|
375
|
+
// must have cname
|
|
376
|
+
checkInvalid(`create table"test"(a text, constraint check (a != 'a'))`)
|
|
377
|
+
|
|
378
|
+
checkCreateTable([`create table"test"(a text, constraint cname check (a != 'a'))`], {
|
|
379
|
+
type: 'create table',
|
|
380
|
+
name: { name: 'test', },
|
|
381
|
+
columns: [{
|
|
382
|
+
kind: 'column',
|
|
383
|
+
name: { name: 'a' },
|
|
384
|
+
dataType: { name: 'text' },
|
|
385
|
+
}],
|
|
386
|
+
constraints: [{
|
|
387
|
+
type: 'check',
|
|
388
|
+
constraintName: { name: 'cname' },
|
|
389
|
+
expr: {
|
|
390
|
+
type: 'binary',
|
|
391
|
+
left: { type: 'ref', name: 'a' },
|
|
392
|
+
op: '!=',
|
|
393
|
+
right: { type: 'string', value: 'a' },
|
|
394
|
+
}
|
|
395
|
+
}]
|
|
396
|
+
});
|
|
397
|
+
|
|
398
|
+
checkCreateTable([`create table"test"(a text, check (a != 'a'))`], {
|
|
399
|
+
type: 'create table',
|
|
400
|
+
name: { name: 'test', },
|
|
401
|
+
columns: [{
|
|
402
|
+
kind: 'column',
|
|
403
|
+
name: { name: 'a' },
|
|
404
|
+
dataType: { name: 'text' },
|
|
405
|
+
}],
|
|
406
|
+
constraints: [{
|
|
407
|
+
type: 'check',
|
|
408
|
+
expr: {
|
|
409
|
+
type: 'binary',
|
|
410
|
+
left: { type: 'ref', name: 'a' },
|
|
411
|
+
op: '!=',
|
|
412
|
+
right: { type: 'string', value: 'a' },
|
|
413
|
+
}
|
|
414
|
+
}]
|
|
415
|
+
});
|
|
416
|
+
|
|
417
|
+
// bugifx
|
|
418
|
+
checkCreateTable(['CREATE TABLE "a" ("id" character varying NOT NULL, "b" text NOT NULL, "c" character varying NOT NULL, "d" jsonb array NOT NULL, "e" jsonb NOT NULL, CONSTRAINT "PK_17c3a89f58a2997276084e706e8" PRIMARY KEY ("id"));'], {
|
|
419
|
+
type: 'create table',
|
|
420
|
+
name: { name: 'a', },
|
|
421
|
+
columns: [{
|
|
422
|
+
kind: 'column',
|
|
423
|
+
name: { name: 'id' },
|
|
424
|
+
dataType: { name: 'character varying' },
|
|
425
|
+
constraints: [{ type: 'not null' }],
|
|
426
|
+
}, {
|
|
427
|
+
kind: 'column',
|
|
428
|
+
name: { name: 'b' },
|
|
429
|
+
dataType: { name: 'text' },
|
|
430
|
+
constraints: [{ type: 'not null' }],
|
|
431
|
+
}, {
|
|
432
|
+
kind: 'column',
|
|
433
|
+
name: { name: 'c' },
|
|
434
|
+
dataType: { name: 'character varying' },
|
|
435
|
+
constraints: [{ type: 'not null' }],
|
|
436
|
+
}, {
|
|
437
|
+
kind: 'column',
|
|
438
|
+
name: { name: 'd' },
|
|
439
|
+
dataType: {
|
|
440
|
+
kind: 'array',
|
|
441
|
+
arrayOf: { name: 'jsonb' }
|
|
442
|
+
},
|
|
443
|
+
constraints: [{ type: 'not null' }],
|
|
444
|
+
}, {
|
|
445
|
+
kind: 'column',
|
|
446
|
+
name: { name: 'e' },
|
|
447
|
+
dataType: { name: 'jsonb' },
|
|
448
|
+
constraints: [{ type: 'not null' }],
|
|
449
|
+
}],
|
|
450
|
+
constraints: [{
|
|
451
|
+
constraintName: { name: 'PK_17c3a89f58a2997276084e706e8' },
|
|
452
|
+
columns: [{ name: 'id' }],
|
|
453
|
+
type: 'primary key',
|
|
454
|
+
}]
|
|
455
|
+
})
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
|
|
459
|
+
|
|
460
|
+
// bugifx
|
|
461
|
+
checkCreateTable([`CREATE TABLE public.t
|
|
462
|
+
(
|
|
463
|
+
a character varying COLLATE pg_catalog."default" NOT NULL,
|
|
464
|
+
b character varying COLLATE pg_catalog."default" NOT NULL
|
|
465
|
+
)`], {
|
|
466
|
+
type: 'create table',
|
|
467
|
+
name: {
|
|
468
|
+
name: 't',
|
|
469
|
+
schema: 'public',
|
|
470
|
+
},
|
|
471
|
+
columns: [{
|
|
472
|
+
kind: 'column',
|
|
473
|
+
name: { name: 'a' },
|
|
474
|
+
dataType: { name: 'character varying' },
|
|
475
|
+
constraints: [{ type: 'not null' }],
|
|
476
|
+
collate: {
|
|
477
|
+
schema: 'pg_catalog',
|
|
478
|
+
name: 'default',
|
|
479
|
+
},
|
|
480
|
+
}, {
|
|
481
|
+
kind: 'column',
|
|
482
|
+
name: { name: 'b' },
|
|
483
|
+
dataType: { name: 'character varying' },
|
|
484
|
+
constraints: [{ type: 'not null' }],
|
|
485
|
+
collate: {
|
|
486
|
+
schema: 'pg_catalog',
|
|
487
|
+
name: 'default',
|
|
488
|
+
},
|
|
489
|
+
}],
|
|
490
|
+
})
|
|
491
|
+
|
|
492
|
+
|
|
493
|
+
// bugifx
|
|
494
|
+
checkCreateTable([`CREATE TABLE public.mytable (
|
|
495
|
+
feature text DEFAULT 'main'::text NOT NULL
|
|
496
|
+
);`], {
|
|
497
|
+
type: 'create table',
|
|
498
|
+
name: {
|
|
499
|
+
name: 'mytable',
|
|
500
|
+
schema: 'public',
|
|
501
|
+
},
|
|
502
|
+
columns: [{
|
|
503
|
+
kind: 'column',
|
|
504
|
+
name: { name: 'feature' },
|
|
505
|
+
dataType: { name: 'text' },
|
|
506
|
+
constraints: [{
|
|
507
|
+
type: 'default',
|
|
508
|
+
default: {
|
|
509
|
+
type: 'cast',
|
|
510
|
+
to: { name: 'text' },
|
|
511
|
+
operand: {
|
|
512
|
+
type: 'string',
|
|
513
|
+
value: 'main',
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
}, {
|
|
517
|
+
type: 'not null'
|
|
518
|
+
}],
|
|
519
|
+
}],
|
|
520
|
+
})
|
|
521
|
+
|
|
522
|
+
// bugifx
|
|
523
|
+
checkCreateTable([`CREATE TABLE public.mytable (
|
|
524
|
+
update_date timestamp without time zone,
|
|
525
|
+
creation_date timestamp without time zone DEFAULT LOCALTIMESTAMP
|
|
526
|
+
);`], {
|
|
527
|
+
type: 'create table',
|
|
528
|
+
name: {
|
|
529
|
+
name: 'mytable',
|
|
530
|
+
schema: 'public',
|
|
531
|
+
},
|
|
532
|
+
columns: [{
|
|
533
|
+
kind: 'column',
|
|
534
|
+
name: { name: 'update_date' },
|
|
535
|
+
dataType: { name: 'timestamp without time zone' },
|
|
536
|
+
}, {
|
|
537
|
+
kind: 'column',
|
|
538
|
+
name: { name: 'creation_date' },
|
|
539
|
+
dataType: { name: 'timestamp without time zone' },
|
|
540
|
+
constraints: [{
|
|
541
|
+
type: 'default',
|
|
542
|
+
default: {
|
|
543
|
+
type: 'keyword',
|
|
544
|
+
keyword: 'localtimestamp',
|
|
545
|
+
},
|
|
546
|
+
}]
|
|
547
|
+
}],
|
|
548
|
+
})
|
|
549
|
+
|
|
550
|
+
|
|
551
|
+
checkCreateTable([`CREATE TABLE mytable (
|
|
552
|
+
dt timestamptz
|
|
553
|
+
);`], {
|
|
554
|
+
type: 'create table',
|
|
555
|
+
name: { name: 'mytable', },
|
|
556
|
+
columns: [{
|
|
557
|
+
kind: 'column',
|
|
558
|
+
name: { name: 'dt' },
|
|
559
|
+
dataType: { name: 'timestamptz' },
|
|
560
|
+
}],
|
|
561
|
+
})
|
|
562
|
+
|
|
563
|
+
|
|
564
|
+
// bugfix
|
|
565
|
+
checkCreateTable([`CREATE TABLE Post (
|
|
566
|
+
categoryId text,
|
|
567
|
+
CONSTRAINT Post_fk_categoryId FOREIGN KEY (categoryId)
|
|
568
|
+
REFERENCES Category (id) ON UPDATE CASCADE ON DELETE CASCADE,
|
|
569
|
+
CONSTRAINT Post_ck_isPublished CHECK (isPublished IN (0, 1))
|
|
570
|
+
);`], {
|
|
571
|
+
type: 'create table',
|
|
572
|
+
name: { name: 'post', },
|
|
573
|
+
columns: [{
|
|
574
|
+
kind: 'column',
|
|
575
|
+
name: { name: 'categoryid' },
|
|
576
|
+
dataType: { name: 'text' },
|
|
577
|
+
}],
|
|
578
|
+
constraints: [{
|
|
579
|
+
type: 'foreign key',
|
|
580
|
+
foreignTable: { name: 'category' },
|
|
581
|
+
foreignColumns: [{ name: 'id' }],
|
|
582
|
+
localColumns: [{ name: 'categoryid' }],
|
|
583
|
+
onUpdate: 'cascade',
|
|
584
|
+
onDelete: 'cascade',
|
|
585
|
+
constraintName: { name: 'post_fk_categoryid' },
|
|
586
|
+
}, {
|
|
587
|
+
type: 'check',
|
|
588
|
+
constraintName: { name: 'post_ck_ispublished' },
|
|
589
|
+
expr: {
|
|
590
|
+
type: 'binary',
|
|
591
|
+
op: 'IN',
|
|
592
|
+
left: { type: 'ref', name: 'ispublished' },
|
|
593
|
+
right: {
|
|
594
|
+
type: 'list',
|
|
595
|
+
expressions: [
|
|
596
|
+
{ type: 'integer', value: 0 },
|
|
597
|
+
{ type: 'integer', value: 1 }
|
|
598
|
+
]
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
}]
|
|
602
|
+
})
|
|
603
|
+
|
|
604
|
+
checkCreateTable([`CREATE TABLE color (
|
|
605
|
+
color_id INT GENERATED ALWAYS AS IDENTITY
|
|
606
|
+
)`], {
|
|
607
|
+
type: 'create table',
|
|
608
|
+
name: { name: 'color', },
|
|
609
|
+
columns: [{
|
|
610
|
+
kind: 'column',
|
|
611
|
+
dataType: { name: 'int' },
|
|
612
|
+
name: { name: 'color_id' },
|
|
613
|
+
constraints: [{
|
|
614
|
+
type: 'add generated',
|
|
615
|
+
always: 'always',
|
|
616
|
+
}]
|
|
617
|
+
}],
|
|
618
|
+
})
|
|
619
|
+
|
|
620
|
+
checkCreateTableLoc([`CREATE TABLE color (
|
|
621
|
+
color_id INT GENERATED BY DEFAULT AS IDENTITY
|
|
622
|
+
(START WITH 10 INCREMENT BY 10)
|
|
623
|
+
); `], {
|
|
624
|
+
_location: { start: 0, end: 120 },
|
|
625
|
+
type: 'create table',
|
|
626
|
+
name: {
|
|
627
|
+
_location: { start: 13, end: 18 },
|
|
628
|
+
name: 'color',
|
|
629
|
+
},
|
|
630
|
+
columns: [{
|
|
631
|
+
_location: { start: 29, end: 114 },
|
|
632
|
+
kind: 'column',
|
|
633
|
+
dataType: {
|
|
634
|
+
_location: { start: 38, end: 41 },
|
|
635
|
+
name: 'int'
|
|
636
|
+
},
|
|
637
|
+
name: {
|
|
638
|
+
_location: { start: 29, end: 37 },
|
|
639
|
+
name: 'color_id',
|
|
640
|
+
},
|
|
641
|
+
constraints: [{
|
|
642
|
+
_location: { start: 42, end: 114 },
|
|
643
|
+
type: 'add generated',
|
|
644
|
+
always: 'by default',
|
|
645
|
+
sequence: {
|
|
646
|
+
_location: { start: 83, end: 114 },
|
|
647
|
+
startWith: 10,
|
|
648
|
+
incrementBy: 10
|
|
649
|
+
}
|
|
650
|
+
}],
|
|
651
|
+
}],
|
|
652
|
+
})
|
|
653
|
+
|
|
654
|
+
|
|
655
|
+
checkCreateTable([`create table newtable (
|
|
656
|
+
like first_table,
|
|
657
|
+
other int,
|
|
658
|
+
like myschema.secondtable including all);`], {
|
|
659
|
+
type: 'create table',
|
|
660
|
+
name: { name: 'newtable', },
|
|
661
|
+
columns: [{
|
|
662
|
+
kind: 'like table',
|
|
663
|
+
like: { name: 'first_table' },
|
|
664
|
+
options: [],
|
|
665
|
+
}, {
|
|
666
|
+
kind: 'column',
|
|
667
|
+
name: { name: 'other' },
|
|
668
|
+
dataType: { name: 'int' },
|
|
669
|
+
}, {
|
|
670
|
+
kind: 'like table',
|
|
671
|
+
like: { schema: 'myschema', name: 'secondtable' },
|
|
672
|
+
options: [{ verb: 'including', option: 'all' }],
|
|
673
|
+
}],
|
|
674
|
+
})
|
|
675
|
+
|
|
676
|
+
checkCreateTable(`create table _example (_id text)`, {
|
|
677
|
+
type: 'create table',
|
|
678
|
+
name: { name: '_example', },
|
|
679
|
+
columns: [{
|
|
680
|
+
kind: 'column',
|
|
681
|
+
dataType: { name: 'text' },
|
|
682
|
+
name: { name: '_id' },
|
|
683
|
+
}],
|
|
684
|
+
})
|
|
685
|
+
|
|
686
|
+
|
|
687
|
+
// fixes https://github.com/oguimbal/pgsql-ast-parser/issues/53
|
|
688
|
+
checkCreateTable(`CREATE TABLE "tb_user" (
|
|
689
|
+
"user_no" serial8 NOT NULL,
|
|
690
|
+
"reg_date" timestamptz DEFAULT (CURRENT_TIMESTAMP AT TIME ZONE 'Asia/Seoul') NOT NULL,
|
|
691
|
+
"complete_yn" boolean DEFAULT false NOT NULL
|
|
692
|
+
)`, {
|
|
693
|
+
type: 'create table',
|
|
694
|
+
name: { name: 'tb_user' },
|
|
695
|
+
columns: [
|
|
696
|
+
{
|
|
697
|
+
kind: 'column',
|
|
698
|
+
name: { name: 'user_no' },
|
|
699
|
+
dataType: { name: 'serial8' },
|
|
700
|
+
constraints: [{ type: 'not null' }],
|
|
701
|
+
},
|
|
702
|
+
{
|
|
703
|
+
kind: 'column',
|
|
704
|
+
dataType: { name: 'timestamptz' },
|
|
705
|
+
name: { name: 'reg_date' },
|
|
706
|
+
constraints: [
|
|
707
|
+
{
|
|
708
|
+
type: 'default',
|
|
709
|
+
default: {
|
|
710
|
+
type: 'binary',
|
|
711
|
+
op: 'AT TIME ZONE',
|
|
712
|
+
left: { type: 'keyword', keyword: 'current_timestamp' },
|
|
713
|
+
right: { type: 'string', value: 'Asia/Seoul' }
|
|
714
|
+
}
|
|
715
|
+
},
|
|
716
|
+
{
|
|
717
|
+
type: 'not null',
|
|
718
|
+
}
|
|
719
|
+
]
|
|
720
|
+
},
|
|
721
|
+
{
|
|
722
|
+
kind: 'column',
|
|
723
|
+
name: { name: 'complete_yn' },
|
|
724
|
+
dataType: { name: 'boolean' },
|
|
725
|
+
constraints: [
|
|
726
|
+
{ type: 'default', default: { type: 'boolean', value: false } },
|
|
727
|
+
{ type: 'not null' },
|
|
728
|
+
],
|
|
729
|
+
},
|
|
730
|
+
]
|
|
731
|
+
});
|
|
732
|
+
|
|
733
|
+
checkCreateTable(`CREATE TABLE foo (
|
|
734
|
+
id BIGSERIAL PRIMARY KEY,
|
|
735
|
+
bar_id INTEGER NOT NULL REFERENCES users(id)
|
|
736
|
+
)`, {
|
|
737
|
+
type: 'create table',
|
|
738
|
+
name: { name: 'foo' },
|
|
739
|
+
columns: [
|
|
740
|
+
{
|
|
741
|
+
kind: 'column',
|
|
742
|
+
name: { name: 'id' },
|
|
743
|
+
dataType: { name: 'bigserial' },
|
|
744
|
+
constraints: [{ type: 'primary key' }],
|
|
745
|
+
},
|
|
746
|
+
{
|
|
747
|
+
kind: 'column',
|
|
748
|
+
name: { name: 'bar_id' },
|
|
749
|
+
dataType: { name: 'integer' },
|
|
750
|
+
constraints: [
|
|
751
|
+
{ type: 'not null' },
|
|
752
|
+
{
|
|
753
|
+
type: 'reference',
|
|
754
|
+
foreignTable: { name: 'users' },
|
|
755
|
+
foreignColumns: [{ name: 'id' }],
|
|
756
|
+
}
|
|
757
|
+
],
|
|
758
|
+
},
|
|
759
|
+
]
|
|
760
|
+
})
|
|
761
|
+
});
|