-
Notifications
You must be signed in to change notification settings - Fork 580
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #229 from alimy/pr-pg-ddl
add PostgreSQL DDL file
- Loading branch information
Showing
38 changed files
with
1,379 additions
and
260 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
2 changes: 0 additions & 2 deletions
2
...ration/mysql/002_post_visibility.down.sql → ...ation/mysql/0002_post_visibility.down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
ALTER TABLE `p_post` DROP COLUMN `visibility`; | ||
|
||
DROP INDEX `idx_visibility` ON `p_post`; |
1 change: 0 additions & 1 deletion
1
...igration/mysql/002_post_visibility.up.sql → ...gration/mysql/0002_post_visibility.up.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
ALTER TABLE `p_post` ADD COLUMN `visibility` tinyint unsigned NOT NULL DEFAULT '0' COMMENT '可见性 0公开 1私密 2好友可见'; | ||
|
||
CREATE INDEX `idx_visibility` ON `p_post` ( `visibility` ) USING BTREE; |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
ALTER TABLE `p_attachment` | ||
RENAME KEY `idx_attachment_user_id` TO `idx_user`; | ||
|
||
ALTER TABLE `p_captcha` | ||
RENAME KEY `idx_captcha_phone` TO `idx_phone`, | ||
RENAME KEY `idx_captcha_expired_on` TO `idx_expired_on`, | ||
RENAME KEY `idx_captcha_use_times` TO `idx_use_times`; | ||
|
||
ALTER TABLE `p_comment` | ||
RENAME KEY `idx_comment_post_id` TO `idx_post`, | ||
RENAME KEY `idx_comment_user_id` TO `idx_user`; | ||
|
||
ALTER TABLE `p_comment_content` | ||
RENAME KEY `idx_comment_content_comment_id` TO `idx_reply`, | ||
RENAME KEY `idx_comment_content_user_id` TO `idx_user`, | ||
RENAME KEY `idx_comment_content_type` TO `idx_type`, | ||
RENAME KEY `idx_comment_content_sort` TO `idx_sort`; | ||
|
||
ALTER TABLE `p_comment_reply` | ||
RENAME KEY `idx_comment_reply_comment_id` TO `idx_comment`; | ||
|
||
ALTER TABLE `p_message` | ||
RENAME KEY `idx_message_receiver_user_id` TO `idx_receiver`, | ||
RENAME KEY `idx_message_is_read` TO `idx_is_read`, | ||
RENAME KEY `idx_message_type` TO `idx_type`; | ||
|
||
ALTER TABLE `p_post` | ||
RENAME KEY `idx_post_user_id` TO `idx_user`, | ||
RENAME KEY `idx_post_visibility` TO `idx_visibility`; | ||
|
||
ALTER TABLE `p_post_attachment_bill` | ||
RENAME KEY `idx_post_attachment_bill_post_id` TO `idx_post`, | ||
RENAME KEY `idx_post_attachment_bill_user_id` TO `idx_user`; | ||
|
||
ALTER TABLE `p_post_collection` | ||
RENAME KEY `idx_post_collection_post_id` TO `idx_post`, | ||
RENAME KEY `idx_post_collection_user_id` TO `idx_user`; | ||
|
||
ALTER TABLE `p_post_content` | ||
RENAME KEY `idx_post_content_post_id` TO `idx_post`, | ||
RENAME KEY `idx_post_content_user_id` TO `idx_user`; | ||
|
||
ALTER TABLE `p_post_star` | ||
RENAME KEY `idx_post_star_post_id` TO `idx_post`, | ||
RENAME KEY `idx_post_star_user_id` TO `idx_user`; | ||
|
||
ALTER TABLE `p_tag` | ||
RENAME KEY `idx_tag_user_id` TO `idx_user`, | ||
RENAME KEY `idx_tag_quote_num` TO `idx_num`; | ||
|
||
ALTER TABLE `p_user` | ||
RENAME KEY `idx_user_username` TO `idx_username`, | ||
RENAME KEY `idx_user_phone` TO `idx_phone`; | ||
|
||
ALTER TABLE `p_wallet_recharge` | ||
RENAME KEY `idx_wallet_recharge_user_id` TO `idx_user`, | ||
RENAME KEY `idx_wallet_recharge_trade_no` TO `idx_trade_no`, | ||
RENAME KEY `idx_wallet_recharge_trade_status` TO `idx_trade_status`; | ||
|
||
ALTER TABLE `p_wallet_statement` | ||
RENAME KEY `idx_wallet_statement_user_id` TO `idx_user`; | ||
|
||
ALTER TABLE `p_contact` | ||
RENAME KEY `idx_contact_user_friend` TO `idx_user_friend_id`, | ||
RENAME KEY `idx_contact_user_friend_status` TO `idx_user_friend_status`; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
ALTER TABLE `p_attachment` | ||
RENAME KEY `idx_user` TO `idx_attachment_user_id`; | ||
|
||
ALTER TABLE `p_captcha` | ||
RENAME KEY `idx_phone` TO `idx_captcha_phone`, | ||
RENAME KEY `idx_expired_on` TO `idx_captcha_expired_on`, | ||
RENAME KEY `idx_use_times` TO `idx_captcha_use_times`; | ||
|
||
ALTER TABLE `p_comment` | ||
RENAME KEY `idx_post` TO `idx_comment_post_id`, | ||
RENAME KEY `idx_user` TO `idx_comment_user_id`; | ||
|
||
ALTER TABLE `p_comment_content` | ||
RENAME KEY `idx_reply` TO `idx_comment_content_comment_id`, | ||
RENAME KEY `idx_user` TO `idx_comment_content_user_id`, | ||
RENAME KEY `idx_type` TO `idx_comment_content_type`, | ||
RENAME KEY `idx_sort` TO `idx_comment_content_sort`; | ||
|
||
ALTER TABLE `p_comment_reply` | ||
RENAME KEY `idx_comment` TO `idx_comment_reply_comment_id`; | ||
|
||
ALTER TABLE `p_message` | ||
RENAME KEY `idx_receiver` TO `idx_message_receiver_user_id`, | ||
RENAME KEY `idx_is_read` TO `idx_message_is_read`, | ||
RENAME KEY `idx_type` TO `idx_message_type`; | ||
|
||
ALTER TABLE `p_post` | ||
RENAME KEY `idx_user` TO `idx_post_user_id`, | ||
RENAME KEY `idx_visibility` TO `idx_post_visibility`; | ||
|
||
ALTER TABLE `p_post_attachment_bill` | ||
RENAME KEY `idx_post` TO `idx_post_attachment_bill_post_id`, | ||
RENAME KEY `idx_user` TO `idx_post_attachment_bill_user_id`; | ||
|
||
ALTER TABLE `p_post_collection` | ||
RENAME KEY `idx_post` TO `idx_post_collection_post_id`, | ||
RENAME KEY `idx_user` TO `idx_post_collection_user_id`; | ||
|
||
ALTER TABLE `p_post_content` | ||
RENAME KEY `idx_post` TO `idx_post_content_post_id`, | ||
RENAME KEY `idx_user` TO `idx_post_content_user_id`; | ||
|
||
ALTER TABLE `p_post_star` | ||
RENAME KEY `idx_post` TO `idx_post_star_post_id`, | ||
RENAME KEY `idx_user` TO `idx_post_star_user_id`; | ||
|
||
ALTER TABLE `p_tag` | ||
RENAME KEY `idx_user` TO `idx_tag_user_id`, | ||
RENAME KEY `idx_num` TO `idx_tag_quote_num`; | ||
|
||
ALTER TABLE `p_user` | ||
RENAME KEY `idx_username` TO `idx_user_username`, | ||
RENAME KEY `idx_phone` TO `idx_user_phone`; | ||
|
||
ALTER TABLE `p_wallet_recharge` | ||
RENAME KEY `idx_user` TO `idx_wallet_recharge_user_id`, | ||
RENAME KEY `idx_trade_no` TO `idx_wallet_recharge_trade_no`, | ||
RENAME KEY `idx_trade_status` TO `idx_wallet_recharge_trade_status`; | ||
|
||
ALTER TABLE `p_wallet_statement` | ||
RENAME KEY `idx_user` To `idx_wallet_statement_user_id`; | ||
|
||
ALTER TABLE `p_contact` | ||
RENAME KEY `idx_user_friend_id` TO `idx_contact_user_friend`, | ||
RENAME KEY `idx_user_friend_status` TO `idx_contact_user_friend_status`; |
16 changes: 16 additions & 0 deletions
16
scripts/migration/postgres/0001_initialize_schema.down.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
DROP TABLE IF EXISTS p_attachment; | ||
DROP TABLE IF EXISTS p_captcha; | ||
DROP TABLE IF EXISTS p_comment; | ||
DROP TABLE IF EXISTS p_comment_content; | ||
DROP TABLE IF EXISTS p_comment_reply; | ||
DROP TABLE IF EXISTS p_message; | ||
DROP TABLE IF EXISTS p_post; | ||
DROP TABLE IF EXISTS p_post_attachment_bill; | ||
DROP TABLE IF EXISTS p_post_collection; | ||
DROP TABLE IF EXISTS p_post_content; | ||
DROP TABLE IF EXISTS p_post_star; | ||
DROP TABLE IF EXISTS p_tag; | ||
DROP TABLE IF EXISTS p_user; | ||
DROP TABLE IF EXISTS p_wallet_recharge; | ||
DROP TABLE IF EXISTS p_wallet_statement; | ||
DROP SEQUENCE IF EXISTS post_id_seq; |
Oops, something went wrong.