Skip to content

Commit b569962

Browse files
v-kerimovo-kopysov
andauthored
fix: Fixed problems with singlescan and decreased .sql files count (#353)
* Fixed problems with singlescan and decreased .sql files count Signed-off-by: Vasyl Kerimov <[email protected]> * Password removed Signed-off-by: Vasyl Kerimov <[email protected]> * Fixes to database_dump.sql Signed-off-by: Vasyl Kerimov <[email protected]> * Added relationships to the db table definitions Signed-off-by: Vasyl Kerimov <[email protected]> * Fixed problems with singlescan and decreased .sql files count Signed-off-by: Vasyl Kerimov <[email protected]> * Password removed Signed-off-by: Vasyl Kerimov <[email protected]> * Fixes to database_dump.sql Signed-off-by: Vasyl Kerimov <[email protected]> * Added relationships to the db table definitions Signed-off-by: Vasyl Kerimov <[email protected]> * Typo fixed Signed-off-by: Vasyl Kerimov <[email protected]> --------- Signed-off-by: Vasyl Kerimov <[email protected]> Co-authored-by: Oleg Kopysov <[email protected]>
1 parent c126a47 commit b569962

File tree

4 files changed

+118
-279
lines changed

4 files changed

+118
-279
lines changed
Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,22 @@
1+
debug=false
2+
logging.level.org.hibernate=error
3+
spring.sql.init.mode=always
4+
spring.datasource.initialization-mode=always
5+
spring.h2.console.enabled=false
6+
spring.sql.init.platform=h2
17
# DB Configuration
28
# Whether to enable logging of SQL statements.
3-
spring.jpa.show-sql=true
9+
spring.jpa.show-sql=false
410

5-
spring.datasource.url=jdbc:h2:mem:test;DATABASE_TO_UPPER=false;MODE=MySQL;NON_KEYWORDS=USER
11+
spring.sql.init.data-locations=classpath*:database_dump.sql
12+
13+
spring.datasource.url=jdbc:h2:mem:singlescan;DATABASE_TO_UPPER=false;MODE=MySQL;NON_KEYWORDS=USER
614
spring.datasource.username=
715
spring.datasource.password=
16+
17+
spring.jpa.properties.hibernate.format_sql=false
18+
spring.jpa.properties.hibernate.use_sql_comments=false
19+
spring.jpa.properties.hibernate.show_sql=false
20+
21+
spring.jpa.hibernate.ddl-auto=create-drop
22+
spring.jpa.defer-datasource-initialization=true

src/main/resources/data-h2.sql

Lines changed: 0 additions & 1 deletion
This file was deleted.

src/main/resources/database_dump.sql

Lines changed: 101 additions & 190 deletions
Original file line numberDiff line numberDiff line change
@@ -1,190 +1,101 @@
1-
CREATE DATABASE IF NOT EXISTS `lpvs` /*!40100 DEFAULT CHARACTER SET latin1 */;
2-
USE `lpvs`;
3-
-- MySQL dump 10.13 Distrib 8.0.26, for Win64 (x86_64)
4-
--
5-
-- Host: 127.0.0.1 Database: lpvs
6-
-- ------------------------------------------------------
7-
-- Server version 5.6.51-log
8-
9-
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
10-
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
11-
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
12-
/*!50503 SET NAMES utf8 */;
13-
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
14-
/*!40103 SET TIME_ZONE='+00:00' */;
15-
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
16-
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
17-
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
18-
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
19-
20-
21-
--
22-
-- Table structure for table `licenses`
23-
--
24-
25-
DROP TABLE IF EXISTS `licenses`;
26-
/*!40101 SET @saved_cs_client = @@character_set_client */;
27-
/*!50503 SET character_set_client = utf8mb4 */;
28-
CREATE TABLE `licenses` (
29-
`id` bigint(20) NOT NULL AUTO_INCREMENT,
30-
`license_usage` varchar(255) DEFAULT NULL,
31-
`license_name` varchar(255) NOT NULL,
32-
`license_spdx` varchar(255) NOT NULL,
33-
`license_alternative_names` longtext DEFAULT NULL,
34-
PRIMARY KEY (`id`),
35-
UNIQUE KEY `spdx_id` (`license_spdx`)
36-
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;
37-
/*!40101 SET character_set_client = @saved_cs_client */;
38-
39-
--
40-
-- Dumping data for table `licenses`
41-
--
42-
43-
LOCK TABLES `licenses` WRITE;
44-
/*!40000 ALTER TABLE `licenses` DISABLE KEYS */;
45-
INSERT INTO `licenses` VALUES (1,'PERMITTED','Apache License 2.0','Apache-2.0',''),(2,'PROHIBITED','GNU General Public License v3.0 only','GPL-3.0-only',''),(3,'PERMITTED','OpenSSL License','OpenSSL',''),(4,'RESTRICTED','GNU Lesser General Public License v2.1 or later','GPL-2.0-or-later',''),(5,'PERMITTED','MIT License','MIT','');
46-
/*!40000 ALTER TABLE `licenses` ENABLE KEYS */;
47-
UNLOCK TABLES;
48-
49-
--
50-
-- Table structure for table `license_conflicts`
51-
--
52-
53-
DROP TABLE IF EXISTS `license_conflicts`;
54-
/*!40101 SET @saved_cs_client = @@character_set_client */;
55-
/*!50503 SET character_set_client = utf8mb4 */;
56-
CREATE TABLE `license_conflicts` (
57-
`id` bigint(20) NOT NULL AUTO_INCREMENT,
58-
`conflict_license_id` bigint(20) NOT NULL,
59-
`repository_license_id` bigint(20) NOT NULL,
60-
PRIMARY KEY (`id`),
61-
KEY `conflictlicense_idx` (`conflict_license_id`),
62-
KEY `repositorylicense_idx` (`repository_license_id`),
63-
CONSTRAINT `conflictlicense` FOREIGN KEY (`conflict_license_id`) REFERENCES `licenses` (`id`),
64-
CONSTRAINT `repositorylicense` FOREIGN KEY (`repository_license_id`) REFERENCES `licenses` (`id`)
65-
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
66-
/*!40101 SET character_set_client = @saved_cs_client */;
67-
68-
--
69-
-- Dumping data for table `license_conflicts`
70-
--
71-
72-
LOCK TABLES `license_conflicts` WRITE;
73-
/*!40000 ALTER TABLE `license_conflicts` DISABLE KEYS */;
74-
INSERT INTO `license_conflicts` VALUES (1,4,1),(2,4,3),(3,4,5);
75-
/*!40000 ALTER TABLE `license_conflicts` ENABLE KEYS */;
76-
UNLOCK TABLES;
77-
78-
--
79-
-- Table structure for table `pull_requests`
80-
--
81-
82-
DROP TABLE IF EXISTS `pull_requests`;
83-
/*!40101 SET @saved_cs_client = @@character_set_client */;
84-
/*!50503 SET character_set_client = utf8mb4 */;
85-
CREATE TABLE `pull_requests` (
86-
`id` bigint(20) NOT NULL AUTO_INCREMENT,
87-
`scan_date` datetime(6) NOT NULL,
88-
`user` varchar(255) DEFAULT NULL,
89-
`repository_name` varchar(255) NOT NULL,
90-
`url` longtext NOT NULL,
91-
`diff_url` longtext,
92-
`status` varchar(255) DEFAULT NULL,
93-
`pull_request_head` varchar(255) NOT NULL,
94-
`pull_request_base` varchar(255) NOT NULL,
95-
`sender` varchar(255) NOT NULL,
96-
PRIMARY KEY (`id`)
97-
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;
98-
/*!40101 SET character_set_client = @saved_cs_client */;
99-
100-
--
101-
-- Table structure for table `detected_license`
102-
--
103-
104-
DROP TABLE IF EXISTS `detected_license`;
105-
/*!40101 SET @saved_cs_client = @@character_set_client */;
106-
/*!50503 SET character_set_client = utf8mb4 */;
107-
CREATE TABLE `detected_license` (
108-
`id` bigint(20) NOT NULL AUTO_INCREMENT,
109-
`pull_request_id` bigint(20) DEFAULT NULL,
110-
`license_id` bigint(20) DEFAULT NULL,
111-
`conflict_id` bigint(20) DEFAULT NULL,
112-
`repository_license_id` bigint(20) DEFAULT NULL,
113-
`file_path` longtext,
114-
`match_type` varchar(255) DEFAULT NULL,
115-
`match_value` varchar(255) DEFAULT NULL,
116-
`match_lines` varchar(255) DEFAULT NULL,
117-
`component_file_path` longtext,
118-
`component_file_url` longtext,
119-
`component_name` varchar(255) DEFAULT NULL,
120-
`component_lines` varchar(255) DEFAULT NULL,
121-
`component_url` longtext,
122-
`component_version` varchar(255) DEFAULT NULL,
123-
`component_vendor` varchar(255) DEFAULT NULL,
124-
`issue` bit(1) DEFAULT NULL,
125-
PRIMARY KEY (`id`),
126-
KEY `pullrequestid_idx` (`pull_request_id`),
127-
KEY `licenseid_idx` (`license_id`),
128-
KEY `repolicenseid_idx` (`repository_license_id`),
129-
KEY `conflictid_idx` (`conflict_id`),
130-
CONSTRAINT `conflictid` FOREIGN KEY (`conflict_id`) REFERENCES `license_conflicts` (`id`),
131-
CONSTRAINT `licenseid` FOREIGN KEY (`license_id`) REFERENCES `licenses` (`id`),
132-
CONSTRAINT `pullrequestid` FOREIGN KEY (`pull_request_id`) REFERENCES `pull_requests` (`id`),
133-
CONSTRAINT `repolicenseid` FOREIGN KEY (`repository_license_id`) REFERENCES `licenses` (`id`)
134-
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;
135-
/*!40101 SET character_set_client = @saved_cs_client */;
136-
137-
--
138-
-- Table structure for table `queue`
139-
--
140-
141-
DROP TABLE IF EXISTS `queue`;
142-
/*!40101 SET @saved_cs_client = @@character_set_client */;
143-
/*!50503 SET character_set_client = utf8mb4 */;
144-
CREATE TABLE `queue` (
145-
`id` bigint(20) NOT NULL AUTO_INCREMENT,
146-
`action` bigint(20) NOT NULL,
147-
`attempts` int(11) DEFAULT '0',
148-
`scan_date` datetime(6) DEFAULT NULL,
149-
`user` varchar(255) DEFAULT NULL,
150-
`review_system_type` varchar(255) DEFAULT NULL,
151-
`repository_url` longtext,
152-
`pull_request_url` longtext,
153-
`pull_request_api_url` longtext,
154-
`pull_request_diff_url` longtext,
155-
`status_callback_url` longtext,
156-
`commit_sha` varchar(255) DEFAULT NULL,
157-
PRIMARY KEY (`id`)
158-
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=latin1;
159-
/*!40101 SET character_set_client = @saved_cs_client */;
160-
161-
--
162-
-- Table structure for table `member`
163-
--
164-
165-
DROP TABLE IF EXISTS `member`;
166-
/*!40101 SET @saved_cs_client = @@character_set_client */;
167-
/*!50503 SET character_set_client = utf8mb4 */;
168-
CREATE TABLE `member` (
169-
`id` bigint(20) PRIMARY KEY NOT NULL AUTO_INCREMENT,
170-
`email` varchar(255) NOT NULL,
171-
`name` varchar(255) NOT NULL,
172-
`nickname` varchar(255) DEFAULT NULL,
173-
`provider` varchar(10) NOT NULL,
174-
`organization` varchar(255) DEFAULT NULL,
175-
UNIQUE KEY `unq_member` (`email`,`provider`)
176-
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
177-
/*!40101 SET character_set_client = @saved_cs_client */;
178-
179-
180-
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
181-
182-
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
183-
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
184-
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
185-
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
186-
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
187-
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
188-
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
189-
190-
-- Dump completed on 2023-01-19 11:18:17
1+
CREATE SCHEMA IF NOT EXISTS lpvs;
2+
USE lpvs;
3+
4+
CREATE TABLE IF NOT EXISTS licenses (
5+
id bigint NOT NULL AUTO_INCREMENT,
6+
license_usage varchar(255) DEFAULT NULL,
7+
license_name varchar(255) NOT NULL,
8+
license_spdx varchar(255) NOT NULL,
9+
license_alternative_names longtext DEFAULT NULL,
10+
PRIMARY KEY (id),
11+
UNIQUE (license_spdx)
12+
);
13+
14+
CREATE TABLE IF NOT EXISTS license_conflicts (
15+
id bigint NOT NULL AUTO_INCREMENT,
16+
conflict_license_id bigint NOT NULL,
17+
repository_license_id bigint NOT NULL,
18+
PRIMARY KEY (id),
19+
KEY (conflict_license_id),
20+
KEY (repository_license_id),
21+
FOREIGN KEY (conflict_license_id) REFERENCES licenses (id),
22+
FOREIGN KEY (repository_license_id) REFERENCES licenses (id)
23+
);
24+
25+
CREATE TABLE IF NOT EXISTS pull_requests (
26+
id bigint NOT NULL AUTO_INCREMENT,
27+
scan_date datetime NOT NULL,
28+
user varchar(255) DEFAULT NULL,
29+
repository_name varchar(255) NOT NULL,
30+
url longtext NOT NULL,
31+
diff_url longtext,
32+
status varchar(255) DEFAULT NULL,
33+
pull_request_head varchar(255) NOT NULL,
34+
pull_request_base varchar(255) NOT NULL,
35+
sender varchar(255) NOT NULL,
36+
PRIMARY KEY (id)
37+
);
38+
39+
CREATE TABLE IF NOT EXISTS detected_license (
40+
id bigint NOT NULL AUTO_INCREMENT,
41+
pull_request_id bigint DEFAULT NULL,
42+
license_id bigint DEFAULT NULL,
43+
conflict_id bigint DEFAULT NULL,
44+
repository_license_id bigint DEFAULT NULL,
45+
file_path longtext,
46+
match_type varchar(255) DEFAULT NULL,
47+
match_value varchar(255) DEFAULT NULL,
48+
match_lines varchar(255) DEFAULT NULL,
49+
component_file_path longtext,
50+
component_file_url longtext,
51+
component_name varchar(255) DEFAULT NULL,
52+
component_lines varchar(255) DEFAULT NULL,
53+
component_url longtext,
54+
component_version varchar(255) DEFAULT NULL,
55+
component_vendor varchar(255) DEFAULT NULL,
56+
issue bit DEFAULT NULL,
57+
PRIMARY KEY (id),
58+
KEY (pull_request_id),
59+
KEY (license_id),
60+
KEY (repository_license_id),
61+
KEY (conflict_id),
62+
FOREIGN KEY (conflict_id) REFERENCES license_conflicts (id),
63+
FOREIGN KEY (license_id) REFERENCES licenses (id),
64+
FOREIGN KEY (pull_request_id) REFERENCES pull_requests (id),
65+
FOREIGN KEY (repository_license_id) REFERENCES licenses (id)
66+
);
67+
68+
CREATE TABLE IF NOT EXISTS queue (
69+
id bigint NOT NULL AUTO_INCREMENT,
70+
action bigint NOT NULL,
71+
attempts int DEFAULT '0',
72+
scan_date datetime DEFAULT NULL,
73+
user_id varchar(255) DEFAULT NULL,
74+
review_system_type varchar(255) DEFAULT NULL,
75+
repository_url longtext,
76+
pull_request_url longtext,
77+
pull_request_api_url longtext,
78+
pull_request_diff_url longtext,
79+
status_callback_url longtext,
80+
commit_sha varchar(255) DEFAULT NULL,
81+
PRIMARY KEY (id)
82+
);
83+
84+
CREATE TABLE IF NOT EXISTS member (
85+
id bigint PRIMARY KEY NOT NULL AUTO_INCREMENT,
86+
email varchar(255) NOT NULL,
87+
name varchar(255) NOT NULL,
88+
nickname varchar(255) DEFAULT NULL,
89+
provider varchar(255) NOT NULL,
90+
organization varchar(255) DEFAULT NULL,
91+
UNIQUE (email,provider)
92+
);
93+
94+
INSERT INTO licenses (license_name, license_spdx, license_usage) VALUES
95+
('GNU General Public License v3.0 only','GPL-3.0-only','PROHIBITED'),
96+
('OpenSSL License','OpenSSL','PERMITTED'),
97+
('GNU Lesser General Public License v2.0 or later','LGPL-2.0-or-later','RESTRICTED'),
98+
('MIT License', 'MIT', 'PERMITTED'),
99+
('Apache License 2.0', 'Apache-2.0', 'PERMITTED'),
100+
('GNU General Public License v2.0 only', 'GPL-2.0-only', 'RESTRICTED'),
101+
('GNU Lesser General Public License v3.0 or later', 'LGPL-3.0-or-later', 'PROHIBITED');

0 commit comments

Comments
 (0)