declapract-typescript-ehmpathy 0.20.6 → 0.20.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
"yesql": "@declapract{check.minVersion('4.1.3')}"
|
|
5
5
|
},
|
|
6
6
|
"devDependencies": {
|
|
7
|
-
"sql-code-generator": "@declapract{check.minVersion('0.9.
|
|
8
|
-
"sql-dao-generator": "@declapract{check.minVersion('0.
|
|
9
|
-
"sql-schema-control": "@declapract{check.minVersion('
|
|
10
|
-
"sql-schema-generator": "@declapract{check.minVersion('0.21.
|
|
7
|
+
"sql-code-generator": "@declapract{check.minVersion('0.9.3')}",
|
|
8
|
+
"sql-dao-generator": "@declapract{check.minVersion('0.3.1')}",
|
|
9
|
+
"sql-schema-control": "@declapract{check.minVersion('1.5.0')}",
|
|
10
|
+
"sql-schema-generator": "@declapract{check.minVersion('0.21.4')}",
|
|
11
11
|
"@types/yesql": "@declapract{check.minVersion('3.2.2')}",
|
|
12
|
-
"@types/pg": "@declapract{check.minVersion('
|
|
12
|
+
"@types/pg": "@declapract{check.minVersion('8.6.1')}"
|
|
13
13
|
},
|
|
14
14
|
"scripts": {
|
|
15
15
|
"generate:dao": "npx sql-dao-generator generate && npm run fix:format",
|
|
@@ -39,6 +39,20 @@ if [ -z $POSTGRES_ADMIN_PASSWORD ]; then
|
|
|
39
39
|
exit 1;
|
|
40
40
|
fi;
|
|
41
41
|
|
|
42
|
+
# check that the cicd password was provisioned, if in prod, since this is used to create the cicd user
|
|
43
|
+
if [ "$ENVIRONMENT" = "prod" ]; then
|
|
44
|
+
CICD_USER_PASSWORD=$(aws ssm get-parameter --name "@declapract{variable.organizationName}.@declapract{variable.projectName}.$ENVIRONMENT.database.admin.password" --with-decryption --output text --query Parameter.Value)
|
|
45
|
+
if [ -z "$CICD_USER_PASSWORD" ]; then
|
|
46
|
+
echo "\nerror: CICD_USER_PASSWORD must be provisioned with terraform before running this"
|
|
47
|
+
exit 1;
|
|
48
|
+
fi;
|
|
49
|
+
if [ "$CICD_USER_PASSWORD" = "__IGNORED__" ]; then
|
|
50
|
+
echo "\nerror: CICD_USER_PASSWORD must be set to a value other than the default of '__IGNORED__'"
|
|
51
|
+
exit 1;
|
|
52
|
+
fi;
|
|
53
|
+
fi;
|
|
54
|
+
|
|
55
|
+
|
|
42
56
|
# define the postgres connecition string
|
|
43
57
|
CLUSTER_HOST=$([ "$ENVIRONMENT" = 'prod' ] && echo "@declapract{variable.databaseClusterHost.prod}" || echo "@declapract{variable.databaseClusterHost.dev}");
|
|
44
58
|
CLUSTER_CONNECTION_STRING=postgresql://postgres:$POSTGRES_ADMIN_PASSWORD@$CLUSTER_HOST:5432
|
|
@@ -60,12 +74,18 @@ psql $SVC_DB_CONNECTION_STRING -f $INIT_SQLS_DIR/.extensions.sql
|
|
|
60
74
|
echo "\n 🔨 creating the schema..."
|
|
61
75
|
psql $SVC_DB_CONNECTION_STRING -f $INIT_SQLS_DIR/.schema.sql
|
|
62
76
|
|
|
63
|
-
echo "\n 🔨 creating the cicd user..."
|
|
64
|
-
psql $SVC_DB_CONNECTION_STRING -f $INIT_SQLS_DIR/.user.cicd.sql
|
|
65
|
-
|
|
66
77
|
if [ "$ENVIRONMENT" = "prod" ]; then
|
|
67
78
|
echo "\n 🔨 granting reads to the datalakedb user..." # only in prod env; we dont want dev's testing data in our datalake
|
|
68
79
|
psql $SVC_DB_CONNECTION_STRING -f $INIT_SQLS_DIR/.user.datalakedb.sql
|
|
69
80
|
fi;
|
|
70
81
|
|
|
82
|
+
echo "\n 🔨 creating the cicd user..."
|
|
83
|
+
CICD_USER_CREATE_SQL_PATH=$INIT_SQLS_DIR/.user.cicd.sql
|
|
84
|
+
if [ "$ENVIRONMENT" = "prod" ]; then
|
|
85
|
+
CICD_USER_CREATE_SQL_PATH_TEMP=$CICD_USER_CREATE_SQL_PATH.tmp # in prod, we must create a temp file which will have the actual password we'll use when creating the cicd user
|
|
86
|
+
cat $CICD_USER_CREATE_SQL_PATH | sed "s/__CHANG3_ME__/${CICD_USER_PASSWORD}/" > $CICD_USER_CREATE_SQL_PATH_TEMP # create the temp file w/ the actual password
|
|
87
|
+
psql $SVC_DB_CONNECTION_STRING -f $CICD_USER_CREATE_SQL_PATH_TEMP # run the temp create sql w/ the actual password
|
|
88
|
+
rm $CICD_USER_CREATE_SQL_PATH_TEMP # remove the temp file, so the password doesn't get checked in
|
|
89
|
+
else
|
|
90
|
+
psql $SVC_DB_CONNECTION_STRING -f $CICD_USER_CREATE_SQL_PATH # otherwise, we can run the file directly. no password replacement required
|
|
71
91
|
echo "\n 🎉 done"
|
package/package.json
CHANGED