database
: Create storage tables
This commit is contained in:
parent
56f18f0f29
commit
9e0439b2a3
2 changed files with 42 additions and 0 deletions
|
@ -0,0 +1,4 @@
|
|||
DROP TABLE IF EXISTS users_passkey_authentication_state CASCADE;
|
||||
DROP TABLE IF EXISTS users_passkey_registration_state CASCADE;
|
||||
DROP TABLE IF EXISTS users_passkeys CASCADE;
|
||||
DROP TABLE IF EXISTS users CASCADE;
|
38
acrate_database/migrations/2025-02-15-104632_users/up.sql
Normal file
38
acrate_database/migrations/2025-02-15-104632_users/up.sql
Normal file
|
@ -0,0 +1,38 @@
|
|||
CREATE TABLE users (
|
||||
id UUID DEFAULT gen_random_uuid() NOT NULL,
|
||||
username VARCHAR NOT NULL,
|
||||
display_name VARCHAR NOT NULL,
|
||||
|
||||
CONSTRAINT unique_username UNIQUE (username),
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
CREATE TABLE users_passkeys (
|
||||
user_id UUID REFERENCES users (id) NOT NULL,
|
||||
id UUID NOT NULL,
|
||||
|
||||
passkey BYTEA NOT NULL,
|
||||
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
CREATE TABLE users_passkey_registration_state (
|
||||
user_id UUID REFERENCES users (id) NOT NULL,
|
||||
state BYTEA NOT NULL,
|
||||
|
||||
id UUID DEFAULT gen_random_uuid() NOT NULL,
|
||||
created TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
|
||||
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
CREATE TABLE users_passkey_authentication_state (
|
||||
user_id UUID REFERENCES users (id) NOT NULL,
|
||||
state BYTEA NOT NULL,
|
||||
|
||||
id UUID DEFAULT gen_random_uuid() NOT NULL,
|
||||
created TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
|
||||
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
Loading…
Add table
Reference in a new issue