Skip to content

Commit

Permalink
feat: add default to created_at and updated_at
Browse files Browse the repository at this point in the history
  • Loading branch information
mrgleam committed Aug 1, 2024
1 parent feb779e commit 89fd2ce
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions migrations/init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@ CREATE EXTENSION IF NOT EXISTS "uuid-ossp";

CREATE TYPE valid_status AS ENUM ('TODO', 'DOING', 'DONE');

CREATE TABLE tasks(
CREATE TABLE IF NOT EXISTS tasks(
id uuid DEFAULT uuid_generate_v4(),
content VARCHAR(50),
status valid_status,
created_at TIMESTAMP,
updated_at TIMESTAMP,
created_at TIMESTAMP DEFAULT NOW(),
updated_at TIMESTAMP DEFAULT NOW(),
deleted_at TIMESTAMP
);

CREATE TABLE users(
CREATE TABLE IF NOT EXISTS users(
id uuid DEFAULT uuid_generate_v4(),
email VARCHAR(255) UNIQUE NOT NULL,
password VARCHAR(255) NOT NULL,
is_verified BOOLEAN DEFAULT false,
created_at TIMESTAMP,
updated_at TIMESTAMP,
created_at TIMESTAMP DEFAULT NOW(),
updated_at TIMESTAMP DEFAULT NOW(),
deleted_at TIMESTAMP
);

0 comments on commit 89fd2ce

Please sign in to comment.