-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDatabaseRestore.txt
19 lines (13 loc) · 1.24 KB
/
DatabaseRestore.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# Create database and tables:
CREATE DATABASE MASTER;
USE MASTER;
CREATE TABLE USERS (ID INT NOT NULL AUTO_INCREMENT, DATECREATED DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, DATELASTLOGGEDIN DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, USERNAME VARCHAR(30) NOT NULL DEFAULT '', PASSWORD VARCHAR(50) NOT NULL DEFAULT '', PRIMARY KEY (ID));
CREATE TABLE CONTACTS (ID INT NOT NULL AUTO_INCREMENT, FIRSTNAME VARCHAR(30) NOT NULL DEFAULT '', LASTNAME VARCHAR(30) NOT NULL DEFAULT '', EMAIL VARCHAR(320) NOT NULL DEFAULT '', PHONE VARCHAR(20) NOT NULL DEFAULT '', USERID INT NOT NULL DEFAULT '0' , DATECREATED DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (`ID`));
# Add test user:
insert into USERS (Username,Password) VALUES ('JohnDoe','password');
# Add test contact: (contact belongs to JohnDoe, presuming his ID is 1)
insert into CONTACTS (FIRSTNAME, LASTNAME, EMAIL, PHONE, USERID) VALUES ('Mister', 'ExampleContact', 'mrcontact@notfacebook.org', '4075555555', '1');
insert into CONTACTS (FIRSTNAME, LASTNAME, EMAIL, PHONE, USERID) VALUES ('Miss', 'ExampleContact', 'misscontact@aol.com', '4076666666', '1');
# Add user for API
create user 'API'@'%' identified by '123NotPassword';
grant all privileges on MASTER.* to 'API'@'%';