-
Notifications
You must be signed in to change notification settings - Fork 27
/
certify_init.sql
72 lines (62 loc) · 3.82 KB
/
certify_init.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
CREATE DATABASE inji_certify
ENCODING = 'UTF8'
LC_COLLATE = 'en_US.UTF-8'
LC_CTYPE = 'en_US.UTF-8'
TABLESPACE = pg_default
OWNER = postgres
TEMPLATE = template0;
COMMENT ON DATABASE inji_certify IS 'certify related data is stored in this database';
\c inji_certify postgres
DROP SCHEMA IF EXISTS certify CASCADE;
CREATE SCHEMA certify;
ALTER SCHEMA certify OWNER TO postgres;
ALTER DATABASE inji_certify SET search_path TO certify,pg_catalog,public;
CREATE TABLE certify.key_alias(
id character varying(36) NOT NULL,
app_id character varying(36) NOT NULL,
ref_id character varying(128),
key_gen_dtimes timestamp,
key_expire_dtimes timestamp,
status_code character varying(36),
lang_code character varying(3),
cr_by character varying(256) NOT NULL,
cr_dtimes timestamp NOT NULL,
upd_by character varying(256),
upd_dtimes timestamp,
is_deleted boolean DEFAULT FALSE,
del_dtimes timestamp,
cert_thumbprint character varying(100),
uni_ident character varying(50),
CONSTRAINT pk_keymals_id PRIMARY KEY (id),
CONSTRAINT uni_ident_const UNIQUE (uni_ident)
);
CREATE TABLE certify.key_policy_def(
app_id character varying(36) NOT NULL,
key_validity_duration smallint,
is_active boolean NOT NULL,
pre_expire_days smallint,
access_allowed character varying(1024),
cr_by character varying(256) NOT NULL,
cr_dtimes timestamp NOT NULL,
upd_by character varying(256),
upd_dtimes timestamp,
is_deleted boolean DEFAULT FALSE,
del_dtimes timestamp,
CONSTRAINT pk_keypdef_id PRIMARY KEY (app_id)
);
CREATE TABLE certify.key_store(
id character varying(36) NOT NULL,
master_key character varying(36) NOT NULL,
private_key character varying(2500) NOT NULL,
certificate_data character varying NOT NULL,
cr_by character varying(256) NOT NULL,
cr_dtimes timestamp NOT NULL,
upd_by character varying(256),
upd_dtimes timestamp,
is_deleted boolean DEFAULT FALSE,
del_dtimes timestamp,
CONSTRAINT pk_keystr_id PRIMARY KEY (id)
);
INSERT INTO certify.KEY_POLICY_DEF(APP_ID,KEY_VALIDITY_DURATION,PRE_EXPIRE_DAYS,ACCESS_ALLOWED,IS_ACTIVE,CR_BY,CR_DTIMES) VALUES('ROOT', 2920, 1125, 'NA', true, 'mosipadmin', now());
INSERT INTO certify.KEY_POLICY_DEF(APP_ID,KEY_VALIDITY_DURATION,PRE_EXPIRE_DAYS,ACCESS_ALLOWED,IS_ACTIVE,CR_BY,CR_DTIMES) VALUES('CERTIFY_SERVICE', 1095, 50, 'NA', true, 'mosipadmin', now());
INSERT INTO certify.KEY_POLICY_DEF(APP_ID,KEY_VALIDITY_DURATION,PRE_EXPIRE_DAYS,ACCESS_ALLOWED,IS_ACTIVE,CR_BY,CR_DTIMES) VALUES('CERTIFY_PARTNER', 1095, 50, 'NA', true, 'mosipadmin', now());