Bladeren bron

sql database

Nathan Hall 6 jaren geleden
bovenliggende
commit
53975a96bd
2 gewijzigde bestanden met toevoegingen van 163 en 0 verwijderingen
  1. 1
    0
      src/main/resources/.h2.server.properties
  2. 162
    0
      test.sql

+ 1
- 0
src/main/resources/.h2.server.properties Bestand weergeven

@@ -1,4 +1,5 @@
1 1
 #H2 Server Properties
2
+#Thu Dec 20 15:12:15 EST 2018
2 3
 0=JHipster H2 (Memory)|org.h2.Driver|jdbc\:h2\:mem\:zipconnect|ZipConnect
3 4
 webAllowOthers=true
4 5
 webPort=8082

+ 162
- 0
test.sql Bestand weergeven

@@ -0,0 +1,162 @@
1
+SET DB_CLOSE_DELAY -1;         
2
+;              
3
+CREATE USER IF NOT EXISTS ZIPCONNECT SALT '791b2ef2581e3748' HASH '40394715a88a697e746b148477d4fb5f05837d47e0d2757fc55c960ef8b39fce' ADMIN;    
4
+CREATE SEQUENCE PUBLIC.SYSTEM_SEQUENCE_05BAF210_F502_4348_B72D_30B4760D1D03 START WITH 1 BELONGS_TO_TABLE;     
5
+CREATE SEQUENCE PUBLIC.SYSTEM_SEQUENCE_B49B1531_1AC3_4339_BF47_BF8C89C85F3B START WITH 1 BELONGS_TO_TABLE;     
6
+CREATE SEQUENCE PUBLIC.SYSTEM_SEQUENCE_69E8117E_547D_4FA0_B4B8_7D61F900115C START WITH 1 BELONGS_TO_TABLE;     
7
+CREATE SEQUENCE PUBLIC.SYSTEM_SEQUENCE_A973D896_49E9_4108_9EB2_04CCBD2E46C1 START WITH 1 BELONGS_TO_TABLE;     
8
+CREATE SEQUENCE PUBLIC.SYSTEM_SEQUENCE_99C30569_781F_4C20_9CE6_F20AA78F4C49 START WITH 5 BELONGS_TO_TABLE;     
9
+CREATE SEQUENCE PUBLIC.SYSTEM_SEQUENCE_B2398558_7506_4144_82D4_6455E324C759 START WITH 1 BELONGS_TO_TABLE;     
10
+CREATE SEQUENCE PUBLIC.SYSTEM_SEQUENCE_FECABC6A_D198_488F_B104_F7AA0724091D START WITH 1 BELONGS_TO_TABLE;     
11
+CREATE MEMORY TABLE PUBLIC.DATABASECHANGELOGLOCK(
12
+    ID INT NOT NULL,
13
+    LOCKED BOOLEAN NOT NULL,
14
+    LOCKGRANTED TIMESTAMP,
15
+    LOCKEDBY VARCHAR(255)
16
+);    
17
+ALTER TABLE PUBLIC.DATABASECHANGELOGLOCK ADD CONSTRAINT PUBLIC.PK_DATABASECHANGELOGLOCK PRIMARY KEY(ID);       
18
+-- 1 +/- SELECT COUNT(*) FROM PUBLIC.DATABASECHANGELOGLOCK;    
19
+INSERT INTO PUBLIC.DATABASECHANGELOGLOCK(ID, LOCKED, LOCKGRANTED, LOCKEDBY) VALUES
20
+(1, FALSE, NULL, NULL);     
21
+CREATE MEMORY TABLE PUBLIC.DATABASECHANGELOG(
22
+    ID VARCHAR(255) NOT NULL,
23
+    AUTHOR VARCHAR(255) NOT NULL,
24
+    FILENAME VARCHAR(255) NOT NULL,
25
+    DATEEXECUTED TIMESTAMP NOT NULL,
26
+    ORDEREXECUTED INT NOT NULL,
27
+    EXECTYPE VARCHAR(10) NOT NULL,
28
+    MD5SUM VARCHAR(35),
29
+    DESCRIPTION VARCHAR(255),
30
+    COMMENTS VARCHAR(255),
31
+    TAG VARCHAR(255),
32
+    LIQUIBASE VARCHAR(20),
33
+    CONTEXTS VARCHAR(255),
34
+    LABELS VARCHAR(255),
35
+    DEPLOYMENT_ID VARCHAR(10)
36
+);               
37
+-- 8 +/- SELECT COUNT(*) FROM PUBLIC.DATABASECHANGELOG;        
38
+INSERT INTO PUBLIC.DATABASECHANGELOG(ID, AUTHOR, FILENAME, DATEEXECUTED, ORDEREXECUTED, EXECTYPE, MD5SUM, DESCRIPTION, COMMENTS, TAG, LIQUIBASE, CONTEXTS, LABELS, DEPLOYMENT_ID) VALUES
39
+('00000000000001', 'jhipster', 'config/liquibase/changelog/00000000000000_initial_schema.xml', TIMESTAMP '2018-12-20 15:11:06.045', 1, 'EXECUTED', '7:8eef49fe9846cf127a6c088e3d850cb0', 'createTable tableName=jhi_user; createTable tableName=jhi_authority; createTable tableName=jhi_user_authority; addPrimaryKey tableName=jhi_user_authority; addForeignKeyConstraint baseTableName=jhi_user_authority, constraintName=fk_authority_name, ...', '', NULL, '3.5.4', NULL, NULL, '5336665793'),
40
+('20181217184612-1', 'jhipster', 'config/liquibase/changelog/20181217184612_added_entity_UserProfile.xml', TIMESTAMP '2018-12-20 15:11:06.06', 2, 'EXECUTED', '7:13d806ee806a475cdb828f90479e3da7', 'createTable tableName=user_profile', '', NULL, '3.5.4', NULL, NULL, '5336665793'),
41
+('20181217184613-1', 'jhipster', 'config/liquibase/changelog/20181217184613_added_entity_Cohort.xml', TIMESTAMP '2018-12-20 15:11:06.066', 3, 'EXECUTED', '7:ab6218521729a91a6cf095e1cc219e6b', 'createTable tableName=cohort', '', NULL, '3.5.4', NULL, NULL, '5336665793'),
42
+('20181217184614-1', 'jhipster', 'config/liquibase/changelog/20181217184614_added_entity_Employer.xml', TIMESTAMP '2018-12-20 15:11:06.07', 4, 'EXECUTED', '7:99bb184cef1922b8432114ff5615cd88', 'createTable tableName=employer', '', NULL, '3.5.4', NULL, NULL, '5336665793'),
43
+('20181217184615-1', 'jhipster', 'config/liquibase/changelog/20181217184615_added_entity_Post.xml', TIMESTAMP '2018-12-20 15:11:06.074', 5, 'EXECUTED', '7:68b618230d8b4175f9c3fee15771054a', 'createTable tableName=post', '', NULL, '3.5.4', NULL, NULL, '5336665793'),
44
+('20181217184616-1', 'jhipster', 'config/liquibase/changelog/20181217184616_added_entity_Privacy.xml', TIMESTAMP '2018-12-20 15:11:06.08', 6, 'EXECUTED', '7:2691075ffa5856c7404712dc50f51248', 'createTable tableName=privacy', '', NULL, '3.5.4', NULL, NULL, '5336665793'),
45
+('20181217184612-2', 'jhipster', 'config/liquibase/changelog/20181217184612_added_entity_constraints_UserProfile.xml', TIMESTAMP '2018-12-20 15:11:06.091', 7, 'EXECUTED', '7:4265c77c4003ac55e132296cff70529b', 'addForeignKeyConstraint baseTableName=user_profile, constraintName=fk_user_profile_user_id, referencedTableName=jhi_user; addForeignKeyConstraint baseTableName=user_profile, constraintName=fk_user_profile_employer_id, referencedTableName=employer;...', '', NULL, '3.5.4', NULL, NULL, '5336665793'),
46
+('20181217184615-2', 'jhipster', 'config/liquibase/changelog/20181217184615_added_entity_constraints_Post.xml', TIMESTAMP '2018-12-20 15:11:06.1', 8, 'EXECUTED', '7:7d0aed241b1359d2a465be6011b4109e', 'addForeignKeyConstraint baseTableName=post, constraintName=fk_post_poster_id, referencedTableName=user_profile; addForeignKeyConstraint baseTableName=post, constraintName=fk_post_privacy_setting_id, referencedTableName=privacy', '', NULL, '3.5.4', NULL, NULL, '5336665793');         
47
+CREATE MEMORY TABLE PUBLIC.JHI_USER(
48
+    ID BIGINT DEFAULT (NEXT VALUE FOR PUBLIC.SYSTEM_SEQUENCE_99C30569_781F_4C20_9CE6_F20AA78F4C49) NOT NULL NULL_TO_DEFAULT SEQUENCE PUBLIC.SYSTEM_SEQUENCE_99C30569_781F_4C20_9CE6_F20AA78F4C49,
49
+    LOGIN VARCHAR(50) NOT NULL,
50
+    PASSWORD_HASH VARCHAR(60) NOT NULL,
51
+    FIRST_NAME VARCHAR(50),
52
+    LAST_NAME VARCHAR(50),
53
+    EMAIL VARCHAR(254),
54
+    IMAGE_URL VARCHAR(256),
55
+    ACTIVATED BOOLEAN NOT NULL,
56
+    LANG_KEY VARCHAR(6),
57
+    ACTIVATION_KEY VARCHAR(20),
58
+    RESET_KEY VARCHAR(20),
59
+    CREATED_BY VARCHAR(50) NOT NULL,
60
+    CREATED_DATE TIMESTAMP DEFAULT NULL,
61
+    RESET_DATE TIMESTAMP,
62
+    LAST_MODIFIED_BY VARCHAR(50),
63
+    LAST_MODIFIED_DATE TIMESTAMP
64
+);    
65
+ALTER TABLE PUBLIC.JHI_USER ADD CONSTRAINT PUBLIC.PK_JHI_USER PRIMARY KEY(ID); 
66
+-- 4 +/- SELECT COUNT(*) FROM PUBLIC.JHI_USER; 
67
+INSERT INTO PUBLIC.JHI_USER(ID, LOGIN, PASSWORD_HASH, FIRST_NAME, LAST_NAME, EMAIL, IMAGE_URL, ACTIVATED, LANG_KEY, ACTIVATION_KEY, RESET_KEY, CREATED_BY, CREATED_DATE, RESET_DATE, LAST_MODIFIED_BY, LAST_MODIFIED_DATE) VALUES
68
+(1, 'system', '$2a$10$mE.qmcV0mFU5NcKh73TZx.z4ueI/.bDWbj0T1BYyqP481kGGarKLG', 'System', 'System', 'system@localhost', '', TRUE, 'en', NULL, NULL, 'system', NULL, NULL, 'system', NULL),
69
+(2, 'anonymoususer', '$2a$10$j8S5d7Sr7.8VTOYNviDPOeWX8KcYILUVJBsYV83Y5NtECayypx9lO', 'Anonymous', 'User', 'anonymous@localhost', '', TRUE, 'en', NULL, NULL, 'system', NULL, NULL, 'system', NULL),
70
+(3, 'admin', '$2a$10$gSAhZrxMllrbgj/kkK9UceBPpChGWJA7SYIb1Mqo.n5aNLq1/oRrC', 'Administrator', 'Administrator', 'admin@localhost', '', TRUE, 'en', NULL, NULL, 'system', NULL, NULL, 'system', NULL),
71
+(4, 'user', '$2a$10$VEjxo0jq2YG9Rbk2HmX9S.k1uZBGYUHdUcid3g/vfiEl7lwWgOH/K', 'User', 'User', 'user@localhost', '', TRUE, 'en', NULL, NULL, 'system', NULL, NULL, 'system', NULL);           
72
+CREATE MEMORY TABLE PUBLIC.JHI_AUTHORITY(
73
+    NAME VARCHAR(50) NOT NULL
74
+);     
75
+ALTER TABLE PUBLIC.JHI_AUTHORITY ADD CONSTRAINT PUBLIC.PK_JHI_AUTHORITY PRIMARY KEY(NAME);     
76
+-- 2 +/- SELECT COUNT(*) FROM PUBLIC.JHI_AUTHORITY;            
77
+INSERT INTO PUBLIC.JHI_AUTHORITY(NAME) VALUES
78
+('ROLE_ADMIN'),
79
+('ROLE_USER');   
80
+CREATE MEMORY TABLE PUBLIC.JHI_USER_AUTHORITY(
81
+    USER_ID BIGINT NOT NULL,
82
+    AUTHORITY_NAME VARCHAR(50) NOT NULL
83
+);         
84
+ALTER TABLE PUBLIC.JHI_USER_AUTHORITY ADD CONSTRAINT PUBLIC.CONSTRAINT_E PRIMARY KEY(USER_ID, AUTHORITY_NAME); 
85
+-- 5 +/- SELECT COUNT(*) FROM PUBLIC.JHI_USER_AUTHORITY;       
86
+INSERT INTO PUBLIC.JHI_USER_AUTHORITY(USER_ID, AUTHORITY_NAME) VALUES
87
+(1, 'ROLE_ADMIN'),
88
+(1, 'ROLE_USER'),
89
+(3, 'ROLE_ADMIN'),
90
+(3, 'ROLE_USER'),
91
+(4, 'ROLE_USER');              
92
+CREATE MEMORY TABLE PUBLIC.JHI_PERSISTENT_AUDIT_EVENT(
93
+    EVENT_ID BIGINT DEFAULT (NEXT VALUE FOR PUBLIC.SYSTEM_SEQUENCE_B2398558_7506_4144_82D4_6455E324C759) NOT NULL NULL_TO_DEFAULT SEQUENCE PUBLIC.SYSTEM_SEQUENCE_B2398558_7506_4144_82D4_6455E324C759,
94
+    PRINCIPAL VARCHAR(50) NOT NULL,
95
+    EVENT_DATE TIMESTAMP,
96
+    EVENT_TYPE VARCHAR(255)
97
+);    
98
+ALTER TABLE PUBLIC.JHI_PERSISTENT_AUDIT_EVENT ADD CONSTRAINT PUBLIC.PK_JHI_PERSISTENT_AUDIT_EVENT PRIMARY KEY(EVENT_ID);       
99
+-- 0 +/- SELECT COUNT(*) FROM PUBLIC.JHI_PERSISTENT_AUDIT_EVENT;               
100
+CREATE INDEX PUBLIC.IDX_PERSISTENT_AUDIT_EVENT ON PUBLIC.JHI_PERSISTENT_AUDIT_EVENT(PRINCIPAL, EVENT_DATE);    
101
+CREATE MEMORY TABLE PUBLIC.JHI_PERSISTENT_AUDIT_EVT_DATA(
102
+    EVENT_ID BIGINT NOT NULL,
103
+    NAME VARCHAR(150) NOT NULL,
104
+    VALUE VARCHAR(255)
105
+);              
106
+ALTER TABLE PUBLIC.JHI_PERSISTENT_AUDIT_EVT_DATA ADD CONSTRAINT PUBLIC.CONSTRAINT_F PRIMARY KEY(EVENT_ID, NAME);               
107
+-- 0 +/- SELECT COUNT(*) FROM PUBLIC.JHI_PERSISTENT_AUDIT_EVT_DATA;            
108
+CREATE INDEX PUBLIC.IDX_PERSISTENT_AUDIT_EVT_DATA ON PUBLIC.JHI_PERSISTENT_AUDIT_EVT_DATA(EVENT_ID);           
109
+CREATE MEMORY TABLE PUBLIC.USER_PROFILE(
110
+    ID BIGINT DEFAULT (NEXT VALUE FOR PUBLIC.SYSTEM_SEQUENCE_A973D896_49E9_4108_9EB2_04CCBD2E46C1) NOT NULL NULL_TO_DEFAULT SEQUENCE PUBLIC.SYSTEM_SEQUENCE_A973D896_49E9_4108_9EB2_04CCBD2E46C1,
111
+    FIRST_NAME VARCHAR(255),
112
+    LAST_NAME VARCHAR(255),
113
+    USER_STACK VARCHAR(255),
114
+    USER_ID BIGINT,
115
+    EMPLOYER_ID BIGINT,
116
+    COHORT_ID BIGINT
117
+);           
118
+ALTER TABLE PUBLIC.USER_PROFILE ADD CONSTRAINT PUBLIC.PK_USER_PROFILE PRIMARY KEY(ID);         
119
+-- 0 +/- SELECT COUNT(*) FROM PUBLIC.USER_PROFILE;             
120
+CREATE MEMORY TABLE PUBLIC.COHORT(
121
+    ID BIGINT DEFAULT (NEXT VALUE FOR PUBLIC.SYSTEM_SEQUENCE_B49B1531_1AC3_4339_BF47_BF8C89C85F3B) NOT NULL NULL_TO_DEFAULT SEQUENCE PUBLIC.SYSTEM_SEQUENCE_B49B1531_1AC3_4339_BF47_BF8C89C85F3B,
122
+    GRAD_DATE VARCHAR(255)
123
+);             
124
+ALTER TABLE PUBLIC.COHORT ADD CONSTRAINT PUBLIC.PK_COHORT PRIMARY KEY(ID);     
125
+-- 0 +/- SELECT COUNT(*) FROM PUBLIC.COHORT;   
126
+CREATE MEMORY TABLE PUBLIC.EMPLOYER(
127
+    ID BIGINT DEFAULT (NEXT VALUE FOR PUBLIC.SYSTEM_SEQUENCE_FECABC6A_D198_488F_B104_F7AA0724091D) NOT NULL NULL_TO_DEFAULT SEQUENCE PUBLIC.SYSTEM_SEQUENCE_FECABC6A_D198_488F_B104_F7AA0724091D,
128
+    COMPANY_NAME VARCHAR(255),
129
+    CITY VARCHAR(255),
130
+    STATE VARCHAR(255)
131
+);         
132
+ALTER TABLE PUBLIC.EMPLOYER ADD CONSTRAINT PUBLIC.PK_EMPLOYER PRIMARY KEY(ID); 
133
+-- 0 +/- SELECT COUNT(*) FROM PUBLIC.EMPLOYER; 
134
+CREATE MEMORY TABLE PUBLIC.POST(
135
+    ID BIGINT DEFAULT (NEXT VALUE FOR PUBLIC.SYSTEM_SEQUENCE_69E8117E_547D_4FA0_B4B8_7D61F900115C) NOT NULL NULL_TO_DEFAULT SEQUENCE PUBLIC.SYSTEM_SEQUENCE_69E8117E_547D_4FA0_B4B8_7D61F900115C,
136
+    JHI_TIMESTAMP DATE,
137
+    CONTENT VARCHAR(255),
138
+    LIKES VARCHAR(255),
139
+    POSTER_ID BIGINT,
140
+    PRIVACY_SETTING_ID BIGINT
141
+);            
142
+ALTER TABLE PUBLIC.POST ADD CONSTRAINT PUBLIC.PK_POST PRIMARY KEY(ID);         
143
+-- 0 +/- SELECT COUNT(*) FROM PUBLIC.POST;     
144
+CREATE MEMORY TABLE PUBLIC.PRIVACY(
145
+    ID BIGINT DEFAULT (NEXT VALUE FOR PUBLIC.SYSTEM_SEQUENCE_05BAF210_F502_4348_B72D_30B4760D1D03) NOT NULL NULL_TO_DEFAULT SEQUENCE PUBLIC.SYSTEM_SEQUENCE_05BAF210_F502_4348_B72D_30B4760D1D03,
146
+    PUBLIC_VIEW BOOLEAN,
147
+    COHORT_VIEW BOOLEAN,
148
+    EMPLOYER_VIEW BOOLEAN
149
+);           
150
+ALTER TABLE PUBLIC.PRIVACY ADD CONSTRAINT PUBLIC.PK_PRIVACY PRIMARY KEY(ID);   
151
+-- 0 +/- SELECT COUNT(*) FROM PUBLIC.PRIVACY;  
152
+ALTER TABLE PUBLIC.JHI_USER ADD CONSTRAINT PUBLIC.UX_USER_LOGIN UNIQUE(LOGIN); 
153
+ALTER TABLE PUBLIC.USER_PROFILE ADD CONSTRAINT PUBLIC.UX_USER_PROFILE_USER_ID UNIQUE(USER_ID); 
154
+ALTER TABLE PUBLIC.JHI_USER ADD CONSTRAINT PUBLIC.UX_USER_EMAIL UNIQUE(EMAIL); 
155
+ALTER TABLE PUBLIC.POST ADD CONSTRAINT PUBLIC.FK_POST_POSTER_ID FOREIGN KEY(POSTER_ID) REFERENCES PUBLIC.USER_PROFILE(ID) NOCHECK;             
156
+ALTER TABLE PUBLIC.POST ADD CONSTRAINT PUBLIC.FK_POST_PRIVACY_SETTING_ID FOREIGN KEY(PRIVACY_SETTING_ID) REFERENCES PUBLIC.PRIVACY(ID) NOCHECK;
157
+ALTER TABLE PUBLIC.JHI_USER_AUTHORITY ADD CONSTRAINT PUBLIC.FK_USER_ID FOREIGN KEY(USER_ID) REFERENCES PUBLIC.JHI_USER(ID) NOCHECK;            
158
+ALTER TABLE PUBLIC.JHI_PERSISTENT_AUDIT_EVT_DATA ADD CONSTRAINT PUBLIC.FK_EVT_PERS_AUDIT_EVT_DATA FOREIGN KEY(EVENT_ID) REFERENCES PUBLIC.JHI_PERSISTENT_AUDIT_EVENT(EVENT_ID) NOCHECK;        
159
+ALTER TABLE PUBLIC.USER_PROFILE ADD CONSTRAINT PUBLIC.FK_USER_PROFILE_EMPLOYER_ID FOREIGN KEY(EMPLOYER_ID) REFERENCES PUBLIC.EMPLOYER(ID) NOCHECK;             
160
+ALTER TABLE PUBLIC.USER_PROFILE ADD CONSTRAINT PUBLIC.FK_USER_PROFILE_COHORT_ID FOREIGN KEY(COHORT_ID) REFERENCES PUBLIC.COHORT(ID) NOCHECK;   
161
+ALTER TABLE PUBLIC.USER_PROFILE ADD CONSTRAINT PUBLIC.FK_USER_PROFILE_USER_ID FOREIGN KEY(USER_ID) REFERENCES PUBLIC.JHI_USER(ID) NOCHECK;     
162
+ALTER TABLE PUBLIC.JHI_USER_AUTHORITY ADD CONSTRAINT PUBLIC.FK_AUTHORITY_NAME FOREIGN KEY(AUTHORITY_NAME) REFERENCES PUBLIC.JHI_AUTHORITY(NAME) NOCHECK;