aboutsummaryrefslogtreecommitdiffhomepage
path: root/migrations/20241217_221952_create_interaction.php
blob: 6559b6c93a5effe1e99fd34e36898edd72d1deba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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);
});