aboutsummaryrefslogtreecommitdiffhomepage
path: root/migrations/20241216_172853_add_instance_auth_secret.php
diff options
context:
space:
mode:
authorwinter2024-12-16 20:27:01 +0000
committerwinter2024-12-16 20:41:33 +0000
commit68c7e68b3f90fd980661774fdb2bb2d6140a34d0 (patch)
tree7993de39c7c637369bdbfb22e265319b43fcbf33 /migrations/20241216_172853_add_instance_auth_secret.php
parent2f4c1de3509141880df019ef1a6cc65981b3f6ea (diff)
implement the other side of auth (hopefully?)
also mostly untested for the same reason as last time
Diffstat (limited to 'migrations/20241216_172853_add_instance_auth_secret.php')
-rw-r--r--migrations/20241216_172853_add_instance_auth_secret.php12
1 files changed, 12 insertions, 0 deletions
diff --git a/migrations/20241216_172853_add_instance_auth_secret.php b/migrations/20241216_172853_add_instance_auth_secret.php
new file mode 100644
index 0000000..83438fe
--- /dev/null
+++ b/migrations/20241216_172853_add_instance_auth_secret.php
@@ -0,0 +1,12 @@
+<?php
+
+use \Digitigrade\Db\Migrator;
+
+Migrator::getInstance()->register(20241216_172853, function (PDO $db) {
+ // column for the secret used for dialback for inbound auth
+ // also making inbound auth column unique to prevent accidentally giving two instances the same token
+ $db->exec(<<<END
+ ALTER TABLE instance_auth ADD COLUMN secret text;
+ ALTER TABLE instance_auth ADD CONSTRAINT inbound_token_unq UNIQUE(inbound_token);
+ END);
+});