mirror of
https://github.com/logseq/logseq.git
synced 2026-02-01 22:47:36 +00:00
don't initialize schema at request time
This commit is contained in:
11
deps/db-sync/README.md
vendored
11
deps/db-sync/README.md
vendored
@@ -20,6 +20,17 @@ cd deps/db-sync/worker
|
||||
wrangler dev
|
||||
```
|
||||
|
||||
### D1 Schema (Worker)
|
||||
|
||||
The worker no longer initializes schema at request time. Apply the D1 schema
|
||||
via migrations during deployment/CI.
|
||||
|
||||
```bash
|
||||
cd deps/db-sync/worker
|
||||
wrangler d1 migrations apply logseq-sync-graph-meta-staging --env staging
|
||||
wrangler d1 migrations apply logseq-sync-graphs-prod --env prod
|
||||
```
|
||||
|
||||
### Node.js Adapter (self-hosted)
|
||||
|
||||
Build the adapter:
|
||||
|
||||
@@ -297,8 +297,7 @@
|
||||
(http/error-response "server error" 500)
|
||||
|
||||
:else
|
||||
(p/let [_ (index/<index-init! db)
|
||||
init-ms (common/now-ms)
|
||||
(p/let [init-ms start-ms
|
||||
claims (auth/auth-claims request env)
|
||||
auth-ms (common/now-ms)
|
||||
_ (when claims
|
||||
|
||||
42
deps/db-sync/worker/migrations/0001_init.sql
vendored
Normal file
42
deps/db-sync/worker/migrations/0001_init.sql
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
create table if not exists graphs (
|
||||
graph_id text primary key,
|
||||
graph_name text,
|
||||
user_id text,
|
||||
schema_version text,
|
||||
created_at integer,
|
||||
updated_at integer
|
||||
);
|
||||
|
||||
create table if not exists users (
|
||||
id text primary key,
|
||||
email text,
|
||||
email_verified integer,
|
||||
username text
|
||||
);
|
||||
|
||||
create table if not exists user_rsa_keys (
|
||||
user_id text primary key,
|
||||
public_key text,
|
||||
encrypted_private_key text,
|
||||
created_at integer,
|
||||
updated_at integer
|
||||
);
|
||||
|
||||
create table if not exists graph_members (
|
||||
user_id text,
|
||||
graph_id text,
|
||||
role text,
|
||||
invited_by text,
|
||||
created_at integer,
|
||||
primary key (user_id, graph_id),
|
||||
check (role in ('manager', 'member'))
|
||||
);
|
||||
|
||||
create table if not exists graph_aes_keys (
|
||||
graph_id text,
|
||||
user_id text,
|
||||
encrypted_aes_key text,
|
||||
created_at integer,
|
||||
updated_at integer,
|
||||
primary key (graph_id, user_id)
|
||||
);
|
||||
Reference in New Issue
Block a user