Initial import of LogDarioSeq baseline
Establishes version control for the personal Logseq DB fork before starting the server-client architecture migration and domain features described in docs/agent-guide and the approved implementation plan. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
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)
|
||||
);
|
||||
2
deps/db-sync/worker/migrations/0002_add_graph_e2ee.sql
vendored
Normal file
2
deps/db-sync/worker/migrations/0002_add_graph_e2ee.sql
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
alter table graphs
|
||||
add column graph_e2ee integer default 1;
|
||||
8
deps/db-sync/worker/migrations/0003_add_indexes.sql
vendored
Normal file
8
deps/db-sync/worker/migrations/0003_add_indexes.sql
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
create index if not exists idx_graph_members_graph_id_created_at
|
||||
on graph_members (graph_id, created_at);
|
||||
|
||||
create index if not exists idx_graphs_user_id_updated_at
|
||||
on graphs (user_id, updated_at desc);
|
||||
|
||||
create index if not exists idx_users_email
|
||||
on users (email);
|
||||
2
deps/db-sync/worker/migrations/0004_add_graph_ready_for_use.sql
vendored
Normal file
2
deps/db-sync/worker/migrations/0004_add_graph_ready_for_use.sql
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
alter table graphs
|
||||
add column graph_ready_for_use integer default 1;
|
||||
2
deps/db-sync/worker/migrations/0005_add_user_created_at.sql
vendored
Normal file
2
deps/db-sync/worker/migrations/0005_add_user_created_at.sql
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
alter table users
|
||||
add column created_at integer;
|
||||
11
deps/db-sync/worker/migrations/0006_add_daily_active_entities.sql
vendored
Normal file
11
deps/db-sync/worker/migrations/0006_add_daily_active_entities.sql
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
create table if not exists daily_active_entities (
|
||||
day_utc text,
|
||||
entity_type text,
|
||||
entity_id text,
|
||||
first_seen_at integer,
|
||||
primary key (day_utc, entity_type, entity_id),
|
||||
check (entity_type in ('user', 'graph'))
|
||||
);
|
||||
|
||||
create index if not exists idx_daily_active_entities_type_day
|
||||
on daily_active_entities (entity_type, day_utc);
|
||||
Reference in New Issue
Block a user