spring-boot-realworld-examp.../src/main/resources/db/migration/V1__create_tables.sql
Mohamed CHIBOUB 5e16ac0ee1
Adding not null to name attribute in the "tag" table
The creation of this table fails due to this typo!
2020-07-29 18:43:43 -04:00

50 lines
1.0 KiB
SQL

create table users (
id varchar(255) primary key,
username varchar(255) UNIQUE,
password varchar(255),
email varchar(255) UNIQUE,
bio text,
image varchar(511)
);
create table articles (
id varchar(255) primary key,
user_id varchar(255),
slug varchar(255) UNIQUE,
title varchar(255),
description text,
body text,
created_at TIMESTAMP NOT NULL,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);
create table article_favorites (
article_id varchar(255) not null,
user_id varchar(255) not null,
primary key(article_id, user_id)
);
create table follows (
user_id varchar(255) not null,
follow_id varchar(255) not null
);
create table tags (
id varchar(255) primary key,
name varchar(255) not null
);
create table article_tags (
article_id varchar(255) not null,
tag_id varchar(255) not null
);
create table comments (
id varchar(255) primary key,
body text,
article_id varchar(255),
user_id varchar(255),
created_at TIMESTAMP NOT NULL,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);