Skip to content
Permalink
Browse files

Added database schema and seed data

  • Loading branch information...
borabilgin committed Jan 23, 2019
1 parent 275d4fb commit 74305622e5628d14f93347285266b30e64c7deda
@@ -1,7 +1,7 @@
security.oauth2.resource.filter-order=3

security.signing-key=AjYtfrTh532Gh1X
security.encoding-strength=256
security.encoding-strength=9
security.security-realm=ImageBrowser JWT Realm

security.jwt.client-id=jwtclientid
@@ -0,0 +1,35 @@
CREATE TABLE FEED_CATEGORY {
ID INT NOT NULL AUTO_INCREMENT,
NAME NVARCHAR(255) NOT NULL
};

CREATE TABLE FEED {
ID INT NOT NULL AUTO_INCREMENT,
NAME NVARCHAR(255) NOT NULL,
ADDRESS NVARCHAR(2048) NOT NULL,
CATEGORY_ID INT NOT NULL,
CONSTRAINT CONSTRAINT_FEED_CATEGORY_FK FOREIGN KEY (CATEGORY_ID) REFERENCES FEED_CATEGORY,
PRIMARY KEY(ID)
};

CREATE TABLE APP_ROLE {
ID INT NOT NULL AUTO_INCREMENT,
DESCRIPTION NVARCHAR(255) NOT NULL,
ROLE_NAME NVARCHAR(255) NOT NULL,
PRIMARY KEY(ID)
};

CREATE TABLE APP_USER {
ID INT NOT NULL AUTO_INCREMENT,
USERNAME NVARCHAR(255) NOT NULL,
PASSWORD NVARCHAR(255) NOT NULL,
PRIMARY KEY (ID)
};

CREATE TABLE USER_ROLE {
USER_ID INT NOT NULL,
ROLE_ID INT NOT NULL,
CONSTRAINT USER_ROLE_USER_FK FOREIGN KEY (USER_ID) REFERENCES APP_USER (ID),
CONSTRAINT USER_ROLE_ROLE_FK FOREIGN KEY (ROLE_ID) REFERENCES APP_ROLE (ID)
};

@@ -0,0 +1,20 @@
INSERT INTO APP_ROLE (ID, DESCRIPTION, ROLE_NAME) VALUES (1, 'Regular User', 'USER');
INSERT INTO APP_ROLE (ID, DESCRIPTION, ROLE_NAME) VALUES (2, 'Admin User', 'ADMIN');

-- Password is 'password'
INSERT INTO APP_USER (IS, USERNAME, PASSWORD) VALUES (1, 'Bora', '$2a$09$5pvrWJ0Bg3ARBzWEp9t1IO6GRASmBqIJf7rPZVJpu0iV8BToIlX9y');
INSERT INTO APP_USER (IS, USERNAME, PASSWORD) VALUES (1, 'Admin', '$2a$09$5pvrWJ0Bg3ARBzWEp9t1IO6GRASmBqIJf7rPZVJpu0iV8BToIlX9y');

INSERT INTO USER_ROLE(USER_ID, ROLE_ID) VALUES (1,1);
INSERT INTO USER_ROLE(USER_ID, ROLE_ID) VALUES (2,1);
INSERT INTO USER_ROLE(USER_ID, ROLE_ID) VALUES (2,2);

INSERT INTO FEED_CATEGORY(ID, NAME) VALUES (1, 'News Stories');
INSERT INTO FEED_CATEGORY(ID, NAME) VALUES (2, 'Tech related');
INSERT INTO FEED_CATEGORY(ID, NAME) VALUES (3, 'Time wasters');

INSERT INTO FEED (ID, NAME, ADDRESS, CATEGORY_ID) VALUES (1, 'Google News', '', 1);
INSERT INTO FEED (ID, NAME, ADDRESS, CATEGORY_ID) VALUES (1, 'Hacker News', '', 2);
INSERT INTO FEED (ID, NAME, ADDRESS, CATEGORY_ID) VALUES (1, 'Reddit', '', 3);


0 comments on commit 7430562

Please sign in to comment.
You can’t perform that action at this time.