-
Notifications
You must be signed in to change notification settings - Fork 0
PostgreSQL 迁移
duangsuse edited this page May 31, 2018
·
1 revision
CREATE TABLE users(
id SmallSerial PRIMARY KEY,
simple_name VarChar NOT Null,
avatar_url VarChar,
user_name VarChar NOT Null,
alias VarChar,
github VarChar,
bio VarChar NOT Null DEFAULT '',
dev_bio VarChar,
created_at TimeStamp NOT Null DEFAULT now(),
online_at TimeStamp NOT Null DEFAULT now(),
followers_num SmallInt NOT Null DEFAULT 0,
enabled Boolean NOT Null DEFAULT true
)
DROP TABLE users
CREATE TABLE categories(
id SmallSerial PRIMARY KEY,
category_name VarChar NOT Null,
parent_category SmallInt
)
DROP TABLE categories
CREATE TABLE apps(
id SmallSerial PRIMARY KEY,
author_user SmallInt NOT Null,
category SmallInt NOT Null,
package_name VarChar,
app_name VarChar NOT Null,
alias VarChar,
icon_url VarChar,
app_description VarChar NOT Null DEFAULT '',
visualizer VarChar,
button_text VarChar,
special VarChar,
previews VarChar,
app_permissions VarChar,
size Integer NOT Null DEFAULT 0,
created_at TimeStamp NOT Null DEFAULT now(),
updated_at TimeStamp NOT Null DEFAULT now(),
stars_num SmallInt NOT Null DEFAULT 0,
comments_num Integer NOT Null DEFAULT 0
)
DROP TABLE apps
CREATE TABLE comments(
id Serial PRIMARY KEY,
author_user SmallInt NOT Null,
app SmallInt NOT Null,
reply_comment Integer,
content VarChar NOT Null,
stars_num SmallInt NOT Null DEFAULT 0,
replies_num Integer NOT Null DEFAULT 0,
created_at TimeStamp NOT Null DEFAULT now()
updated_at TimeStamp
)
DROP TABLE comments
CREATE TABLE follow(
user SmallInt NOT Null,
followed_user SmallInt NOT Null
)
DROP TABLE follow
CREATE TABLE _security(
user SmallInt PRIMARY KEY,
metapass VarChar NOT Null,
passhash VarChar
)
DROP TABLE _security
CREATE TABLE updates(
app SmallInt NOT Null,
version_name VarChar NOT Null,
reversion SmallInt NOT Null,
install_url VarChar NOT Null,
updates VarChar NOT Null,
api_min SmallInt,
api_target SmallInt
)
DROP TABLE updates
CREATE TABLE stars(
user SmallInt NOT Null,
app SmallInt NOT Null
)
DROP TABLE stars
CREATE TABLE comment_stars(
user SmallInt NOT Null,
comment Integer NOT Null
)
DROP TABLE comment_stars
CREATE TABLE timelines(
user SmallInt NOT Null,
created_at TimeStamp NOT Null DEFAULT now(),
line_type SmallInt NOT Null,
line_data Integer NOT Null
)
DROP TABLE timelines
CREATE TABLE notifications(
user SmallInt NOT Null,
created_at TimeStamp NOT Null DEFAULT now(),
notification_type SmallInt NOT Null,
notification_data Integer NOT Null,
enabled Boolean NOT Null DEFAULT false
)
DROP TABLE notifications