19 lines
615 B
SQL
19 lines
615 B
SQL
-- Migration: 0001_initial
|
|
-- Description: Create initial migration with user for f1tness app
|
|
|
|
-- Default user schema
|
|
-- TODO: (#ToLearn) Read about TIMESTAMP and CURRENT_TIMESTAMP
|
|
CREATE TABLE IF NOT EXISTS users (
|
|
id SERIAL PRIMARY KEY,
|
|
username VARCHAR(250) UNIQUE NOT NULL,
|
|
email VARCHAR(100) UNIQUE NOT NULL,
|
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
|
);
|
|
|
|
-- Schema for tracking applied migrations
|
|
CREATE TABLE IF NOT EXISTS schema_migrations (
|
|
version VARCHAR(50) PRIMARY KEY,
|
|
applied_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
|
);
|
|
|
|
INSERT INTO schema_migrations (version) VALUES ('0001_initial');
|