aboutsummaryrefslogtreecommitdiffhomepage
path: root/migrations/20241213_164314_create_instance.php
blob: fdd2f226ee8fd282269aefed1c8346b55d0d2982 (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
28
29
30
31
32
33
<?php

use \Digitigrade\Db\Migrator;

Migrator::getInstance()->register(20241213_164314, function (PDO $db) {
    // table of instance information
    // also decided to move (un)subscribe endpoints to be global instead of actor-specific
    // hope to yourself that there wasn't any data in those because im too lazy to move it properly lol
    $db->beginTransaction();
    $db->exec(<<<END
    CREATE TABLE instance (
        id bigserial primary key,
        domain text not null unique,
        name text not null,
        description text,
        icon text,
        software_name text not null,
        software_description text,
        software_version text,
        software_homepage text
    );
    CREATE TABLE instance_endpoints (
        instance_id bigint not null references instance,
        auth text,
        report text,
        subscribe text,
        unsubscribe text
    );
    ALTER TABLE actor_endpoints DROP COLUMN subscribe;
    ALTER TABLE actor_endpoints DROP COLUMN unsubscribe;
    END);
    $db->commit();
});