-
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.
Browse files
Browse the repository at this point in the history
* CB-3834 Secret manager database schema * CB-3834 add credentials storage flat to teams * CB-3834 subject based secrets --------- Co-authored-by: Serge Rider <[email protected]> Co-authored-by: kseniaguzeeva <[email protected]>
- Loading branch information
1 parent
71a6104
commit a2094a4
Showing
5 changed files
with
122 additions
and
29 deletions.
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
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
29 changes: 29 additions & 0 deletions
29
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,29 @@ | ||
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_AUTH_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; | ||
|
||
ALTER TABLE {table_prefix}CB_AUTH_SUBJECT | ||
ADD COLUMN IS_SECRET_STORAGE CHAR(1) DEFAULT 'Y' NOT NULL; |
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
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