Skip to content

Commit 7c5deb7

Browse files
committed
Close the DDL gap in SQL: the 'ALTER' path of the parser now completed
1 parent f4e1403 commit 7c5deb7

169 files changed

Lines changed: 4098 additions & 32979 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 24 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ The big picture? **[SQL, reimagined for modern apps ↗](https://linked-ql.netli
8383
8484
> [!IMPORTANT]
8585
> LinkedQL is backed by **1,000+ tests and growing**, with strong coverage across **FlashQL, live queries, edge transport, federation, WAL, sync, and parser/engine behavior**.<br>
86-
> The main areas still being expanded are **broader DDL parity, migrations, and deeper driver hardening across environments**.
86+
> The main areas still being expanded are **broader dialect parity, migrations, and deeper driver hardening across environments**.
8787
8888
---
8989
@@ -1019,26 +1019,19 @@ Moving on to the goal of not just a local database but one that can mirror remot
10191019
First, we create a local "namespace" – more traditionally called a "schema" – that contains the tables we'll use to mirror remote tables.
10201020
10211021
```js
1022-
await db.storageEngine.transaction(async (tx) => {
1023-
1024-
await tx.createNamespace({
1025-
name: 'remote',
1026-
1027-
// Logical name of the remote system
1028-
replication_origin: 'primary', // The value passed to onCreateForeignClient()
1029-
1030-
// Indicates how to reach it (via EdgeClient)
1031-
replication_origin_type: 'edge',
1032-
});
1033-
1034-
});
1022+
await db.query(`
1023+
CREATE SCHEMA remote
1024+
WITH (
1025+
replication_origin = 'primary',
1026+
replication_origin_type = 'edge'
1027+
)
1028+
`);
10351029
```
10361030
10371031
---
10381032
10391033
##### Decoding the above
10401034
1041-
* The programmatic `tx.createNamespace()` call above is equivalent to `db.query('CREATE SCHEMA remote')`, but it lets us add the concept of **foreign origin**
10421035
* `remote` is a **real local namespace (schema)** that can have tables and views (`VIEWS`) just like a regular namespace
10431036
* The difference is what happens when you create a view inside it: those views will automatically resolve from the remote origin instead of the local database
10441037
@@ -1079,20 +1072,10 @@ We demonstrate each mode below.
10791072
##### Mode 1: Origin Views (Pure Federation)
10801073
10811074
```js
1082-
await db.storageEngine.transaction(async (tx) => {
1083-
1084-
await tx.createView({
1085-
// Define under the local namespace called "remote"
1086-
namespace: 'remote',
1087-
name: 'users',
1088-
1089-
persistence: 'origin',
1090-
1091-
// Refers to public.users in the remote DB
1092-
view_spec: { namespace: 'public', name: 'users' },
1093-
});
1094-
1095-
});
1075+
await db.query(`
1076+
CREATE ORIGIN VIEW remote.users AS
1077+
SELECT * FROM public.users
1078+
`);
10961079
```
10971080
10981081
---
@@ -1114,20 +1097,10 @@ This is the lightest-weight mode. It gives you unification without local storage
11141097
##### Mode 2: Materialized Views (Local Cache)
11151098
11161099
```js
1117-
await db.storageEngine.transaction(async (tx) => {
1118-
1119-
await tx.createView({
1120-
// Define under the local namespace called "remote"
1121-
namespace: 'remote',
1122-
name: 'orders',
1123-
1124-
persistence: 'materialized',
1125-
1126-
// Refers to public.orders in the remote DB
1127-
view_spec: { namespace: 'public', name: 'orders' },
1128-
});
1129-
1130-
});
1100+
await db.query(`
1101+
CREATE MATERIALIZED VIEW remote.orders AS
1102+
SELECT * FROM public.orders
1103+
`);
11311104
```
11321105
11331106
---
@@ -1153,20 +1126,12 @@ This is the mode to reach for when:
11531126
##### Mode 3: Realtime Views (Live Mirror)
11541127
11551128
```js
1156-
await db.storageEngine.transaction(async (tx) => {
1157-
1158-
await tx.createView({
1159-
// Define under the local namespace called "remote"
1160-
namespace: 'remote',
1161-
name: 'posts',
1162-
1163-
persistence: 'realtime',
1164-
1165-
// Refers to public.posts in the remote DB
1166-
view_spec: { query: `SELECT * FROM public.posts WHERE post_type = 'NEWS'` },
1167-
});
1168-
1169-
});
1129+
await db.query(`
1130+
CREATE REALTIME VIEW remote.posts AS
1131+
SELECT *
1132+
FROM public.posts
1133+
WHERE post_type = 'NEWS'
1134+
`);
11701135
```
11711136
11721137
---
@@ -1181,8 +1146,6 @@ This is **realtime mirroring**:
11811146
11821147
> A local table that tracks and syncs with the remote table over time
11831148
1184-
Notice from the above that `view_spec` for any of the modes can be any SQL query, as against just a `namespace → name` declaration.
1185-
11861149
This is the richest mode:
11871150
11881151
* it starts with local state
@@ -1240,6 +1203,8 @@ window.addEventListener('online', () => {
12401203
At that point, your local database is no longer just "configured".
12411204
It is now hydrated, subscribed where necessary, and ready to behave like a unified relational graph.
12421205
1206+
> Note that the initial `db.sync.sync()` can be automatically-handled by FlashQL. Simply pass `autoSync: true` in constructor parameters.
1207+
12431208
---
12441209
12451210
#### Step 5: Querying the Unified Graph

site/.vitepress/dist/404.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@
66
<title>404 | LinkedQL</title>
77
<meta name="description" content="Not Found">
88
<meta name="generator" content="VitePress v1.6.4">
9-
<link rel="preload stylesheet" href="/assets/style.B7OmO4rY.css" as="style">
9+
<link rel="preload stylesheet" href="/assets/style.DxeyQAKk.css" as="style">
1010
<link rel="preload stylesheet" href="/vp-icons.css" as="style">
1111

12-
<script type="module" src="/assets/app.DTyr3kCT.js"></script>
12+
<script type="module" src="/assets/app.CFGO9TE3.js"></script>
1313
<link rel="preload" href="/assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
1414
<meta name="theme-color" content="gold">
1515
<script id="check-dark-mode">document.documentElement.classList.add("dark");</script>
1616
<script id="check-mac-os">document.documentElement.classList.toggle("mac",/Mac|iPhone|iPod|iPad/i.test(navigator.platform));</script>
1717
</head>
1818
<body>
1919
<div id="app"></div>
20-
<script>window.__VP_HASH_MAP__=JSON.parse("{\"capabilities.md\":\"5XW7Hrwb\",\"capabilities_changefeeds.md\":\"BtezjLjN\",\"capabilities_deeprefs.md\":\"D7SCP_Un\",\"capabilities_json-literals.md\":\"BDieiLDe\",\"capabilities_live-queries.md\":\"DWeHiTzS\",\"capabilities_streaming.md\":\"QgApYeWt\",\"capabilities_upsert.md\":\"C7HcciZq\",\"capabilities_version-binding.md\":\"BqZQkg34\",\"docs.md\":\"QFZYmWQj\",\"docs_query-api.md\":\"Daum4Gjm\",\"docs_setup.md\":\"iLHBWooU\",\"engineering_realtime-engine.md\":\"cGAlOLM6\",\"flashql.md\":\"D8bfmGjb\",\"flashql_foreign-io.md\":\"BqKcWz8r\",\"flashql_lang.md\":\"DK3S35m5\",\"flashql_sync.md\":\"_zCXhBd0\",\"index.md\":\"DlwrrdN6\",\"overview.md\":\"DO37abAg\"}");window.__VP_SITE_DATA__=JSON.parse("{\"lang\":\"en-US\",\"dir\":\"ltr\",\"title\":\"LinkedQL\",\"description\":\"A modern take on SQL and SQL databases — with reactivity, versioning, and more.\",\"base\":\"/\",\"head\":[],\"router\":{\"prefetchLinks\":true},\"appearance\":\"force-dark\",\"themeConfig\":{\"logo\":{\"src\":\"/img/brand/linked-ql-logo.png\",\"height\":140},\"siteTitle\":false,\"socialLinks\":[{\"icon\":\"github\",\"link\":\"https://github.com/linked-db/linked-ql\"}],\"nav\":[{\"text\":\"What is LinkedQL\",\"link\":\"/overview\",\"activeMatch\":\"/overview\"},{\"text\":\"Capabilities\",\"link\":\"/capabilities\",\"activeMatch\":\"/capabilities\"},{\"text\":\"Docs\",\"link\":\"/docs\",\"activeMatch\":\"/docs\"},{\"text\":\"FlashQL\",\"link\":\"/flashql\",\"activeMatch\":\"/flashql\"},{\"text\":\"Engineering\",\"link\":\"/engineering/realtime-engine\",\"activeMatch\":\"/engineering\"},{\"text\":\"Star on GitHub\",\"link\":\"https://github.com/linked-db/linked-ql\"}],\"sidebar\":{\"/\":[{\"text\":\"Overview\",\"items\":[{\"text\":\"What is LinkedQL\",\"link\":\"/overview\"}]},{\"text\":\"Docs\",\"items\":[{\"text\":\"Getting Started\",\"link\":\"/docs\"},{\"text\":\"Dialects & Clients\",\"link\":\"/docs/setup\"},{\"text\":\"Query Interface\",\"link\":\"/docs/query-api\"}]},{\"text\":\"Capabilities\",\"items\":[{\"text\":\"Capabilities Overview\",\"link\":\"/capabilities\"},{\"text\":\"Live Queries\",\"link\":\"/capabilities/live-queries\"},{\"text\":\"Streaming\",\"link\":\"/capabilities/streaming\"},{\"text\":\"Changefeeds (WAL)\",\"link\":\"/capabilities/changefeeds\"},{\"text\":\"DeepRefs\",\"link\":\"/capabilities/deeprefs\"},{\"text\":\"JSON Literals\",\"link\":\"/capabilities/json-literals\"},{\"text\":\"UPSERT\",\"link\":\"/capabilities/upsert\"},{\"text\":\"Version Binding\",\"link\":\"/capabilities/version-binding\"}]},{\"text\":\"FlashQL\",\"items\":[{\"text\":\"FlashQL Overview\",\"link\":\"/flashql\"},{\"text\":\"Federation & Sync\",\"link\":\"/flashql/foreign-io\"},{\"text\":\"Sync\",\"link\":\"/flashql/sync\"},{\"text\":\"Language Reference\",\"link\":\"/flashql/lang\"}]},{\"text\":\"Engineering\",\"items\":[{\"text\":\"The Realtime Engine\",\"link\":\"/engineering/realtime-engine\"}]}]},\"footer\":{\"message\":\"MIT Licensed\",\"copyright\":\"© Oxford Harrison\"},\"search\":{\"provider\":\"local\"}},\"locales\":{},\"scrollOffset\":134,\"cleanUrls\":true}");</script>
20+
<script>window.__VP_HASH_MAP__=JSON.parse("{\"capabilities.md\":\"F0SqD2Jn\",\"capabilities_changefeeds.md\":\"BbVKE835\",\"capabilities_deeprefs.md\":\"CEI21O9O\",\"capabilities_json-literals.md\":\"0XOfRqew\",\"capabilities_live-queries.md\":\"ELg9xpgj\",\"capabilities_streaming.md\":\"b3c0XtJ7\",\"capabilities_upsert.md\":\"Dmbzr96U\",\"capabilities_version-binding.md\":\"DcmNgFeX\",\"docs.md\":\"Bb25GAxu\",\"docs_query-api.md\":\"BxW7Asb7\",\"docs_setup.md\":\"C_FRjVi1\",\"engineering_realtime-engine.md\":\"C2aTCXTA\",\"flashql.md\":\"sgPfa8_k\",\"flashql_foreign-io.md\":\"TlXuRTa1\",\"flashql_lang.md\":\"CcCeyZpa\",\"flashql_sync.md\":\"rdQuHHEu\",\"index.md\":\"fUHeYgb-\",\"overview.md\":\"BhRo4Yxc\"}");window.__VP_SITE_DATA__=JSON.parse("{\"lang\":\"en-US\",\"dir\":\"ltr\",\"title\":\"LinkedQL\",\"description\":\"A modern take on SQL and SQL databases — with reactivity, versioning, and more.\",\"base\":\"/\",\"head\":[],\"router\":{\"prefetchLinks\":true},\"appearance\":\"force-dark\",\"themeConfig\":{\"logo\":{\"src\":\"/img/brand/linked-ql-logo.png\",\"height\":140},\"siteTitle\":false,\"socialLinks\":[{\"icon\":\"github\",\"link\":\"https://github.com/linked-db/linked-ql\"}],\"nav\":[{\"text\":\"What is LinkedQL\",\"link\":\"/overview\",\"activeMatch\":\"/overview\"},{\"text\":\"Capabilities\",\"link\":\"/capabilities\",\"activeMatch\":\"/capabilities\"},{\"text\":\"Docs\",\"link\":\"/docs\",\"activeMatch\":\"/docs\"},{\"text\":\"FlashQL\",\"link\":\"/flashql\",\"activeMatch\":\"/flashql\"},{\"text\":\"Engineering\",\"link\":\"/engineering/realtime-engine\",\"activeMatch\":\"/engineering\"},{\"text\":\"Star on GitHub\",\"link\":\"https://github.com/linked-db/linked-ql\"}],\"sidebar\":{\"/\":[{\"text\":\"Overview\",\"items\":[{\"text\":\"What is LinkedQL\",\"link\":\"/overview\"}]},{\"text\":\"Docs\",\"items\":[{\"text\":\"Getting Started\",\"link\":\"/docs\"},{\"text\":\"Dialects & Clients\",\"link\":\"/docs/setup\"},{\"text\":\"Query Interface\",\"link\":\"/docs/query-api\"}]},{\"text\":\"Capabilities\",\"items\":[{\"text\":\"Capabilities Overview\",\"link\":\"/capabilities\"},{\"text\":\"Live Queries\",\"link\":\"/capabilities/live-queries\"},{\"text\":\"Streaming\",\"link\":\"/capabilities/streaming\"},{\"text\":\"Changefeeds (WAL)\",\"link\":\"/capabilities/changefeeds\"},{\"text\":\"DeepRefs\",\"link\":\"/capabilities/deeprefs\"},{\"text\":\"JSON Literals\",\"link\":\"/capabilities/json-literals\"},{\"text\":\"UPSERT\",\"link\":\"/capabilities/upsert\"},{\"text\":\"Version Binding\",\"link\":\"/capabilities/version-binding\"}]},{\"text\":\"FlashQL\",\"items\":[{\"text\":\"FlashQL Overview\",\"link\":\"/flashql\"},{\"text\":\"Federation & Sync\",\"link\":\"/flashql/foreign-io\"},{\"text\":\"Sync\",\"link\":\"/flashql/sync\"},{\"text\":\"Language Reference\",\"link\":\"/flashql/lang\"}]},{\"text\":\"Engineering\",\"items\":[{\"text\":\"The Realtime Engine\",\"link\":\"/engineering/realtime-engine\"}]}]},\"footer\":{\"message\":\"MIT Licensed\",\"copyright\":\"© Oxford Harrison\"},\"search\":{\"provider\":\"local\"}},\"locales\":{},\"scrollOffset\":134,\"cleanUrls\":true}");</script>
2121

2222
</body>
2323
</html>

site/.vitepress/dist/assets/app.CFGO9TE3.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

site/.vitepress/dist/assets/app.DTyr3kCT.js

Lines changed: 0 additions & 106 deletions
This file was deleted.

site/.vitepress/dist/assets/capabilities.md.5XW7Hrwb.js

Lines changed: 0 additions & 13 deletions
This file was deleted.

site/.vitepress/dist/assets/capabilities.md.5XW7Hrwb.lean.js

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)