mirror of
https://github.com/jumpserver/jumpserver.git
synced 2026-05-15 03:17:33 +00:00
24 lines
765 B
Python
24 lines
765 B
Python
# Generated by Django 4.1.13 on 2025-11-27 02:54
|
|
|
|
from django.db import migrations, connections
|
|
|
|
|
|
def refresh_pg_collation(apps, schema_editor):
|
|
for alias, conn in connections.databases.items():
|
|
if connections[alias].vendor == "postgresql":
|
|
dbname = connections[alias].settings_dict["NAME"]
|
|
connections[alias].cursor().execute(
|
|
f'ALTER DATABASE "{dbname}" REFRESH COLLATION VERSION;'
|
|
)
|
|
print(f"Refreshed postgresql collation version for database: {dbname} successfully.")
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
dependencies = [
|
|
('settings', '0002_leakpasswords'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.RunPython(refresh_pg_collation, migrations.RunPython.noop),
|
|
]
|