diff options
| author | winter | 2024-12-31 22:30:16 +0000 |
|---|---|---|
| committer | winter | 2024-12-31 22:31:26 +0000 |
| commit | 4cd7017da9a37e5b9f38c3f50dd1c904ea41cbcb (patch) | |
| tree | d77f1fd223dae44f40b22c9810aeba238733310d /migrations | |
| parent | 982e6213622bcb78a40d17f54cda27225a1d84b3 (diff) | |
implement user accounts and login
Diffstat (limited to 'migrations')
| -rw-r--r-- | migrations/20241231_165056_create_user_account.php | 16 | ||||
| -rw-r--r-- | migrations/20241231_170929_create_session.php | 13 |
2 files changed, 29 insertions, 0 deletions
diff --git a/migrations/20241231_165056_create_user_account.php b/migrations/20241231_165056_create_user_account.php new file mode 100644 index 0000000..3a30547 --- /dev/null +++ b/migrations/20241231_165056_create_user_account.php @@ -0,0 +1,16 @@ +<?php + +use \Digitigrade\Db\Migrator; + +Migrator::getInstance()->register(20241231_165056, function (PDO $db) { + // local user accounts + $db->exec(<<<END + CREATE TABLE user_account ( + id bigserial primary key, + email text not null unique, + password_hash text not null, + actor bigint unique references actor on delete restrict, + banned boolean not null default false + ); + END); +}); diff --git a/migrations/20241231_170929_create_session.php b/migrations/20241231_170929_create_session.php new file mode 100644 index 0000000..e24a78c --- /dev/null +++ b/migrations/20241231_170929_create_session.php @@ -0,0 +1,13 @@ +<?php + +use \Digitigrade\Db\Migrator; + +Migrator::getInstance()->register(20241231_170929, function (PDO $db) { + // login sessions + $db->exec(<<<END + CREATE TABLE session ( + token text primary key, + user_account bigint not null references user_account + ); + END); +}); |
