Skip to content

Commit

Permalink
update users sql
Browse files Browse the repository at this point in the history
  • Loading branch information
caiofsr committed Oct 3, 2024
1 parent 07dcfe9 commit fd3f4bb
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions internal/database/migrations/20240922224814_users.sql
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
-- +goose Up
-- +goose StatementBegin
CREATE TABLE IF NOT EXISTS users (
CREATE TABLE users (
id SERIAL PRIMARY KEY,
serial VARCHAR(26) NOT NULL UNIQUE,
name VARCHAR(255) NOT NULL,
email VARCHAR(255) NOT NULL UNIQUE,
surname VARCHAR(255) NOT NULL,
email VARCHAR(320) NOT NULL UNIQUE,
password VARCHAR(255) NOT NULL,
terms_and_privacy_at TIMESTAMPTZ,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW() CONSTRAINT email_format CHECK (
email ~ '^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Z|a-z]{2,}$'
)
);

CREATE INDEX idx_users_email ON users (email);
CREATE INDEX idx_users_serial ON users (serial);
-- +goose StatementEnd

-- +goose Down
Expand Down

0 comments on commit fd3f4bb

Please sign in to comment.