Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Django-5.1 support #152 #153

Merged
merged 1 commit into from
Sep 16, 2024
Merged

Add Django-5.1 support #152 #153

merged 1 commit into from
Sep 16, 2024

Conversation

shimizukawa
Copy link
Member

@shimizukawa shimizukawa commented Sep 14, 2024

Tasks

  • update tox and github CI
  • update pyproject.toml
  • update document
  • adapts dropped index_together meta.
  • Test with Postgres
  • Test with Reshift
  • bump version x.Y.z for compatible update

@@ -216,7 +216,6 @@ def set_up_test_model(
# Make the "current" state.
model_options = {
'swappable': 'TEST_SWAP_MODEL',
'index_together': [['weight', 'pink']] if index_together else [],
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

index_together is deprecated (dj42) and removed (dj51).
https://docs.djangoproject.com/en/5.1/releases/5.1/#features-removed-in-5-1

Redshift ignores indexes, so django-redshift-backend does not create any indexes.
I removed this definition because I left it in place when I brought it from the original Django test code.

@shimizukawa
Copy link
Member Author

shimizukawa commented Sep 14, 2024

This comment has been moved into issue #154

@shimizukawa shimizukawa changed the title Add Django-5.0 support #152 Add Django-5.1 support #152 Sep 15, 2024
@shimizukawa
Copy link
Member Author

shimizukawa commented Sep 15, 2024

backward migration is not worked.

(venv) @shimizukawa ➜ /workspaces/django-redshift-backend/examples/dj-sql-explorer (152-dj51) $ python manage.py migrate explorer 0019
Operations to perform:
  Target specific migration: 0019_alter_databaseconnection_engine, from explorer
Running migrations:
(0.170) 
            SELECT c.relname,
            CASE WHEN c.relkind IN ('m', 'v') THEN 'v' ELSE 't' END
            FROM pg_catalog.pg_class c
            LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
            WHERE c.relkind IN ('f', 'm', 'p', 'r', 'v')
                AND n.nspname NOT IN ('pg_catalog', 'pg_toast')
                AND pg_catalog.pg_table_is_visible(c.oid)
        ; args=None; alias=default
  Rendering model states... DONE
  Unapplying explorer.0022_databaseconnection_upload_fingerprint...ALTER TABLE "explorer_databaseconnection" DROP COLUMN "upload_fingerprint" CASCADE; (params ())
(0.200) ALTER TABLE "explorer_databaseconnection" DROP COLUMN "upload_fingerprint" CASCADE; args=(); alias=default
Traceback (most recent call last):
  File "/workspaces/django-redshift-backend/examples/dj-sql-explorer/manage.py", line 22, in <module>
    main()
  File "/workspaces/django-redshift-backend/examples/dj-sql-explorer/manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "/workspaces/django-redshift-backend/examples/dj-sql-explorer/venv/lib/python3.10/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/workspaces/django-redshift-backend/examples/dj-sql-explorer/venv/lib/python3.10/site-packages/django/core/management/__init__.py", line 436, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/workspaces/django-redshift-backend/examples/dj-sql-explorer/venv/lib/python3.10/site-packages/django/core/management/base.py", line 413, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/workspaces/django-redshift-backend/examples/dj-sql-explorer/venv/lib/python3.10/site-packages/django/core/management/base.py", line 459, in execute
    output = self.handle(*args, **options)
  File "/workspaces/django-redshift-backend/examples/dj-sql-explorer/venv/lib/python3.10/site-packages/django/core/management/base.py", line 107, in wrapper
    res = handle_func(*args, **kwargs)
  File "/workspaces/django-redshift-backend/examples/dj-sql-explorer/venv/lib/python3.10/site-packages/django/core/management/commands/migrate.py", line 356, in handle
    post_migrate_state = executor.migrate(
  File "/workspaces/django-redshift-backend/examples/dj-sql-explorer/venv/lib/python3.10/site-packages/django/db/migrations/executor.py", line 141, in migrate
    state = self._migrate_all_backwards(plan, full_plan, fake=fake)
  File "/workspaces/django-redshift-backend/examples/dj-sql-explorer/venv/lib/python3.10/site-packages/django/db/migrations/executor.py", line 219, in _migrate_all_backwards
    self.unapply_migration(states[migration], migration, fake=fake)
  File "/workspaces/django-redshift-backend/examples/dj-sql-explorer/venv/lib/python3.10/site-packages/django/db/migrations/executor.py", line 284, in unapply_migration
    self.recorder.record_unapplied(migration.app_label, migration.name)
  File "/workspaces/django-redshift-backend/examples/dj-sql-explorer/venv/lib/python3.10/site-packages/django/db/migrations/recorder.py", line 107, in record_unapplied
    self.migration_qs.filter(app=app, name=name).delete()
  File "/workspaces/django-redshift-backend/examples/dj-sql-explorer/venv/lib/python3.10/site-packages/django/db/models/query.py", line 1188, in delete
    deleted, _rows_count = collector.delete()
  File "/workspaces/django-redshift-backend/examples/dj-sql-explorer/venv/lib/python3.10/site-packages/django/db/models/deletion.py", line 472, in delete
    count = qs._raw_delete(using=self.using)
  File "/workspaces/django-redshift-backend/examples/dj-sql-explorer/venv/lib/python3.10/site-packages/django/db/models/query.py", line 1210, in _raw_delete
    cursor = query.get_compiler(using).execute_sql(CURSOR)
  File "/workspaces/django-redshift-backend/examples/dj-sql-explorer/venv/lib/python3.10/site-packages/django/db/models/sql/compiler.py", line 1549, in execute_sql
    sql, params = self.as_sql()
  File "/workspaces/django-redshift-backend/examples/dj-sql-explorer/venv/lib/python3.10/site-packages/django/db/models/sql/compiler.py", line 1899, in as_sql
    self.connection.features.delete_can_self_reference_subquery
AttributeError: 'DatabaseFeatures' object has no attribute 'delete_can_self_reference_subquery'
(venv) @shimizukawa ➜ /workspaces/django-redshift-backend/examples/dj-sql-explorer (152-dj51) $ 

@shimizukawa
Copy link
Member Author

backward migration is not worked.

fixed by #156

@shimizukawa shimizukawa marked this pull request as ready for review September 16, 2024 22:51
@shimizukawa shimizukawa merged commit e8750b7 into master Sep 16, 2024
54 of 55 checks passed
@shimizukawa shimizukawa deleted the 152-dj51 branch September 16, 2024 23:00
@shimizukawa shimizukawa linked an issue Sep 16, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Django-5.1 support
1 participant