Initial commit after extraction
This commit is contained in:
commit
80ba54e4ef
43 changed files with 3865 additions and 0 deletions
1
migrations/2018-07-17-173341_create_users/down.sql
Normal file
1
migrations/2018-07-17-173341_create_users/down.sql
Normal file
|
|
@ -0,0 +1 @@
|
|||
drop table users;
|
||||
21
migrations/2018-07-17-173341_create_users/up.sql
Normal file
21
migrations/2018-07-17-173341_create_users/up.sql
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
CREATE OR REPLACE FUNCTION update_timestamp() RETURNS TRIGGER AS $$
|
||||
BEGIN
|
||||
NEW.updated = now();
|
||||
RETURN NEW;
|
||||
END;
|
||||
$$ language 'plpgsql';
|
||||
|
||||
create table if not exists users (
|
||||
id serial primary key,
|
||||
name text,
|
||||
email text not null unique,
|
||||
password text not null,
|
||||
avatar text,
|
||||
is_verified bool not null default false,
|
||||
has_verified_email bool not null default false,
|
||||
created timestamp with time zone not null default now(),
|
||||
updated timestamp with time zone not null default now()
|
||||
);
|
||||
|
||||
CREATE TRIGGER user_updated BEFORE INSERT OR UPDATE ON users
|
||||
FOR EACH ROW EXECUTE PROCEDURE update_timestamp();
|
||||
Reference in a new issue