mirror of
https://github.com/penpot/penpot.git
synced 2025-12-11 22:14:05 +01:00
✨ Fix naming inconsistencies on migrations.
This commit is contained in:
@@ -6,10 +6,7 @@ CREATE TABLE profile (
|
||||
deleted_at timestamptz NULL,
|
||||
|
||||
fullname text NOT NULL DEFAULT '',
|
||||
|
||||
email text NOT NULL,
|
||||
pending_email text NULL,
|
||||
|
||||
photo text NOT NULL,
|
||||
password text NOT NULL,
|
||||
|
||||
@@ -35,6 +32,27 @@ VALUES ('00000000-0000-0000-0000-000000000000'::uuid,
|
||||
'!');
|
||||
|
||||
|
||||
--- NOTE: this table is deleted in the next migrations
|
||||
|
||||
CREATE TABLE profile_email (
|
||||
profile_id uuid NOT NULL REFERENCES profile(id) ON DELETE CASCADE,
|
||||
|
||||
created_at timestamptz NOT NULL DEFAULT clock_timestamp(),
|
||||
verified_at timestamptz NULL DEFAULT NULL,
|
||||
|
||||
email text NOT NULL,
|
||||
|
||||
is_main boolean NOT NULL DEFAULT false,
|
||||
is_verified boolean NOT NULL DEFAULT false
|
||||
);
|
||||
|
||||
CREATE INDEX profile_email__profile_id__idx
|
||||
ON profile_email (profile_id);
|
||||
|
||||
CREATE UNIQUE INDEX profile_email__email__idx
|
||||
ON profile_email (email);
|
||||
|
||||
|
||||
|
||||
CREATE TABLE team (
|
||||
id uuid PRIMARY KEY DEFAULT uuid_generate_v4(),
|
||||
@@ -104,6 +122,20 @@ BEFORE UPDATE ON profile_attr
|
||||
FOR EACH ROW EXECUTE PROCEDURE update_modified_at();
|
||||
|
||||
|
||||
--- NOTE: this table is removed in the following migrations
|
||||
|
||||
CREATE TABLE password_recovery_token (
|
||||
profile_id uuid NOT NULL REFERENCES profile(id) ON DELETE CASCADE,
|
||||
token text NOT NULL,
|
||||
|
||||
created_at timestamptz NOT NULL DEFAULT clock_timestamp(),
|
||||
used_at timestamptz NULL,
|
||||
|
||||
PRIMARY KEY (profile_id, token)
|
||||
);
|
||||
|
||||
|
||||
|
||||
CREATE TABLE session (
|
||||
id uuid PRIMARY KEY DEFAULT uuid_generate_v4(),
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
--- Delete previously token related tables
|
||||
|
||||
DROP TABLE password_recovery_token;
|
||||
|
||||
--- Create a new generic table for store tokens.
|
||||
|
||||
CREATE TABLE generic_token (
|
||||
token text PRIMARY KEY,
|
||||
created_at timestamptz NOT NULL DEFAULT clock_timestamp(),
|
||||
valid_until timestamptz NOT NULL,
|
||||
content bytea NOT NULL
|
||||
);
|
||||
|
||||
COMMENT ON TABLE generic_token IS 'Table for generic tokens storage';
|
||||
@@ -1,6 +0,0 @@
|
||||
CREATE TABLE generic_token (
|
||||
token text PRIMARY KEY,
|
||||
created_at timestamptz NOT NULL DEFAULT clock_timestamp(),
|
||||
valid_until timestamptz NOT NULL,
|
||||
content bytea NOT NULL
|
||||
);
|
||||
@@ -0,0 +1,3 @@
|
||||
DROP INDEX profile_email__profile_id__idx;
|
||||
DROP INDEX profile_email__email__idx;
|
||||
DROP TABLE profile_email;
|
||||
Reference in New Issue
Block a user