download:uni-app实战仿微信app开发《网易云课堂》
-- 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
-- 服务器版本: 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
--
-- 表的结构 apply
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;
--
-- 转存表中的数据 apply
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');
--
-- 表的结构 fava
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;
--
-- 转存表中的数据 fava
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');
--
-- 表的结构 friend
CREATE TABLE IF NOT EXISTS friend
(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 '看他',star
int(1) NOT NULL DEFAULT '0' COMMENT '是否为星标朋友:0否1是',isblack
int(1) NOT NULL DEFAULT '0' COMMENT '是否加入黑名单:0否1是',created_at
datetime DEFAULT NULL,updated_at
datetime DEFAULT NULL
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8;
--
-- 转存表中的数据 friend
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');
--
-- 表的结构 friend_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;
--
-- 转存表中的数据 friend_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');
--
-- 表的结构 group
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;
--
-- 转存表中的数据 group
INSERT INTO group
(id
, name
, avatar
, user_id
, remark
, invite_confirm
, status
, created_at
, updated_at
) VALUES
(4, '欢乐群1', '', 2, '我们可以直接通过 mysql 命令将表直接建好,但是这并不是一个对多人协作非常友好的开发模式。在项目的演进过程中,每一个迭代都有可能对数据库数据结构做变更,怎样跟踪每一个迭代的数据变更', 1, 1, '2020-03-03 00:27:24', '2020-03-06 17:14:13');
--
-- 表的结构 group_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;
--
-- 转存表中的数据 group_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');
--
-- 表的结构 moment
CREATE TABLE IF NOT EXISTS moment
(id
int(20) unsigned NOT NULL,content
text NOT NULL COMMENT '朋友圈内容',image
text NOT NULL COMMENT '朋友圈图片',video
varchar(255) NOT NULL DEFAULT '' COMMENT '朋友圈视频',location
varchar(255) NOT NULL DEFAULT '' COMMENT '位置',remind
varchar(255) NOT NULL DEFAULT '' COMMENT '提醒谁看',see
varchar(255) NOT NULL DEFAULT 'all' COMMENT '谁可以看 all公开 none私密',user_id
int(20) unsigned NOT NULL COMMENT '用户id',created_at
datetime DEFAULT NULL,updated_at
datetime DEFAULT NULL
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
--
-- 转存表中的数据 moment
INSERT INTO moment
(id
, content
, image
, video
, location
, remind
, see
, user_id
, created_at
, updated_at
) VALUES
(1, '第一条朋友圈', '', '', '', '', 'all', 1, '2020-03-10 19:05:09', '2020-03-10 19:05:09'),
(2, '第一条朋友圈', '', '', '', '', 'all', 1, '2020-03-10 19:06:30', '2020-03-10 19:06:30');
--
-- 表的结构 moment_comment
CREATE TABLE IF NOT EXISTS moment_comment
(id
int(20) unsigned NOT NULL,user_id
int(20) unsigned NOT NULL COMMENT '评论用户id',moment_id
int(20) unsigned NOT NULL COMMENT '朋友圈消息id',content
text NOT NULL COMMENT '评论内容',reply_id
int(11) NOT NULL DEFAULT '0' COMMENT '回复用户id 0顶级评论',created_at
datetime DEFAULT NULL,updated_at
datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- 表的结构 moment_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;
--
-- 表的结构 moment_timeline
CREATE TABLE IF NOT EXISTS moment_timeline
(id
int(20) unsigned NOT NULL,user_id
int(20) unsigned NOT NULL COMMENT '用户id',moment_id
int(20) unsigned NOT NULL COMMENT '朋友圈消息id',own
int(1) NOT NULL DEFAULT '0' COMMENT '是否是自己的 0否1是',created_at
datetime DEFAULT NULL,updated_at
datetime DEFAULT NULL
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;
--
-- 转存表中的数据 moment_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');
--
-- 表的结构 report
CREATE TABLE IF NOT EXISTS report
(id
int(20) unsigned NOT NULL,user_id
int(20) unsigned NOT NULL COMMENT '用户id',reported_id
int(20) unsigned NOT NULL COMMENT '被举报人id',reported_type
enum('user','group') NOT NULL DEFAULT 'user' COMMENT '举报类型',content
text COMMENT '举报内容',category
varchar(10) DEFAULT '' COMMENT '举报分类',status
enum('pending','refuse','agree') NOT NULL DEFAULT 'pending' COMMENT '举报状态',created_at
datetime DEFAULT NULL,updated_at
datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- 表的结构 sequelizemeta
CREATE TABLE IF NOT EXISTS sequelizemeta
(name
varchar(255) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
--
-- 转存表中的数据 sequelizemeta
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');
--
-- 表的结构 tag
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;
--
-- 转存表中的数据 tag
INSERT INTO tag
(id
, name
, user_id
, created_at
, updated_at
) VALUES
(1, '哈哈哈', 1, '2020-03-09 18:45:07', '2020-03-09 18:45:07'),
(2, '家人', 1, '2020-03-09 18:45:07', '2020-03-09 18:45:07'),
(3, '亲戚', 1, '2020-03-09 18:45:07', '2020-03-09 18:45:07');
--
-- 表的结构 user
CREATE TABLE IF NOT EXISTS user
(id
int(20) unsigned NOT NULL,username
varchar(30) NOT NULL DEFAULT '' COMMENT '用户名称',nickname
varchar(30) NOT NULL DEFAULT '' COMMENT '昵称',email
varchar(160) DEFAULT NULL COMMENT '用户邮箱',password
varchar(200) NOT NULL DEFAULT '',avatar
varchar(200) DEFAULT '',phone
varchar(20) DEFAULT NULL COMMENT '用户手机',sex
enum('男','女','保密') DEFAULT '男' COMMENT '用户性别',status
int(1) NOT NULL DEFAULT '1' COMMENT '状态 0禁用1启用',sign
varchar(200) NOT NULL DEFAULT '' COMMENT '个性签名',area
varchar(200) NOT NULL DEFAULT '' COMMENT '地区',created_at
datetime DEFAULT NULL,updated_at
datetime DEFAULT NULL
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
--
-- 转存表中的数据 user
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;
-- 限制导出的表
--
-- 限制表 apply
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;
--
-- 限制表 fava
ALTER TABLE fava
ADD CONSTRAINT fava_ibfk_1
FOREIGN KEY (user_id
) REFERENCES user
(id
) ON DELETE CASCADE;
--
-- 限制表 friend
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;
--
-- 限制表 friend_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;
--
-- 限制表 group
ALTER TABLE group
ADD CONSTRAINT group_ibfk_1
FOREIGN KEY (user_id
) REFERENCES user
(id
) ON DELETE CASCADE;
--
-- 限制表 group_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;
--
-- 限制表 moment
ALTER TABLE moment
ADD CONSTRAINT moment_ibfk_1
FOREIGN KEY (user_id
) REFERENCES user
(id
) ON DELETE CASCADE;
--
-- 限制表 moment_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;
--
-- 限制表 moment_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;
--
-- 限制表 moment_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;
--
-- 限制表 report
ALTER TABLE report
ADD CONSTRAINT report_ibfk_1
FOREIGN KEY (user_id
) REFERENCES user
(id
) ON DELETE CASCADE;
--
-- 限制表 tag
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 /;