summaryrefslogtreecommitdiff
path: root/migrations
diff options
context:
space:
mode:
Diffstat (limited to 'migrations')
-rw-r--r--migrations/20250819.php37
1 files changed, 35 insertions, 2 deletions
diff --git a/migrations/20250819.php b/migrations/20250819.php
index b635201..3476081 100644
--- a/migrations/20250819.php
+++ b/migrations/20250819.php
@@ -54,7 +54,7 @@ Database::getInstance()->query(<<<SQL
"name" varchar(255) not null,
- "version" integer not null
+ "version" text not null
);
SQL);
@@ -96,7 +96,7 @@ SQL);
Database::getInstance()->query(<<<SQL
create table if not exists "filters" (
- "id" varchar(255) primary key,
+ "id" varchar(255) not null,
"account_data" jsonb,
"event_fields" jsonb,
"event_format" varchar(255),
@@ -105,6 +105,39 @@ Database::getInstance()->query(<<<SQL
"user_id" varchar(255) not null,
+ primary key (id, user_id),
foreign key (user_id) references users(id)
);
SQL);
+
+Database::getInstance()->query(<<<SQL
+ create table if not exists "device_keys" (
+ "supported_algorithms" json not null,
+ "keys" json not null,
+ "signatures" json not null,
+
+ "user_id" text not null,
+ "device_id" text not null,
+
+ foreign key (user_id, device_id) references devices(user_id, id)
+ );
+SQL);
+
+Database::getInstance()->query(<<<SQL
+ create table if not exists "one_time_keys" (
+ "id" text not null,
+
+ "key" text not null,
+ "algorithm" text not null,
+
+ "signature_key" text not null,
+ "signature_algorithm" text not null,
+
+ "is_fallback" bool not null default false,
+
+ "user_id" text not null,
+ "device_id" text not null,
+
+ foreign key (user_id, device_id) references devices(user_id, id)
+ );
+SQL);