Uni-app actual combat imitating WeChat app development "NetEase Cloud Classroom"

Uni-app actual combat imitating WeChat app development "NetEase Cloud Classroom"
download: Uni-app actual combat imitating WeChat app development "NetEase Cloud Classroom"

-- phpMyAdmin SQL Dump
-- version 4.4.15.10
-- https://www.phpmyadmin.net

- Host: 127.0.0.1:3306
- Generation Time: 2020-03-10 19:16:40
- Server version: 5.7.27
- PHP Version: 5.4.45

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";

/!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT /;
/!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS /;
/!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION /;
/!40101 SET NAMES utf8mb4 /;

--
-- Database: egg-wechat4


-
- Table structureapply

CREATE TABLE IF NOT EXISTS apply (
id int(20) unsigned NOT NULL,
user_id int(20) unsigned NOT NULL COMMENT '申请人id',
friend_id int(20) unsigned NOT NULL COMMENT '好友id',
nickname varchar(30) NOT NULL DEFAULT '' COMMENT '备注',
lookme int(1) NOT NULL DEFAULT '1' COMMENT '看我',
lookhim int(1) NOT NULL DEFAULT '1' COMMENT '看他',
status enum('pending','refuse','agree','ignore') NOT NULL DEFAULT 'pending' COMMENT '申请状态',
created_at datetime DEFAULT NULL,
updated_at datetime DEFAULT NULL
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;

-
- Dump the data in the tableapply

INSERT INTO apply (id, user_id, friend_id, nickname, lookme, lookhim, status, created_at, updated_at) VALUES
(1, 2, 1, 'ceshi1', 1, 1, 'agree', '2020-03-02 19:47:16', '2020-03-02 20:08:31'),
(2, 3, 1, 'ceshi1', 1, 1, 'agree', '2020-03-02 19:47:36', '2020-03-02 21:49:19'),
(3, 1, 2, 'ceshi2', 1, 1, 'agree', '2020-03-09 23:06:54', '2020-03-09 23:07:09');


-
- Table structurefava

CREATE TABLE IF NOT EXISTS fava (
id int(20) unsigned NOT NULL,
data text NOT NULL COMMENT '内容',
type enum('emoticon','text','image','video','audio','card') NOT NULL DEFAULT 'text' COMMENT '类型',
user_id int(20) unsigned NOT NULL COMMENT '用户id',
created_at datetime DEFAULT NULL,
updated_at datetime DEFAULT NULL
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8;

-
- Dump the data in the tablefava

INSERT INTO fava (id, data, type, user_id, created_at, updated_at) VALUES
(2, '123', 'text', 1, '2020-03-09 21:44:45', '2020-03-09 21:44:45'),
(3, 'blob:http://127.0.0.1:8080/5199d3d6-3091-4709-852c-bf8032dc9bd6', 'image', 1, '2020-03-09 21:45:34', '2020-03-09 21:45:34'),
(4, 'blob:http://127.0.0.1:8080/893a8722-0f1a-47bd-84c9-895762c32b5e', 'video', 1, '2020-03-09 21:45:39', '2020-03-09 21:45:39'),
(5, 'http://tangzhe123-com.oss-cn-shenzhen.aliyuncs.com/egg-oss-demo/fuunxs858c00000.mp4', 'video', 2, '2020-03-09 21:46:16', '2020-03-09 21:46:16'),
(6, 'http://tangzhe123-com.oss-cn-shenzhen.aliyuncs.com/egg-oss-demo/cxsqr3xsqu80000.jpg', 'image', 2, '2020-03-09 21:46:20', '2020-03-09 21:46:20'),
(7, '来啦', 'text', 1, '2020-03-09 21:51:20', '2020-03-09 21:51:20'),
(8, 'hahah ', 'text', 1, '2020-03-09 21:51:26', '2020-03-09 21:51:26'),
(9, '123', 'text', 1, '2020-03-09 21:51:29', '2020-03-09 21:51:29'),
(10, 'hahah ', 'text', 1, '2020-03-09 21:51:46', '2020-03-09 21:51:46'),
(12, '/static/images/emoticon/5497/0.gif', 'emoticon', 1, '2020-03-09 21:52:10', '2020-03-09 21:52:10'),
(13, '123', 'text', 1, '2020-03-09 21:52:14', '2020-03-09 21:52:14');


-
- Table structurefriend

CREATE TABLE IF NOT EXISTS friend(
idint(20) unsigned NOT NULL,
user_idint(20) unsigned NOT NULL COMMENT'user id',
friend_idint(20) unsigned NOT NULL COMMENT'friend id',
nicknamevarchar(30) NOT NULL DEFAULT'' COMMENT 'Remarks',
lookmeint(1) NOT NULL DEFAULT '1' COMMENT'Look at me',
lookhimint(1) NOT NULL DEFAULT '1' COMMENT'Look at him',
starint(1) NOT NULL DEFAULT '0' COMMENT'Is it Star friends: 0 No 1 Yes',
isblackint(1) NOT NULL DEFAULT '0' COMMENT'Whether to join the blacklist: 0 No 1 Yes',
created_atdatetime DEFAULT NULL,
updated_atdatetime DEFAULT NULL
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET= utf8;

-
- Dump the data in the tablefriend

INSERT INTO friend (id, user_id, friend_id, nickname, lookme, lookhim, star, isblack, created_at, updated_at) VALUES
(11, 3, 1, 'ceshi1', 1, 1, 0, 0, '2020-03-02 21:49:19', '2020-03-02 21:49:19'),
(12, 1, 3, 'ceshi3', 0, 1, 1, 0, '2020-03-02 21:49:19', '2020-03-10 03:21:46'),
(13, 1, 2, 'ceshi2', 1, 1, 0, 0, '2020-03-09 23:07:09', '2020-03-09 23:07:09'),
(14, 2, 1, '', 1, 1, 0, 0, '2020-03-09 23:07:09', '2020-03-09 23:07:09');


-
- Table structurefriend_tag

CREATE TABLE IF NOT EXISTS friend_tag (
id int(20) unsigned NOT NULL,
friend_id int(20) unsigned NOT NULL COMMENT '好友id',
tag_id int(20) unsigned NOT NULL COMMENT '标签id',
created_at datetime DEFAULT NULL,
updated_at datetime DEFAULT NULL
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;

-
- Dump the data in the tablefriend_tag

INSERT INTO friend_tag (id, friend_id, tag_id, created_at, updated_at) VALUES
(1, 12, 1, '2020-03-09 18:45:07', '2020-03-09 18:45:07'),
(3, 12, 3, '2020-03-09 18:45:07', '2020-03-09 18:45:07'),
(4, 13, 2, '2020-03-10 19:10:00', '2020-03-10 19:10:00');


-
- Table structuregroup

CREATE TABLE IF NOT EXISTS group (
id int(20) unsigned NOT NULL,
name varchar(30) NOT NULL DEFAULT '' COMMENT '群组名称',
avatar varchar(200) DEFAULT '',
user_id int(20) unsigned NOT NULL COMMENT '群主id',
remark text COMMENT '群公告',
invite_confirm int(1) NOT NULL DEFAULT '1' COMMENT '邀请确认',
status int(1) NOT NULL DEFAULT '1' COMMENT '状态',
created_at datetime DEFAULT NULL,
updated_at datetime DEFAULT NULL
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;

-
- Dump the data in the tablegroup

INTO INSERT group( id, name, avatar, user_id, remark, invite_confirm, status, created_at, updated_at) VALUES
(4, 'Happy group 1', '', 2, 'we can directly through the command mysql table built directly, but this is not a very cooperative multiplayer Friendly development model. In the evolution of the project, it is possible to make changes to the database data structure in each iteration. How to track the data changes in each iteration', 1, 1, '2020-03-03 00:27:24 ', '2020-03-06 17:14:13');


-
- Table structuregroup_user

CREATE TABLE IF NOT EXISTS group_user (
id int(20) unsigned NOT NULL,
user_id int(20) unsigned NOT NULL COMMENT '用户id',
group_id int(20) unsigned NOT NULL COMMENT '群组id',
nickname varchar(30) NOT NULL DEFAULT '' COMMENT '在群里的昵称',
created_at datetime DEFAULT NULL,
updated_at datetime DEFAULT NULL
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8;

-
- Dump the data in the tablegroup_user

INSERT INTO group_user (id, user_id, group_id, nickname, created_at, updated_at) VALUES
(8, 2, 4, '', '2020-03-03 00:27:25', '2020-03-03 00:27:25'),
(13, 3, 4, '', '2020-03-03 00:27:25', '2020-03-03 00:27:25'),
(14, 4, 4, '', '2020-03-03 00:27:25', '2020-03-03 00:27:25'),
(15, 1, 4, '', '2020-03-03 00:27:25', '2020-03-03 00:27:25');


-
- Table structuremoment

CREATE TABLE IF NOT EXISTS moment(
idint(20) unsigned NOT NULL,
contenttext NOT NULL COMMENT'Friends Moments Content',
imagetext NOT NULL COMMENT'Friends Moments Picture',
videovarchar(255) NOT NULL DEFAULT'' COMMENT'Friends Moments Video',
locationvarchar(255) NOT NULL DEFAULT'' COMMENT'Location',
remindvarchar(255) NOT NULL DEFAULT'' COMMENT'Remind who to watch',
seevarchar(255) NOT NULL DEFAULT'all' COMMENT'Who can watch all public none private' ,
user_idint(20) unsigned NOT NULL COMMENT'user id',
created_atdatetime DEFAULT NULL,
updated_atdatetime DEFAULT NULL
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;

-
- Dump the data in the tablemoment

The INTO the INSERT moment( id, content, image, video, location, remind, see, user_id, created_at, updated_at) the VALUES
(. 1, 'the first circle of friends',' ',' ', ' ',' ',' all ', 1,' 2020-03-10 19 :05:09', '2020-03-10 19:05:09'),
(2,'The first circle of friends','','','','','all', 1, ' 2020-03-10 19:06:30', '2020-03-10 19:06:30');


-
- Table structuremoment_comment

CREATE TABLE IF NOT EXISTS moment_comment(
idint(20) unsigned NOT NULL,
user_idint(20) unsigned NOT NULL COMMENT'comment user id',
moment_idint(20) unsigned NOT NULL COMMENT'friend circle message id',
contenttext NOT NULL COMMENT'comment content ',
reply_idint(11) NOT NULL DEFAULT '0' COMMENT'Reply to user id 0 top comment',
created_atdatetime DEFAULT NULL,
updated_atdatetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


-
- Table structuremoment_like

CREATE TABLE IF NOT EXISTS moment_like (
id int(20) unsigned NOT NULL,
user_id int(20) unsigned NOT NULL COMMENT '点赞用户id',
moment_id int(20) unsigned NOT NULL COMMENT '朋友圈消息id',
created_at datetime DEFAULT NULL,
updated_at datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


-
- Table structuremoment_timeline

CREATE TABLE IF NOT EXISTS moment_timeline(
idint(20) unsigned NOT NULL,
user_idint(20) unsigned NOT NULL COMMENT'user id',
moment_idint(20) unsigned NOT NULL COMMENT'friend circle message id',
ownint(1) NOT NULL DEFAULT ' 0'COMMENT'Is it your own 0 No 1 Yes',
created_atdatetime DEFAULT NULL,
updated_atdatetime DEFAULT NULL
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;

-
- Dump the data in the tablemoment_timeline

INSERT INTO moment_timeline (id, user_id, moment_id, own, created_at, updated_at) VALUES
(1, 3, 2, 0, '2020-03-10 19:06:30', '2020-03-10 19:06:30'),
(2, 2, 2, 0, '2020-03-10 19:06:30', '2020-03-10 19:06:30'),
(3, 1, 2, 1, '2020-03-10 19:06:30', '2020-03-10 19:06:30');


-
- Table structurereport

CREATE TABLE IF NOT EXISTS report(
idint(20) unsigned NOT NULL,
user_idint(20) unsigned NOT NULL COMMENT'user id',
reported_idint(20) unsigned NOT NULL COMMENT'reported person id',
reported_typeenum('user','group ') NOT NULL DEFAULT'user' COMMENT'Report type',
contenttext COMMENT'Report content',
categoryvarchar(10) DEFAULT'' COMMENT'Report classification',
statusenum('pending','refuse','agree') NOT NULL DEFAULT'pending' COMMENT'Report Status',
created_atdatetime DEFAULT NULL,
updated_atdatetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


-
- Table structuresequelizemeta

CREATE TABLE IF NOT EXISTS sequelizemeta (
name varchar(255) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

-
- Dump the data in the tablesequelizemeta

INSERT INTO sequelizemeta (name) VALUES
('20200213115147-user.js'),
('20200215122707-friend.js'),
('20200215122724-apply.js'),
('20200218125815-report.js'),
('20200218133241-tag.js'),
('20200218133258-friend_tag.js'),
('20200228072530-group.js'),
('20200228072604-group_user.js'),
('20200309131856-fava.js'),
('20200309175201-moment.js'),
('20200309183018-moment.js'),
('20200309183027-moment_timeline.js'),
('20200309183036-moment_comment.js'),
('20200309183046-moment_like.js');


-
- Table structuretag

CREATE TABLE IF NOT EXISTS tag (
id int(20) unsigned NOT NULL,
name varchar(30) NOT NULL DEFAULT '' COMMENT '标签名称',
user_id int(20) unsigned NOT NULL COMMENT '用户id',
created_at datetime DEFAULT NULL,
updated_at datetime DEFAULT NULL
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;

-
- Dump the data in the tabletag

The INTO the INSERT tag( id, name, user_id, created_at, updated_at) the VALUES
(1, 'ha', 1 '2020-03-09 18:45:07', '2020-03-09 18:45:07'),
(2 ' Family', 1, '2020-03-09 18:45:07', '2020-03-09 18:45:07'),
(3,'relatives', 1, '2020-03-09 18:45 :07', '2020-03-09 18:45:07');


-
- Table structureuser

CREATE TABLE IF NOT EXISTS user(
idint(20) unsigned NOT NULL,
usernamevarchar(30) NOT NULL DEFAULT'' COMMENT'user name',
nicknamevarchar(30) NOT NULL DEFAULT'' COMMENT'nickname',
emailvarchar(160) DEFAULT NULL COMMENT 'User mailbox',
passwordvarchar(200) NOT NULL DEFAULT'',
avatarvarchar(200) DEFAULT'',
phonevarchar(20) DEFAULT NULL COMMENT'User mobile phone',
sexenum('Male','Female','Confidential') DEFAULT 'Male' COMMENT'User Gender',
statusint(1) NOT NULL DEFAULT '1' COMMENT'Status 0 disable 1 enable',
signvarchar(200) NOT NULL DEFAULT'' COMMENT'personal signature',
areavarchar(200) NOT NULL DEFAULT '' COMMENT'Region',
created_atdatetime DEFAULT NULL,
updated_at datetime DEFAULT NULL
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;

-
- Dump the data in the tableuser

INSERT INTO user (id, username, nickname, email, password, avatar, phone, sex, status, sign, area, created_at, updated_at) VALUES
(1, 'ceshi1', '123456', NULL, 'f9c14ba4d63f224c02f317943105b0d4d7778628e51394b025994ed06d5c9863', 'http://tangzhe123-com.oss-cn-shenzhen.aliyuncs.com/egg-oss-demo/c693gocotew0000.jpg', NULL, '男', 1, '', '', '2020-03-02 19:41:29', '2020-03-09 22:16:36'),
(2, 'ceshi2', '', NULL, 'f9c14ba4d63f224c02f317943105b0d4d7778628e51394b025994ed06d5c9863', '', NULL, '男', 1, '', '', '2020-03-02 19:41:58', '2020-03-02 19:41:58'),
(3, 'ceshi3', '', NULL, 'f9c14ba4d63f224c02f317943105b0d4d7778628e51394b025994ed06d5c9863', '', NULL, '男', 1, '', '', '2020-03-02 19:42:06', '2020-03-02 19:42:06'),
(4, 'ceshi4', '', NULL, 'f9c14ba4d63f224c02f317943105b0d4d7778628e51394b025994ed06d5c9863', '', NULL, '男', 1, '', '', '2020-03-02 19:42:12', '2020-03-02 19:42:12');

--
-- Indexes for dumped tables

--
-- Indexes for table apply

ALTER TABLE apply
ADD PRIMARY KEY (id),
ADD KEY user_id (user_id),
ADD KEY friend_id (friend_id);

--
-- Indexes for table fava

ALTER TABLE fava
ADD PRIMARY KEY (id),
ADD KEY user_id (user_id);

--
-- Indexes for table friend

ALTER TABLE friend
ADD PRIMARY KEY (id),
ADD KEY user_id (user_id),
ADD KEY friend_id (friend_id);

--
-- Indexes for table friend_tag

ALTER TABLE friend_tag
ADD PRIMARY KEY (id),
ADD KEY friend_id (friend_id),
ADD KEY tag_id (tag_id);

--
-- Indexes for table group

ALTER TABLE group
ADD PRIMARY KEY (id),
ADD KEY user_id (user_id);

--
-- Indexes for table group_user

ALTER TABLE group_user
ADD PRIMARY KEY (id),
ADD KEY user_id (user_id),
ADD KEY group_id (group_id);

--
-- Indexes for table moment

ALTER TABLE moment
ADD PRIMARY KEY (id),
ADD KEY user_id (user_id);

--
-- Indexes for table moment_comment

ALTER TABLE moment_comment
ADD PRIMARY KEY (id),
ADD KEY user_id (user_id),
ADD KEY moment_id (moment_id);

--
-- Indexes for table moment_like

ALTER TABLE moment_like
ADD PRIMARY KEY (id),
ADD KEY user_id (user_id),
ADD KEY moment_id (moment_id);

--
-- Indexes for table moment_timeline

ALTER TABLE moment_timeline
ADD PRIMARY KEY (id),
ADD KEY user_id (user_id),
ADD KEY moment_id (moment_id);

--
-- Indexes for table report

ALTER TABLE report
ADD PRIMARY KEY (id),
ADD KEY user_id (user_id);

--
-- Indexes for table sequelizemeta

ALTER TABLE sequelizemeta
ADD PRIMARY KEY (name),
ADD UNIQUE KEY name (name);

--
-- Indexes for table tag

ALTER TABLE tag
ADD PRIMARY KEY (id),
ADD UNIQUE KEY name (name),
ADD KEY user_id (user_id);

--
-- Indexes for table user

ALTER TABLE user
ADD PRIMARY KEY (id),
ADD UNIQUE KEY username (username),
ADD UNIQUE KEY email (email),
ADD UNIQUE KEY phone (phone);

--
-- AUTO_INCREMENT for dumped tables

--
-- AUTO_INCREMENT for table apply

ALTER TABLE apply
MODIFY id int(20) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=4;

-- AUTO_INCREMENT for table fava

ALTER TABLE fava
MODIFY id int(20) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=14;

-- AUTO_INCREMENT for table friend

ALTER TABLE friend
MODIFY id int(20) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=15;

-- AUTO_INCREMENT for table friend_tag

ALTER TABLE friend_tag
MODIFY id int(20) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=6;

-- AUTO_INCREMENT for table group

ALTER TABLE group
MODIFY id int(20) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=5;

-- AUTO_INCREMENT for table group_user

ALTER TABLE group_user
MODIFY id int(20) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=16;

-- AUTO_INCREMENT for table moment

ALTER TABLE moment
MODIFY id int(20) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=3;

-- AUTO_INCREMENT for table moment_comment

ALTER TABLE moment_comment
MODIFY id int(20) unsigned NOT NULL AUTO_INCREMENT;

-- AUTO_INCREMENT for table moment_like

ALTER TABLE moment_like
MODIFY id int(20) unsigned NOT NULL AUTO_INCREMENT;

-- AUTO_INCREMENT for table moment_timeline

ALTER TABLE moment_timeline
MODIFY id int(20) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=4;

-- AUTO_INCREMENT for table report

ALTER TABLE report
MODIFY id int(20) unsigned NOT NULL AUTO_INCREMENT;

-- AUTO_INCREMENT for table tag

ALTER TABLE tag
MODIFY id int(20) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=4;

-- AUTO_INCREMENT for table user

ALTER TABLE user
MODIFY id int(20) unsigned NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=5;

- Limit the exported tables

-
- Restriction tableapply

ALTER TABLE apply
ADD CONSTRAINT apply_ibfk_1 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE,
ADD CONSTRAINT apply_ibfk_2 FOREIGN KEY (friend_id) REFERENCES user (id) ON DELETE CASCADE;

-
- Restriction tablefava

ALTER TABLE fava
ADD CONSTRAINT fava_ibfk_1 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE;

-
- Restriction tablefriend

ALTER TABLE friend
ADD CONSTRAINT friend_ibfk_1 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE,
ADD CONSTRAINT friend_ibfk_2 FOREIGN KEY (friend_id) REFERENCES user (id) ON DELETE CASCADE;

-
- Restriction tablefriend_tag

ALTER TABLE friend_tag
ADD CONSTRAINT friend_tag_ibfk_1 FOREIGN KEY (friend_id) REFERENCES friend (id) ON DELETE CASCADE,
ADD CONSTRAINT friend_tag_ibfk_2 FOREIGN KEY (tag_id) REFERENCES tag (id) ON DELETE CASCADE;

-
- Restriction tablegroup

ALTER TABLE group
ADD CONSTRAINT group_ibfk_1 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE;

-
- Restriction tablegroup_user

ALTER TABLE group_user
ADD CONSTRAINT group_user_ibfk_1 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE,
ADD CONSTRAINT group_user_ibfk_2 FOREIGN KEY (group_id) REFERENCES group (id) ON DELETE CASCADE;

-
- Restriction tablemoment

ALTER TABLE moment
ADD CONSTRAINT moment_ibfk_1 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE;

-
- Restriction tablemoment_comment

ALTER TABLE moment_comment
ADD CONSTRAINT moment_comment_ibfk_1 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE,
ADD CONSTRAINT moment_comment_ibfk_2 FOREIGN KEY (moment_id) REFERENCES moment (id) ON DELETE CASCADE;

-
- Restriction tablemoment_like

ALTER TABLE moment_like
ADD CONSTRAINT moment_like_ibfk_1 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE,
ADD CONSTRAINT moment_like_ibfk_2 FOREIGN KEY (moment_id) REFERENCES moment (id) ON DELETE CASCADE;

-
- Restriction tablemoment_timeline

ALTER TABLE moment_timeline
ADD CONSTRAINT moment_timeline_ibfk_1 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE,
ADD CONSTRAINT moment_timeline_ibfk_2 FOREIGN KEY (moment_id) REFERENCES moment (id) ON DELETE CASCADE;

-
- Restriction tablereport

ALTER TABLE report
ADD CONSTRAINT report_ibfk_1 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE;

-
- Restriction tabletag

ALTER TABLE tag
ADD CONSTRAINT tag_ibfk_1 FOREIGN KEY (user_id) REFERENCES user (id) ON DELETE CASCADE;

/!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT /;
/!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS /;
/!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION /;

Guess you like

Origin blog.51cto.com/15117684/2642799