aboutsummaryrefslogtreecommitdiffhomepage
path: root/migrations
diff options
context:
space:
mode:
Diffstat (limited to 'migrations')
-rw-r--r--migrations/20241217_221952_create_interaction.php27
1 files changed, 27 insertions, 0 deletions
diff --git a/migrations/20241217_221952_create_interaction.php b/migrations/20241217_221952_create_interaction.php
new file mode 100644
index 0000000..6559b6c
--- /dev/null
+++ b/migrations/20241217_221952_create_interaction.php
@@ -0,0 +1,27 @@
+<?php
+
+use \Digitigrade\Db\Migrator;
+
+Migrator::getInstance()->register(20241217_221952, function (PDO $db) {
+ // interaction table!
+ $db->exec(<<<END
+ CREATE TYPE interaction_kind AS ENUM (
+ 'like', 'dislike', 'reshare'
+ );
+ CREATE TABLE interaction (
+ id bigserial primary key,
+ uri text unique not null,
+ created timestamp with time zone not null,
+ modified timestamp with time zone,
+ author bigint not null references actor,
+ kind interaction_kind not null,
+ target bigint not null references note
+ );
+ CREATE TABLE interaction_extension (
+ interaction_id bigint not null references interaction,
+ uri text not null,
+ data jsonb not null,
+ unique(interaction_id, uri)
+ );
+ END);
+});