aboutsummaryrefslogtreecommitdiffhomepage
path: root/migrations
diff options
context:
space:
mode:
authorwinter2024-12-17 23:05:43 +0000
committerwinter2024-12-17 23:05:43 +0000
commit6f844ff40d936fb6591c2469dd9ff922bc4e575f (patch)
tree007dc0372c2c999bdcf6ea1ba80f6eb93a161a7f /migrations
parent801778a295df2b026391483faa390cf87e68b1ad (diff)
implement interactions
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);
+});