kube-exam/data/db/create.sql

22 lines
508 B
SQL

CREATE DATABASE api_prod;
CREATE DATABASE api_dev;
CREATE DATABASE api_test;
\c api_prod;
CREATE TABLE IF NOT EXISTS users (
id SERIAL NOT NULL,
username VARCHAR(128) NOT NULL,
email VARCHAR(128) NOT NULL,
password VARCHAR(255) NOT NULL,
active BOOLEAN NOT NULL,
created_date TIMESTAMP WITHOUT TIME ZONE NOT NULL,
PRIMARY KEY (id)
)
CREATE TABLE IF NOT EXISTS zones (
id SERIAL PRIMARY KEY,
name VARCHAR(128) NOT NULL,
create_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL
);