Browse Source

added more sql scripts and a shell script to load all data

osh_api_impl
Leonid Bossis 3 years ago committed by Jonathan Christison
parent
commit
136f8de2f0
  1. 12
      schema/load_all.sh
  2. 6
      schema/load_archive.sql
  3. 6
      schema/load_results.sql
  4. 12
      schema/load_scans.sql
  5. 2
      schema/schema.sql

12
schema/load_all.sh

@ -0,0 +1,12 @@
#!/bin/sh
set +e
psql -U $POSTGRESQL_USER -h localhost -p $POSTGRESQL_PORT -a -f $HOME/tmp/osh/covscanrest/schema/schema.sql
psql -U $POSTGRESQL_USER -h localhost -p $POSTGRESQL_PORT -a -f $HOME/tmp/osh/covscanrest/schema/load_offerings.sql
psql -U $POSTGRESQL_USER -h localhost -p $POSTGRESQL_PORT -a -f $HOME/tmp/osh/covscanrest/schema/load_brewscans.sql
psql -U $POSTGRESQL_USER -h localhost -p $POSTGRESQL_PORT -a -f $HOME/tmp/osh/covscanrest/schema/load_pncscans.sql
psql -U $POSTGRESQL_USER -h localhost -p $POSTGRESQL_PORT -a -f $HOME/tmp/osh/covscanrest/schema/load_gitscans.sql
psql -U $POSTGRESQL_USER -h localhost -p $POSTGRESQL_PORT -a -f $HOME/tmp/osh/covscanrest/schema/load_results.sql
psql -U $POSTGRESQL_USER -h localhost -p $POSTGRESQL_PORT -a -f $HOME/tmp/osh/covscanrest/schema/load_scans.sql
psql -U $POSTGRESQL_USER -h localhost -p $POSTGRESQL_PORT -a -f $HOME/tmp/osh/covscanrest/schema/load_archive.sql

6
schema/load_archive.sql

@ -14,5 +14,7 @@ CREATE TABLE IF NOT EXISTS osh.archive(
FOREIGN KEY (results) REFERENCES osh.results(results_id)
);
INSERT INTO osh.archive (scan_id,offering_id,event_id,is_managed_service,component_list)
VALUES(1,'product-id-1','event-id-1',true,' ');
INSERT INTO osh.archive (scan_id,offering_id,event_id,is_managed_service,component_list,datetime,owner,results,status)
VALUES(1,'ansible-automation-platform','event-id-1',true,'publisher','2023-06-22 16:04:04.816453','RedHat',1,'COMPLETED');
INSERT INTO osh.archive (scan_id,offering_id,event_id,is_managed_service,component_list,datetime,owner,results,status)
VALUES(2,'eclipse-vertx','event-id-1',true,'publisher','2023-06-22 16:04:04.816453','RedHat',2,'COMPLETED');

6
schema/load_results.sql

@ -7,3 +7,9 @@ CREATE TABLE IF NOT EXISTS osh.results(
PRIMARY KEY (results_id)
);
INSERT INTO osh.results (results_id,datetime,state,logs)
VALUES(1,'2023-06-22 16:04:04.816453',true,bytea('/home/lbossis/osh/postgres/logs/bulk-load.log.hex'));
INSERT INTO osh.results (results_id,datetime,state,logs)
VALUES(2,'2023-06-22 16:04:04.816453',true,bytea('/home/lbossis/osh/postgres/logs/inp.log.hex'));
INSERT INTO osh.results (results_id,datetime,state,logs)
VALUES(3,'2023-06-22 16:04:04.816453',true,bytea('/home/lbossis/osh/postgres/logs/bulk-load.log'));

12
schema/load_scans.sql

@ -14,3 +14,15 @@ CREATE TABLE IF NOT EXISTS osh.scans(
FOREIGN KEY (results) REFERENCES osh.results(results_id)
);
INSERT INTO osh.scans (scan_id,offering_id,event_id,is_managed_service,component_list,datetime,owner,results,status)
VALUES(1,'ansible-automation-platform','event-id-1',true,'publisher','2023-06-22 16:04:04.816453','RedHat',1,'PENDING');
INSERT INTO osh.scans (scan_id,offering_id,event_id,is_managed_service,component_list,datetime,owner,results,status)
VALUES(2,'ansible-automation-platform','event-id-1',true,'publisher','2023-06-22 16:04:04.816453','RedHat',1,'IN PROGRESS');
INSERT INTO osh.scans (scan_id,offering_id,event_id,is_managed_service,component_list,datetime,owner,results,status)
VALUES(3,'ansible-automation-platform','event-id-1',true,'publisher','2023-06-22 16:04:04.816453','RedHat',1,'COMPLETED');
INSERT INTO osh.scans (scan_id,offering_id,event_id,is_managed_service,component_list,datetime,owner,results,status)
VALUES(4,'eclipse-vertx','event-id-1',true,'publisher','2023-06-22 16:04:04.816453','RedHat',2,'PENDING');
INSERT INTO osh.scans (scan_id,offering_id,event_id,is_managed_service,component_list,datetime,owner,results,status)
VALUES(5,'eclipse-vertx','event-id-1',true,'publisher','2023-06-22 16:04:04.816453','RedHat',2,'IN PROGRESS');
INSERT INTO osh.scans (scan_id,offering_id,event_id,is_managed_service,component_list,datetime,owner,results,status)
VALUES(6,'eclipse-vertx','event-id-1',true,'publisher','2023-06-22 16:04:04.816453','RedHat',2,'COMPLETED');

2
schema/schema.sql

@ -2,6 +2,8 @@ CREATE SCHEMA osh;
GRANT USAGE ON SCHEMA osh TO postgres;
SET SEARCH_PATH TO osh;
CREATE TABLE IF NOT EXISTS osh.offerings(
offering_id VARCHAR(100),
description VARCHAR(200),

Loading…
Cancel
Save