File tree 3 files changed +39
-6
lines changed
.github/actions/database-migration-image
3 files changed +39
-6
lines changed Original file line number Diff line number Diff line change 1
1
# Variation specific to the deploy environment will go here
2
- ARG IMAGE
2
+ ARG IMAGE=ghcr.io/hydrologicengineeringcenter/cwms-database/cwms/schema_installer:latest-dev
3
3
FROM ${IMAGE}
4
4
5
5
COPY entry.sh /
Original file line number Diff line number Diff line change 1
- -- TODO; need to update cdk setup before this is useful
2
- -- File here created as placeholder and reminder.
1
+ set define on
2
+ @/ tmp/ cda- user- info
3
+
4
+ begin
5
+ -- create user
6
+ cwms_sec .add_cwms_user (' &&cda_user' , NULL , ' HQ' );
7
+ -- set permissions for all offices
8
+ for ofc in (select office_id from av_office where office_id not in (' CWMS' , ' UNK' ))
9
+ loop
10
+ cwms_sec .add_user_to_group (' &&cda_user' ,' All Users' , ofc .office_id );
11
+ cwms_sec .add_user_to_group (' &&cda_user' ,' CWMS Users' , ofc .office_id );
12
+ cwms_sec .add_user_to_group (' &&cda_user' ,' CWMS DBA Users' , ofc .office_id );
13
+ cwms_sec .add_user_to_group (' &&cda_user' ,' CWMS User Admins' , ofc .office_id );
14
+ cwms_sec .add_user_to_group (' &&cda_user' ,' CWMS PD Users' , ofc .office_id );
15
+ end loop;
16
+ end;
17
+ /
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
3
- # STOP GAP, need to reset the migration container mappings
4
- export BUILDUSER_PASSWORD=$SYS_PASSWORD
5
- export TEST_ACCOUNT=" -notestaccount"
3
+ cat > /tmp/create-app-user.sql << EOF
4
+ declare
5
+ user_count integer;
6
+ begin
7
+ select count(*) into user_count from dba_users where username='&1';
8
+ if (user_count = 0) then
9
+ execute immediate 'create user &1 identified by "&2"';
10
+ else
11
+ execute immediate 'alter user &1 identified by "&2"';
12
+ end if;
13
+ end;
14
+ /
15
+ EOF
16
+
17
+ cat > /tmp/cda-user-info.sql << EOF
18
+ define cda_user='$CDA_USERNAME ';
19
+ EOF
20
+
21
+ # Create app user first, one of the migration steps is to update the "cwms user" information for that user
22
+
23
+ sqlplus $BUILDUSER /$BUILDUSER_PASSWORD @$DB_HOST_PORT$DB_NAME @/tmp/create-app-user " $CDA_USERNAME " " $CDA_PASSWORD "
6
24
7
25
exec $*
You can’t perform that action at this time.
0 commit comments