-
Notifications
You must be signed in to change notification settings - Fork 392
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CB-3834 Secret manager database schema
- Loading branch information
1 parent
8df248b
commit b6feb13
Showing
3 changed files
with
49 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
server/bundles/io.cloudbeaver.service.security/db/cb_schema_update_16.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
CREATE TABLE {table_prefix}CB_SUBJECT_SECRETS | ||
( | ||
SUBJECT_ID VARCHAR(128) NOT NULL, | ||
SECRET_ID VARCHAR(255) NOT NULL, | ||
|
||
PROJECT_ID VARCHAR(128), | ||
OBJECT_TYPE VARCHAR(32), | ||
OBJECT_ID VARCHAR(128), | ||
|
||
SECRET_VALUE TEXT NOT NULL, | ||
|
||
ENCODING_TYPE VARCHAR(32) DEFAULT 'PLAINTEXT' NOT NULL, | ||
CREATE_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL, | ||
UPDATE_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL, | ||
|
||
PRIMARY KEY (SUBJECT_ID, SECRET_ID), | ||
FOREIGN KEY (SUBJECT_ID) REFERENCES {table_prefix}CB_SUBJECT (SUBJECT_ID) ON DELETE CASCADE | ||
); | ||
|
||
CREATE INDEX IDX_SUBJECT_SECRETS_PROJECT ON {table_prefix}CB_SUBJECT_SECRETS (PROJECT_ID,SUBJECT_ID); | ||
CREATE INDEX IDX_SUBJECT_SECRETS_OBJECT ON {table_prefix}CB_SUBJECT_SECRETS (PROJECT_ID,OBJECT_TYPE,OBJECT_ID); | ||
|
||
INSERT INTO {table_prefix}CB_SUBJECT_SECRETS (SUBJECT_ID, SECRET_ID, SECRET_VALUE, ENCODING_TYPE, CREATE_TIME, UPDATE_TIME) | ||
SELECT USER_ID, SECRET_ID, SECRET_VALUE, ENCODING_TYPE, UPDATE_TIME, UPDATE_TIME FROM {table_prefix}CB_USER_SECRETS; | ||
|
||
DROP TABLE {table_prefix}CB_USER_SECRETS; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters