summaryrefslogtreecommitdiff
path: root/scripts/prepare_postgres_fdw.sh
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-09-13 13:26:31 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-09-13 13:26:31 +0000
commitb7dfe2ae4054aa40e15182fd3c6cb7dd39f131db (patch)
tree5ab080ca9cadeb6cd9578bf301e4e9e8810bed9e /scripts/prepare_postgres_fdw.sh
parent25cb337cf12438169f1b14bc5dace8a06a7356e3 (diff)
downloadgitlab-ce-b7dfe2ae4054aa40e15182fd3c6cb7dd39f131db.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'scripts/prepare_postgres_fdw.sh')
-rwxr-xr-xscripts/prepare_postgres_fdw.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/scripts/prepare_postgres_fdw.sh b/scripts/prepare_postgres_fdw.sh
new file mode 100755
index 00000000000..69442d2881b
--- /dev/null
+++ b/scripts/prepare_postgres_fdw.sh
@@ -0,0 +1,15 @@
+#!/bin/bash
+
+psql -h postgres -U postgres gitlabhq_geo_test <<EOF
+CREATE EXTENSION postgres_fdw;
+CREATE SERVER gitlab_secondary FOREIGN DATA WRAPPER postgres_fdw OPTIONS (host 'localhost', dbname 'gitlabhq_test');
+CREATE USER MAPPING FOR current_user SERVER gitlab_secondary OPTIONS (user 'postgres', password '');
+CREATE SCHEMA gitlab_secondary;
+IMPORT FOREIGN SCHEMA public FROM SERVER gitlab_secondary INTO gitlab_secondary;
+GRANT USAGE ON FOREIGN SERVER gitlab_secondary TO current_user;
+EOF
+
+# Ensure the FDW setting is enabled
+sed -i '/fdw:/d' config/database_geo.yml
+sed -i '/gitlabhq_geo_test/a\
+\ \ fdw: true' config/database_geo.yml