Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
synapse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Timo Ley
synapse
Commits
76547356
Unverified
Commit
76547356
authored
3 years ago
by
Richard van der Hoff
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix make_full_schema to create the db with the right options and user (#9931)
parent
b65ecaff
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
changelog.d/9931.misc
+1
-0
1 addition, 0 deletions
changelog.d/9931.misc
scripts-dev/make_full_schema.sh
+10
-9
10 additions, 9 deletions
scripts-dev/make_full_schema.sh
with
11 additions
and
9 deletions
changelog.d/9931.misc
0 → 100644
+
1
−
0
View file @
76547356
Minor fixes to the `make_full_schema.sh` script.
This diff is collapsed.
Click to expand it.
scripts-dev/make_full_schema.sh
+
10
−
9
View file @
76547356
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
# It does so by having Synapse generate an up-to-date SQLite DB, then running
# It does so by having Synapse generate an up-to-date SQLite DB, then running
# synapse_port_db to convert it to Postgres. It then dumps the contents of both.
# synapse_port_db to convert it to Postgres. It then dumps the contents of both.
POSTGRES_
HOST
=
"localhost"
export
PG
HOST
=
"localhost"
POSTGRES_DB_NAME
=
"synapse_full_schema.
$$
"
POSTGRES_DB_NAME
=
"synapse_full_schema.
$$
"
SQLITE_FULL_SCHEMA_OUTPUT_FILE
=
"full.sql.sqlite"
SQLITE_FULL_SCHEMA_OUTPUT_FILE
=
"full.sql.sqlite"
...
@@ -32,7 +32,7 @@ usage() {
...
@@ -32,7 +32,7 @@ usage() {
while
getopts
"p:co:h"
opt
;
do
while
getopts
"p:co:h"
opt
;
do
case
$opt
in
case
$opt
in
p
)
p
)
POSTGRES_USERNAME
=
$OPTARG
export
PGUSER
=
$OPTARG
;;
;;
c
)
c
)
# Print all commands that are being executed
# Print all commands that are being executed
...
@@ -69,7 +69,7 @@ if [ ${#unsatisfied_requirements} -ne 0 ]; then
...
@@ -69,7 +69,7 @@ if [ ${#unsatisfied_requirements} -ne 0 ]; then
exit
1
exit
1
fi
fi
if
[
-z
"
$P
OSTGRES_USERNAME
"
]
;
then
if
[
-z
"
$P
GUSER
"
]
;
then
echo
"No postgres username supplied"
echo
"No postgres username supplied"
usage
usage
exit
1
exit
1
...
@@ -84,8 +84,9 @@ fi
...
@@ -84,8 +84,9 @@ fi
# Create the output directory if it doesn't exist
# Create the output directory if it doesn't exist
mkdir
-p
"
$OUTPUT_DIR
"
mkdir
-p
"
$OUTPUT_DIR
"
read
-rsp
"Postgres password for '
$P
OSTGRES_USERNAME
': "
POSTGRES_
PASSWORD
read
-rsp
"Postgres password for '
$P
GUSER
': "
PG
PASSWORD
echo
""
echo
""
export
PGPASSWORD
# Exit immediately if a command fails
# Exit immediately if a command fails
set
-e
set
-e
...
@@ -131,9 +132,9 @@ report_stats: false
...
@@ -131,9 +132,9 @@ report_stats: false
database:
database:
name: "psycopg2"
name: "psycopg2"
args:
args:
user: "
$P
OSTGRES_USERNAME
"
user: "
$P
GUSER
"
host: "
$P
OSTGRES_
HOST
"
host: "
$P
G
HOST
"
password: "
$P
OSTGRES_
PASSWORD
"
password: "
$P
G
PASSWORD
"
database: "
$POSTGRES_DB_NAME
"
database: "
$POSTGRES_DB_NAME
"
# Suppress the key server warning.
# Suppress the key server warning.
...
@@ -150,7 +151,7 @@ scripts-dev/update_database --database-config "$SQLITE_CONFIG"
...
@@ -150,7 +151,7 @@ scripts-dev/update_database --database-config "$SQLITE_CONFIG"
# Create the PostgreSQL database.
# Create the PostgreSQL database.
echo
"Creating postgres database..."
echo
"Creating postgres database..."
createdb
$POSTGRES_DB_NAME
createdb
--lc-collate
=
C
--lc-ctype
=
C
--template
=
template0
"
$POSTGRES_DB_NAME
"
echo
"Copying data from SQLite3 to Postgres with synapse_port_db..."
echo
"Copying data from SQLite3 to Postgres with synapse_port_db..."
if
[
-z
"
$COVERAGE
"
]
;
then
if
[
-z
"
$COVERAGE
"
]
;
then
...
@@ -181,7 +182,7 @@ DROP TABLE user_directory_search_docsize;
...
@@ -181,7 +182,7 @@ DROP TABLE user_directory_search_docsize;
DROP TABLE user_directory_search_stat;
DROP TABLE user_directory_search_stat;
"
"
sqlite3
"
$SQLITE_DB
"
<<<
"
$SQL
"
sqlite3
"
$SQLITE_DB
"
<<<
"
$SQL
"
psql
$POSTGRES_DB_NAME
-U
"
$POSTGRES_USERNAME
"
-w
<<<
"
$SQL
"
psql
"
$POSTGRES_DB_NAME
"
-w
<<<
"
$SQL
"
echo
"Dumping SQLite3 schema to '
$OUTPUT_DIR
/
$SQLITE_FULL_SCHEMA_OUTPUT_FILE
'..."
echo
"Dumping SQLite3 schema to '
$OUTPUT_DIR
/
$SQLITE_FULL_SCHEMA_OUTPUT_FILE
'..."
sqlite3
"
$SQLITE_DB
"
".dump"
>
"
$OUTPUT_DIR
/
$SQLITE_FULL_SCHEMA_OUTPUT_FILE
"
sqlite3
"
$SQLITE_DB
"
".dump"
>
"
$OUTPUT_DIR
/
$SQLITE_FULL_SCHEMA_OUTPUT_FILE
"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment