Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MOSIP-33046: Added required scripts for kernel-salt-generator #1894

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions db_scripts/mosip_regprc/ddl/regprc-batch-fk.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

CREATE SEQUENCE regprc.BATCH_STEP_EXECUTION_SEQ MAXVALUE 9223372036854775807 NO CYCLE;
CREATE SEQUENCE regprc.BATCH_JOB_EXECUTION_SEQ MAXVALUE 9223372036854775807 NO CYCLE;
CREATE SEQUENCE regprc.BATCH_JOB_SEQ MAXVALUE 9223372036854775807 NO CYCLE;

-- grants to access all sequences
GRANT usage, SELECT ON ALL SEQUENCES
IN SCHEMA regprc
TO masteruser;
23 changes: 23 additions & 0 deletions db_scripts/mosip_regprc/ddl/regprc-batch_job_execution.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
-- Table: regprc.batch_job_execution

-- DROP TABLE regprc.batch_job_execution;

CREATE TABLE regprc.batch_job_execution
(
JOB_EXECUTION_ID BIGINT NOT NULL PRIMARY KEY ,
VERSION BIGINT ,
JOB_INSTANCE_ID BIGINT NOT NULL,
CREATE_TIME TIMESTAMP NOT NULL,
START_TIME TIMESTAMP DEFAULT NULL ,
END_TIME TIMESTAMP DEFAULT NULL ,
STATUS VARCHAR(10) ,
EXIT_CODE VARCHAR(2500) ,
EXIT_MESSAGE VARCHAR(2500) ,
LAST_UPDATED TIMESTAMP,
constraint JOB_INST_EXEC_FK foreign key (JOB_INSTANCE_ID)
references BATCH_JOB_INSTANCE(JOB_INSTANCE_ID)
)
WITH (
OIDS = FALSE
);

15 changes: 15 additions & 0 deletions db_scripts/mosip_regprc/ddl/regprc-batch_job_execution_context.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
-- Table: regprc.batch_job_execution_context

-- DROP TABLE regprc.batch_job_execution_context;

CREATE TABLE regprc.batch_job_execution_context
(
JOB_EXECUTION_ID BIGINT NOT NULL PRIMARY KEY,
SHORT_CONTEXT VARCHAR(2500) NOT NULL,
SERIALIZED_CONTEXT TEXT ,
constraint JOB_EXEC_CTX_FK foreign key (JOB_EXECUTION_ID)
references BATCH_JOB_EXECUTION(JOB_EXECUTION_ID)
)
WITH (
OIDS = FALSE
);
19 changes: 19 additions & 0 deletions db_scripts/mosip_regprc/ddl/regprc-batch_job_execution_param.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
-- Table: regprc.batch_job_execution_params

-- DROP TABLE regprc.batch_job_execution_params;

CREATE TABLE regprc.batch_job_execution_params
(
JOB_EXECUTION_ID BIGINT NOT NULL ,
PARAMETER_NAME VARCHAR(100) NOT NULL ,
PARAMETER_TYPE VARCHAR(100) NOT NULL ,
PARAMETER_VALUE VARCHAR(2500) ,
IDENTIFYING CHAR(1) NOT NULL ,
constraint JOB_EXEC_PARAMS_FK foreign key (JOB_EXECUTION_ID)
references BATCH_JOB_EXECUTION(JOB_EXECUTION_ID)
)
WITH (
OIDS = FALSE
)
;

18 changes: 18 additions & 0 deletions db_scripts/mosip_regprc/ddl/regprc-batch_job_instance.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
-- Table: regprc.batch_job_instance

-- DROP TABLE regprc.batch_job_instance;

CREATE TABLE regprc.batch_job_instance
(
JOB_INSTANCE_ID BIGINT NOT NULL PRIMARY KEY ,
VERSION BIGINT ,
JOB_NAME VARCHAR(100) NOT NULL,
JOB_KEY VARCHAR(32) NOT NULL,
constraint JOB_INST_UN unique (JOB_NAME, JOB_KEY)
)
WITH (
OIDS = FALSE
)
;


31 changes: 31 additions & 0 deletions db_scripts/mosip_regprc/ddl/regprc-batch_step_execution.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
-- Table: regprc.batch_step_execution

-- DROP TABLE regprc.batch_step_execution;

CREATE TABLE regprc.batch_step_execution
(
STEP_EXECUTION_ID BIGINT NOT NULL PRIMARY KEY ,
VERSION BIGINT NOT NULL,
STEP_NAME VARCHAR(100) NOT NULL,
JOB_EXECUTION_ID BIGINT NOT NULL,
CREATE_TIME TIMESTAMP NOT NULL,
START_TIME TIMESTAMP DEFAULT NULL ,
END_TIME TIMESTAMP DEFAULT NULL ,
STATUS VARCHAR(10) ,
COMMIT_COUNT BIGINT ,
READ_COUNT BIGINT ,
FILTER_COUNT BIGINT ,
WRITE_COUNT BIGINT ,
READ_SKIP_COUNT BIGINT ,
WRITE_SKIP_COUNT BIGINT ,
PROCESS_SKIP_COUNT BIGINT ,
ROLLBACK_COUNT BIGINT ,
EXIT_CODE VARCHAR(2500) ,
EXIT_MESSAGE VARCHAR(2500) ,
LAST_UPDATED TIMESTAMP,
constraint JOB_EXEC_STEP_FK foreign key (JOB_EXECUTION_ID)
references BATCH_JOB_EXECUTION(JOB_EXECUTION_ID)
)
WITH (
OIDS = FALSE
);
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
-- Table: regprc.batch_step_execution_context

-- DROP TABLE regprc.batch_step_execution_context;

CREATE TABLE regprc.batch_step_execution_context
(
STEP_EXECUTION_ID BIGINT NOT NULL PRIMARY KEY,
SHORT_CONTEXT VARCHAR(2500) NOT NULL,
SERIALIZED_CONTEXT TEXT ,
constraint STEP_EXEC_CTX_FK foreign key (STEP_EXECUTION_ID)
references BATCH_STEP_EXECUTION(STEP_EXECUTION_ID)

)
WITH (
OIDS = FALSE
);
16 changes: 16 additions & 0 deletions db_upgrade_scripts/mosip_regprc/sql/1.2.0.1_to_1.2.1_rollback.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
\c mosip_regprc

REASSIGN OWNED BY postgres TO sysadmin;

GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA regprc TO sysadmin;

DROP TABLE IF EXISTS regprc.batch_job_execution CASCADE;
DROP TABLE IF EXISTS regprc.batch_job_execution_context CASCADE;
DROP TABLE IF EXISTS regprc.batch_job_execution_params CASCADE;
DROP TABLE IF EXISTS regprc.batch_job_instance CASCADE;
DROP TABLE IF EXISTS regprc.batch_step_execution CASCADE;
DROP TABLE IF EXISTS regprc.batch_step_execution_context CASCADE;

DROP SEQUENCE BATCH_STEP_EXECUTION_SEQ;
DROP SEQUENCE BATCH_JOB_EXECUTION_SEQ;
DROP SEQUENCE BATCH_JOB_SEQ;
91 changes: 91 additions & 0 deletions db_upgrade_scripts/mosip_regprc/sql/1.2.0.1_to_1.2.1_upgrade.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
\c mosip_regprc

REASSIGN OWNED BY sysadmin TO postgres;

REVOKE ALL PRIVILEGES ON ALL TABLES IN SCHEMA regprc FROM regprcuser;

REVOKE ALL PRIVILEGES ON ALL TABLES IN SCHEMA regprc FROM sysadmin;

GRANT SELECT, INSERT, TRUNCATE, REFERENCES, UPDATE, DELETE ON ALL TABLES IN SCHEMA regprc TO regprcuser;

GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA regprc TO postgres;

----------------------------------------------Multiple table level changes on regprc db-------------------------------------------------------

