Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Fix small issues in the anonymize-sql-dump script

Christophe Bliard296ebeaa5b94
diff --git a/script/anonymize-sql-dump b/script/anonymize-sql-dump
index 356fe83e91d..fc1c6260fc0 100755
--- a/script/anonymize-sql-dump
+++ b/script/anonymize-sql-dump
@@ -173,16 +173,8 @@ echo_header "CREATING ADMIN USER"
create_admin_rb_file=$(mktemp /tmp/create_admin_rb.XXXXXX)
cat <<RUBY > "$create_admin_rb_file"
- u = User.new(
- login: 'admin',
- mail: 'admin@localhost',
- firstname: 'admin',
- lastname: 'lastname',
- password: 'admin',
- password_confirmation: 'admin',
- admin: true
- )
- u.save!(validate: false)
+ admin_user = AdminUserSeeder.new.new_admin
+ admin_user.save!(validate: false)
RUBY
cd "$OPENPROJECT_DEV_DIR"
@@ -194,12 +186,13 @@ rm "$create_admin_rb_file"
echo_header "DUMPING ANONYMIZED DATA TO $(pwd)/tmp.dump.sql"
-pg_dump --format=plain tmp > tmp.dump.sql
+pg_dump --no-owner --format=plain tmp > tmp.dump.sql
echo_header "DONE"
echo "Anonymized database dump saved to $(pwd)/tmp.dump.sql"
echo "Copy it to your machine and load it like this:"
+echo " dropdb --if-exists --force openproject_debug_me"
echo " createdb --owner=openproject openproject_debug_me"
echo " psql --username=openproject openproject_debug_me < tmp.dump.sql"