Skip to content

Commit ffa9f24

Browse files
Merge pull request #18 from yuchi-chang/main
fix: solve SSMS connect will change multi-db to single-db issue
2 parents 1053f72 + f499a99 commit ffa9f24

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

start.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ if [ ! -f ${BABELFISH_DATA}/postgresql.conf ]; then
3737
allow_system_table_mods = on
3838
shared_preload_libraries = 'babelfishpg_tds'
3939
babelfishpg_tds.listen_addresses = '*'
40+
babelfishpg_tsql.migration_mode = '${MIGRATION_MODE}'
4041
EOF
4142
./pg_ctl -D ${BABELFISH_DATA}/ start
4243
./psql -c "CREATE USER ${USERNAME} WITH SUPERUSER CREATEDB CREATEROLE PASSWORD '${PASSWORD}' INHERIT;" \
@@ -47,10 +48,12 @@ if [ ! -f ${BABELFISH_DATA}/postgresql.conf ]; then
4748
-c "GRANT ALL ON SCHEMA sys to ${USERNAME};" \
4849
-c "ALTER USER ${USERNAME} CREATEDB;" \
4950
-c "ALTER SYSTEM SET babelfishpg_tsql.database_name = '${DATABASE}';" \
50-
-c "SELECT pg_reload_conf();" \
51-
-c "ALTER DATABASE ${DATABASE} SET babelfishpg_tsql.migration_mode = '${MIGRATION_MODE}';" \
52-
-c "SELECT pg_reload_conf();" \
51+
-c "SELECT pg_reload_conf();"
52+
53+
# After reloading to apply the migration_mode setting in postgresql.conf, initialize a new connection.
54+
./psql -d ${DATABASE} \
5355
-c "CALL SYS.INITIALIZE_BABELFISH('${USERNAME}');"
56+
5457
./pg_ctl -D ${BABELFISH_DATA}/ stop
5558
fi
5659

0 commit comments

Comments
 (0)