aboutsummaryrefslogtreecommitdiffhomepage
path: root/migrations/20250117_224217_create_storage_object.php
diff options
context:
space:
mode:
authorwinter2025-01-18 00:22:36 +0000
committerwinter2025-01-18 00:22:36 +0000
commitba61c6435b668375a411716f3a35447aa38b03a4 (patch)
treec305f2a994888a773d2b4a781176b8dffbe90576 /migrations/20250117_224217_create_storage_object.php
parent141f11ba980fe019c12f0a8fa456f520ec48e522 (diff)
implement object storage
Diffstat (limited to 'migrations/20250117_224217_create_storage_object.php')
-rw-r--r--migrations/20250117_224217_create_storage_object.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/migrations/20250117_224217_create_storage_object.php b/migrations/20250117_224217_create_storage_object.php
new file mode 100644
index 0000000..a1a5cc0
--- /dev/null
+++ b/migrations/20250117_224217_create_storage_object.php
@@ -0,0 +1,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);
+});