-
Notifications
You must be signed in to change notification settings - Fork 1
/
db.sql
executable file
·46 lines (36 loc) · 1.25 KB
/
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
-- ****************** SqlDBM: MySQL ******************;
-- ***************************************************;
SET FOREIGN_KEY_CHECKS=0;
DROP TABLE IF EXISTS Administrators;
DROP TABLE IF EXISTS Articles;
DROP TABLE IF EXISTS Images;
-- ************************************** Administrators
CREATE TABLE IF NOT EXISTS Administrators
(
Username varchar(40) NOT NULL PRIMARY KEY,
Email varchar(40) NOT NULL UNIQUE,
Password varchar(64) NOT NULL
);
-- ************************************** Images
CREATE TABLE IF NOT EXISTS Images
(
Id int PRIMARY KEY AUTO_INCREMENT,
FileName varchar(64) NOT NULL UNIQUE,
Alt text,
Url varchar(128) NOT NULL UNIQUE
);
-- ************************************** Articles
CREATE TABLE IF NOT EXISTS Articles
(
Id int PRIMARY KEY AUTO_INCREMENT,
Title text NOT NULL,
ArticleTextContent text NOT NULL,
Summary text NOT NULL,
InsertDate datetime NOT NULL,
Image int,
Keywords text,
FOREIGN KEY (Image) REFERENCES Images(Id)
);
INSERT INTO Administrators(Username, Email, Password)
VALUES ("admin", "[email protected]", "8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918");
SET FOREIGN_KEY_CHECKS=1;