CREATE TABLE regprc.batch_job_execution(
JOB_EXECUTION_ID BIGINT NOT NULL PRIMARY KEY ,
VERSION BIGINT ,
JOB_INSTANCE_ID BIGINT NOT NULL,
CREATE_TIME TIMESTAMP NOT NULL,
START_TIME TIMESTAMP DEFAULT NULL ,
END_TIME TIMESTAMP DEFAULT NULL ,
STATUS VARCHAR(10) ,
EXIT_CODE VARCHAR(2500) ,
EXIT_MESSAGE VARCHAR(2500) ,
LAST_UPDATED TIMESTAMP,
constraint JOB_INST_EXEC_FK foreign key (JOB_INSTANCE_ID)
references BATCH_JOB_INSTANCE(JOB_INSTANCE_ID)
);

CREATE TABLE regprc.batch_job_execution_context(
JOB_EXECUTION_ID BIGINT NOT NULL PRIMARY KEY,
SHORT_CONTEXT VARCHAR(2500) NOT NULL,
SERIALIZED_CONTEXT TEXT ,
constraint JOB_EXEC_CTX_FK foreign key (JOB_EXECUTION_ID)
references BATCH_JOB_EXECUTION(JOB_EXECUTION_ID)
);

CREATE TABLE regprc.batch_job_execution_params(
JOB_EXECUTION_ID BIGINT NOT NULL ,
PARAMETER_NAME VARCHAR(100) NOT NULL ,
PARAMETER_TYPE VARCHAR(100) NOT NULL ,
PARAMETER_VALUE VARCHAR(2500) ,
IDENTIFYING CHAR(1) NOT NULL ,
constraint JOB_EXEC_PARAMS_FK foreign key (JOB_EXECUTION_ID)
references BATCH_JOB_EXECUTION(JOB_EXECUTION_ID)
);

CREATE TABLE regprc.batch_job_instance(
JOB_INSTANCE_ID BIGINT NOT NULL PRIMARY KEY ,
VERSION BIGINT ,
JOB_NAME VARCHAR(100) NOT NULL,
JOB_KEY VARCHAR(32) NOT NULL,
constraint JOB_INST_UN unique (JOB_NAME, JOB_KEY)
);

CREATE TABLE regprc.batch_step_execution(
STEP_EXECUTION_ID BIGINT NOT NULL PRIMARY KEY ,
VERSION BIGINT NOT NULL,
STEP_NAME VARCHAR(100) NOT NULL,
JOB_EXECUTION_ID BIGINT NOT NULL,
CREATE_TIME TIMESTAMP NOT NULL,
START_TIME TIMESTAMP DEFAULT NULL ,
END_TIME TIMESTAMP DEFAULT NULL ,
STATUS VARCHAR(10) ,
COMMIT_COUNT BIGINT ,
READ_COUNT BIGINT ,
FILTER_COUNT BIGINT ,
WRITE_COUNT BIGINT ,
READ_SKIP_COUNT BIGINT ,
WRITE_SKIP_COUNT BIGINT ,
PROCESS_SKIP_COUNT BIGINT ,
ROLLBACK_COUNT BIGINT ,
EXIT_CODE VARCHAR(2500) ,
EXIT_MESSAGE VARCHAR(2500) ,
LAST_UPDATED TIMESTAMP,
constraint JOB_EXEC_STEP_FK foreign key (JOB_EXECUTION_ID)
references BATCH_JOB_EXECUTION(JOB_EXECUTION_ID)
);

CREATE TABLE regprc.batch_step_execution_context(
STEP_EXECUTION_ID BIGINT NOT NULL PRIMARY KEY,
SHORT_CONTEXT VARCHAR(2500) NOT NULL,
SERIALIZED_CONTEXT TEXT ,
constraint STEP_EXEC_CTX_FK foreign key (STEP_EXECUTION_ID)
references BATCH_STEP_EXECUTION(STEP_EXECUTION_ID)

);

CREATE SEQUENCE BATCH_STEP_EXECUTION_SEQ MAXVALUE 9223372036854775807 NO CYCLE;
CREATE SEQUENCE BATCH_JOB_EXECUTION_SEQ MAXVALUE 9223372036854775807 NO CYCLE;
CREATE SEQUENCE BATCH_JOB_SEQ MAXVALUE 9223372036854775807 NO CYCLE;
Loading