diff options
| author | 2025-04-17 17:30:22 +0100 | |
|---|---|---|
| committer | 2025-04-17 17:30:22 +0100 | |
| commit | 61b755c890dcaa66daa35942ca87cc00269b0fe9 (patch) | |
| tree | 36190a844cfef474d5e11fe473db462bb4a4d135 /filamento/migrations | |
| parent | 26d0ee51e232b793bc83ba565c0e9ab820d8d0db (diff) | |
| download | luz-61b755c890dcaa66daa35942ca87cc00269b0fe9.tar.gz luz-61b755c890dcaa66daa35942ca87cc00269b0fe9.tar.bz2 luz-61b755c890dcaa66daa35942ca87cc00269b0fe9.zip  | |
feat(filamento): full wasm support by switching to rusqlite
Diffstat (limited to '')
| -rw-r--r-- | filamento/migrations/1.sql (renamed from filamento/migrations/20240113011930_luz.sql) | 34 | 
1 files changed, 17 insertions, 17 deletions
diff --git a/filamento/migrations/20240113011930_luz.sql b/filamento/migrations/1.sql index c2f35dd..502c5a9 100644 --- a/filamento/migrations/20240113011930_luz.sql +++ b/filamento/migrations/1.sql @@ -2,7 +2,7 @@ PRAGMA foreign_keys = on;  -- a user jid will never change, only a chat user will change  -- TODO: avatar, nick, etc. -create table users( +create table if not exists users(      -- TODO: enforce bare jid      jid text primary key not null,      nick text, @@ -29,7 +29,7 @@ create table users(  --     primary key(activated timestamp, id, jid)  -- ); -create table resources( +create table if not exists resources(      bare_jid text not null,      resource text not null,      foreign key(bare_jid) references users(jid), @@ -37,14 +37,14 @@ create table resources(  );  -- enum for subscription state -create table subscription( +create table if not exists subscription(      state text primary key not null  ); -insert into subscription ( state ) values ('none'), ('pending-out'), ('pending-in'), ('pending-in-pending-out'), ('only-out'), ('only-in'), ('out-pending-in'), ('in-pending-out'), ('buddy'); +insert into subscription ( state ) values ('none'), ('pending-out'), ('pending-in'), ('pending-in-pending-out'), ('only-out'), ('only-in'), ('out-pending-in'), ('in-pending-out'), ('buddy') on conflict do nothing;  -- a roster contains users, with client-set nickname -CREATE TABLE roster(  +CREATE TABLE if not exists roster(       user_jid text primary key not null,      name TEXT,      subscription text not null, @@ -52,11 +52,11 @@ CREATE TABLE roster(      foreign key(user_jid) references users(jid)  ); -create table groups( +create table if not exists groups(      group_name text primary key not null  ); -create table groups_roster( +create table if not exists groups_roster(      group_name text not null,      contact_jid text not null,      foreign key(group_name) references groups(group_name), @@ -67,7 +67,7 @@ create table groups_roster(  -- chat includes reference to user jid chat is with  -- specifically for dms, groups should be different  -- can send chat message to user (creating a new chat if not already exists) -create table chats ( +create table if not exists chats (      id text primary key not null,      have_chatted bool not null,      correspondent text not null unique, @@ -75,14 +75,14 @@ create table chats (  );  -- enum for subscription state -create table delivery( +create table if not exists delivery(      state text primary key not null  ); -insert into delivery ( state ) values ('sending'), ('written'), ('sent'), ('delivered'), ('read'), ('failed'), ('queued'); +insert into delivery ( state ) values ('sending'), ('written'), ('sent'), ('delivered'), ('read'), ('failed'), ('queued') on conflict do nothing;  -- messages include reference to chat they are in, and who sent them. -create table messages ( +create table if not exists messages (      id text primary key not null,      body text,      -- delivery is nullable as only messages sent by the user are markable @@ -116,26 +116,26 @@ create table messages (  );  -- enum for subscription state -create table show ( +create table if not exists show (      state text primary key not null  ); -insert into show ( state ) values ('away'), ('chat'), ('do-not-disturb'), ('extended-away'); +insert into show ( state ) values ('away'), ('chat'), ('do-not-disturb'), ('extended-away') on conflict do nothing; -create table cached_status ( +create table if not exists cached_status (      id integer primary key not null,      show text,      message text,      foreign key(show) references show(state)  ); -insert into cached_status (id) values (0); +insert into cached_status (id) values (0) on conflict do nothing; -create table capability_hash_nodes ( +create table if not exists capability_hash_nodes (      node text primary key not null,      timestamp text,      -- TODO: normalization      capabilities text not null  ); -insert into capability_hash_nodes ( node, capabilities ) values ('https://bunny.garden/filamento#mSavc/SLnHm8zazs5RlcbD/iXoc=', 'aHR0cDovL2phYmJlci5vcmcvcHJvdG9jb2wvY2Fwcx9odHRwOi8vamFiYmVyLm9yZy9wcm90b2NvbC9kaXNjbyNpbmZvH2h0dHA6Ly9qYWJiZXIub3JnL3Byb3RvY29sL2Rpc2NvI2l0ZW1zH2h0dHA6Ly9qYWJiZXIub3JnL3Byb3RvY29sL25pY2sfaHR0cDovL2phYmJlci5vcmcvcHJvdG9jb2wvbmljaytub3RpZnkfHGNsaWVudB9wYx8fZmlsYW1lbnRvIDAuMS4wHx4cHA=='); +insert into capability_hash_nodes ( node, capabilities ) values ('https://bunny.garden/filamento#mSavc/SLnHm8zazs5RlcbD/iXoc=', 'aHR0cDovL2phYmJlci5vcmcvcHJvdG9jb2wvY2Fwcx9odHRwOi8vamFiYmVyLm9yZy9wcm90b2NvbC9kaXNjbyNpbmZvH2h0dHA6Ly9qYWJiZXIub3JnL3Byb3RvY29sL2Rpc2NvI2l0ZW1zH2h0dHA6Ly9qYWJiZXIub3JnL3Byb3RvY29sL25pY2sfaHR0cDovL2phYmJlci5vcmcvcHJvdG9jb2wvbmljaytub3RpZnkfHGNsaWVudB9wYx8fZmlsYW1lbnRvIDAuMS4wHx4cHA==') on conflict do nothing;  | 
