mirror of
https://github.com/penpot/penpot.git
synced 2025-08-03 18:08:21 +02:00
🎉 Add the ability to create demo user on demand.
This commit is contained in:
parent
b0ca6493e3
commit
e42ccf932e
12 changed files with 285 additions and 199 deletions
|
@ -3,7 +3,7 @@ CREATE TABLE users (
|
|||
|
||||
created_at timestamptz NOT NULL DEFAULT clock_timestamp(),
|
||||
modified_at timestamptz NOT NULL DEFAULT clock_timestamp(),
|
||||
deleted_at timestamptz DEFAULT NULL,
|
||||
deleted_at timestamptz NULL,
|
||||
|
||||
fullname text NOT NULL DEFAULT '',
|
||||
username text NOT NULL,
|
||||
|
@ -11,7 +11,8 @@ CREATE TABLE users (
|
|||
photo text NOT NULL,
|
||||
password text NOT NULL,
|
||||
|
||||
metadata bytea NULL DEFAULT NULL
|
||||
lang text NULL,
|
||||
is_demo boolean NOT NULL DEFAULT false
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS user_attrs (
|
||||
|
@ -31,7 +32,7 @@ CREATE TABLE IF NOT EXISTS tokens (
|
|||
token text NOT NULL,
|
||||
|
||||
created_at timestamptz NOT NULL DEFAULT clock_timestamp(),
|
||||
used_at timestamptz DEFAULT NULL,
|
||||
used_at timestamptz NULL,
|
||||
|
||||
PRIMARY KEY (token, user_id)
|
||||
);
|
||||
|
@ -43,27 +44,31 @@ CREATE TABLE IF NOT EXISTS sessions (
|
|||
modified_at timestamptz NOT NULL DEFAULT clock_timestamp(),
|
||||
|
||||
user_id uuid REFERENCES users(id) ON DELETE CASCADE,
|
||||
user_agent TEXT NULL
|
||||
user_agent text NULL
|
||||
);
|
||||
|
||||
-- Insert a placeholder system user.
|
||||
|
||||
INSERT INTO users (id, fullname, username, email, photo, password, metadata)
|
||||
INSERT INTO users (id, fullname, username, email, photo, password)
|
||||
VALUES ('00000000-0000-0000-0000-000000000000'::uuid,
|
||||
'System User',
|
||||
'00000000-0000-0000-0000-000000000000',
|
||||
'system@uxbox.io',
|
||||
'',
|
||||
'!',
|
||||
'{}');
|
||||
'!');
|
||||
|
||||
CREATE UNIQUE INDEX users__username__idx
|
||||
ON users (username)
|
||||
WHERE deleted_at is null;
|
||||
WHERE deleted_at IS null;
|
||||
|
||||
CREATE UNIQUE INDEX users__email__idx
|
||||
ON users (email)
|
||||
WHERE deleted_at is null;
|
||||
WHERE deleted_at IS null;
|
||||
|
||||
CREATE INDEX users__is_demo
|
||||
ON users(is_demo)
|
||||
WHERE deleted_at IS null
|
||||
AND is_demo IS true;
|
||||
|
||||
CREATE TRIGGER users__modified_at__tgr
|
||||
BEFORE UPDATE ON users
|
||||
|
|
|
@ -8,8 +8,7 @@ CREATE TABLE IF NOT EXISTS projects (
|
|||
modified_at timestamptz NOT NULL DEFAULT clock_timestamp(),
|
||||
deleted_at timestamptz DEFAULT NULL,
|
||||
|
||||
name text NOT NULL,
|
||||
metadata bytea NULL DEFAULT NULL
|
||||
name text NOT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS project_users (
|
||||
|
@ -33,9 +32,7 @@ CREATE TABLE IF NOT EXISTS project_files (
|
|||
|
||||
created_at timestamptz NOT NULL DEFAULT clock_timestamp(),
|
||||
modified_at timestamptz NOT NULL DEFAULT clock_timestamp(),
|
||||
deleted_at timestamptz DEFAULT NULL,
|
||||
|
||||
metadata bytea NULL DEFAULT NULL
|
||||
deleted_at timestamptz DEFAULT NULL
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS project_file_users (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue