aboutsummaryrefslogtreecommitdiffhomepage
path: root/migrations/20250117_224217_create_storage_object.php
blob: a1a5cc0dfff6e99c820dee13b38efc6e45d2b0a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php

use \Digitigrade\Db\Migrator;

Migrator::getInstance()->register(20250117_224217, function (PDO $db) {
    // storage objects for uploaded files and whatever else needs storing
    // backend agnostic! that's cool i think
    // note: i'm using random strings for the primary key here because i don't
    // want them to be easily guessable. i think this is an okay tradeoff
    $db->exec(<<<END
    CREATE TABLE storage_object (
        oid text primary key,
        provider text not null,
        token text not null,
        filename text not null,
        mimetype text not null,
        created timestamp with time zone not null default current_timestamp,
        unique(provider, token)
    );
    END);
});