· 8 years ago · Jul 20, 2018, 11:18 AM
1DROP DATABASE IF EXISTS lowscore;
2CREATE DATABASE IF NOT EXISTS lowscore;
3
4USE lowscore;
5
6DROP TABLE IF EXISTS comics;
7DROP TABLE IF EXISTS users;
8
9CREATE TABLE IF NOT EXISTS users (
10 id integer not null auto_increment primary key,
11 openid varchar(255) not null,
12 alias varchar(255) not null unique key
13) ENGINE=INNODB;
14
15CREATE TABLE IF NOT EXISTS comics (
16 id int not null auto_increment primary key,
17 authorId int not null,
18 name varchar(30) not null,
19 dateCreated int not null,
20 rating int not null,
21 image blob not null,
22 imageType varchar(255) not null,
23 imageSize int not null,
24
25 foreign key authorId_usersId_fkey (authorId) references users(id) on update cascade on delete restrict
26) ENGINE=INNODB;