Skip to content

Commit

Permalink
Merge pull request #4056 from GeotrekCE/fix_allow_db_username_with_dash
Browse files Browse the repository at this point in the history
馃悰 [Fix] Fix crash on migrate when db username or dbname contains dash
  • Loading branch information
submarcos committed Apr 10, 2024
2 parents 8ddaa54 + b9798d5 commit feeaf32
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@ CHANGELOG
**Bug fixes**

- Fix OptionalRangeFilter and CustomDateFromToRangeFilter labels translation (fixes #3852)
- Remove unused `postgres` volume in docker compose file for production
- Fix crash on migrate when db username or dbname contains dash

**Documentation**

- Improve static pages documentation (#4050

**Improvements**

- Remove unused `postgres` volume in docker compose file for production


2.104.2 (2024-04-04)
--------------------
Expand Down
2 changes: 1 addition & 1 deletion geotrek/common/utils/postgresql.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,5 +124,5 @@ def move_models_to_schemas(app):
dbname = settings.DATABASES['default']['NAME']
dbuser = settings.DATABASES['default']['USER']
search_path = ', '.join(('public', ) + tuple(set(settings.DATABASE_SCHEMAS.values())))
sql = "ALTER ROLE %s IN DATABASE %s SET search_path=%s;" % (dbuser, dbname, search_path)
sql = "ALTER ROLE \"%s\" IN DATABASE \"%s\" SET search_path=%s;" % (dbuser, dbname, search_path)
cursor.execute(sql)

0 comments on commit feeaf32

Please sign in to comment.