10 lines
414 B
MySQL
10 lines
414 B
MySQL
|
CREATE TABLE IF NOT EXISTS posts (
|
||
|
id SERIAL PRIMARY KEY,
|
||
|
user_id SERIAL NOT NULL,
|
||
|
content TEXT NOT NULL,
|
||
|
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||
|
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||
|
FOREIGN KEY (user_id) REFERENCES users (id)
|
||
|
);
|
||
|
create index IF NOT EXISTS posts_user_id_index on posts (user_id);
|
||
|
create index IF NOT EXISTS posts_id_index on posts (id);
|