use postgresql
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
-- This file should undo anything in `up.sql`
|
||||
DROP TABLE posts
|
||||
21
migrations/sqlite3/2022-03-11-065048_create_posts/up.sql
Normal file
21
migrations/sqlite3/2022-03-11-065048_create_posts/up.sql
Normal file
@@ -0,0 +1,21 @@
|
||||
-- Your SQL goes here
|
||||
|
||||
CREATE TABLE posts (
|
||||
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
author_hash VARCHAR NOT NULL,
|
||||
content TEXT NOT NULL,
|
||||
cw VARCHAR NOT NULL DEFAULT '',
|
||||
author_title VARCHAR NOT NULL DEFAULT '',
|
||||
is_tmp BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
n_attentions INTEGER NOT NULL DEFAULT 0,
|
||||
n_comments INTEGER NOT NULL DEFAULT 0,
|
||||
create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
last_comment_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
is_deleted BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
is_reported BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
hot_score INTEGER NOT NULL DEFAULT 0,
|
||||
allow_search BOOLEAN NOT NULL DEFAULT FALSE
|
||||
);
|
||||
CREATE INDEX posts_last_comment_time_idx ON posts (`last_comment_time`);
|
||||
CREATE INDEX posts_hot_idx ON posts (`hot_score`)
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
-- This file should undo anything in `up.sql`
|
||||
DROP TABLE users
|
||||
9
migrations/sqlite3/2022-03-15-061041_create_users/up.sql
Normal file
9
migrations/sqlite3/2022-03-15-061041_create_users/up.sql
Normal file
@@ -0,0 +1,9 @@
|
||||
-- Your SQL goes here
|
||||
|
||||
CREATE TABLE users (
|
||||
id INTEGER NOT NULL PRIMARY KEY,
|
||||
name VARCHAR NOT NULL UNIQUE,
|
||||
token VARCHAR NOT NULL UNIQUE,
|
||||
is_admin BOOLEAN NOT NULL DEFAULT FALSE
|
||||
);
|
||||
CREATE INDEX users_toekn_idx ON users (`token`);
|
||||
@@ -0,0 +1,3 @@
|
||||
-- This file should undo anything in `up.sql`
|
||||
|
||||
DROP TABLE comments
|
||||
15
migrations/sqlite3/2022-03-15-104943_create_comments/up.sql
Normal file
15
migrations/sqlite3/2022-03-15-104943_create_comments/up.sql
Normal file
@@ -0,0 +1,15 @@
|
||||
-- Your SQL goes here
|
||||
|
||||
CREATE TABLE comments (
|
||||
id INTEGER NOT NULL PRIMARY KEY,
|
||||
author_hash VARCHAR NOT NULL,
|
||||
author_title VARCHAR(10) NOT NULL DEFAULT '',
|
||||
is_tmp BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
content TEXT NOT NULL,
|
||||
create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
is_deleted BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
post_id INTEGER NOT NULL,
|
||||
FOREIGN KEY(post_id) REFERENCES posts(id)
|
||||
);
|
||||
CREATE INDEX comments_postId_idx ON comments (`post_id`);
|
||||
|
||||
Reference in New Issue
Block a user