-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit_db.sql
65 lines (64 loc) · 1.54 KB
/
init_db.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
CREATE DATABASE IF NOT EXISTS smartPetFeeder;
USE smartPetFeeder;
START TRANSACTION;
CREATE TABLE blog
(
id INT AUTO_INCREMENT PRIMARY KEY,
user_id INT,
title VARCHAR(255),
title_src VARCHAR(255),
content TEXT
) ENGINE = InnoDB
CHARSET = utf8mb4
COLLATE = utf8mb4_unicode_ci;
CREATE TABLE user
(
id INT AUTO_INCREMENT PRIMARY KEY,
`name` VARCHAR(255),
`account` VARCHAR(255),
`password` VARCHAR(255),
wechat_id VARCHAR(255),
avatar VARCHAR(255)
) ENGINE = InnoDB
CHARSET = utf8mb4
COLLATE = utf8mb4_unicode_ci;
create TABLE user_blog_likes
(
id INT AUTO_INCREMENT PRIMARY KEY,
user_id INT,
blog_id INT,
like_status TINYINT(1)
) ENGINE = InnoDB
CHARSET = utf8mb4
COLLATE = utf8mb4_unicode_ci;
CREATE TABLE pet
(
id INT AUTO_INCREMENT PRIMARY KEY,
user_id INT,
`name` VARCHAR(255),
gender TINYINT(1),
age INT,
weight INT,
birthdate DATE,
pet_type VARCHAR(255),
avatar VARCHAR(255),
duration INT,
breakfast VARCHAR(255),
lunch VARCHAR(255),
dinner VARCHAR(255),
`description` TEXT,
`device_id` INT
) ENGINE = InnoDB
CHARSET = utf8mb4
COLLATE = utf8mb4_unicode_ci;
CREATE TABLE device
(
id INT PRIMARY KEY,
user_id INT,
`name` VARCHAR(255),
`description` TEXT,
`status` TINYINT(1)
) ENGINE = InnoDB
CHARSET = utf8mb4
COLLATE = utf8mb4_unicode_ci;
COMMIT