zulip/zerver
Alex Vandiver 50c3dd88e6 models: Migrate ids of all non-Message-related tables to bigint.
Migrate all `ids` of anything which does not have a foreign key from
the Message or UserMessage table (and would thus require walking
those) to be `bigint`.  This is done by removing explicit
`BigAutoField`s, trading them for explicit `AutoField`s on the tables
to not be migrated, while updating `DEFAULT_AUTO_FIELD` to the new
default.

In general, the tables adjusted in this commit are small tables -- at
least compared to Messages and UserMessages.

Many-to-many tables without their own model class are adjusted by a
custom Operation, since they do not automatically pick up migrations
when `DEFAULT_AUTO_FIELD` changes[^1].

Note that this does multiple scans over tables to update foreign
keys[^2].  Large installs may wish to hand-optimize this using the
output of `./manage.py sqlmigrate` to join multiple `ALTER TABLE`
statements into one, to speed up the migration.  This is unfortunately
not possible to do generically, as constraint names may differ between
installations.

This leaves the following primary keys as non-`bigint`:
- `auth_group.id`
- `auth_group_permissions.id`
- `auth_permission.id`
- `django_content_type.id`
- `django_migrations.id`
- `otp_static_staticdevice.id`
- `otp_static_statictoken.id`
- `otp_totp_totpdevice.id`
- `two_factor_phonedevice.id`
- `zerver_archivedmessage.id`
- `zerver_client.id`
- `zerver_message.id`
- `zerver_realm.id`
- `zerver_recipient.id`
- `zerver_userprofile.id`

[^1]: https://code.djangoproject.com/ticket/32674
[^2]: https://code.djangoproject.com/ticket/24203
2024-06-05 11:48:27 -07:00
..
actions user_groups: Move get_group_setting_value_for_audit_log_data. 2024-06-04 09:55:27 -07:00
data_import typos: Fix typos caught by mwic. 2024-05-20 13:55:00 -07:00
integration_fixtures/nagios
lib streams: Move enforcement of stripped-stream-names lower. 2024-06-05 10:44:53 -07:00
management emails: Replace occurrences of uri with url in email templates. 2024-05-24 11:18:35 -07:00
migrations models: Migrate ids of all non-Message-related tables to bigint. 2024-06-05 11:48:27 -07:00
models models: Migrate ids of all non-Message-related tables to bigint. 2024-06-05 11:48:27 -07:00
openapi left_sidebar: Rename "more topics" to "all topics". 2024-06-04 10:18:54 -07:00
tests push_notifications: Provide a stable ordering. 2024-06-05 11:48:27 -07:00
tornado requirements: Upgrade Python requirements. 2024-05-06 12:56:30 -07:00
transaction_tests user_groups: Create NamedUserGroup objects when creating new groups. 2024-04-26 17:03:09 -07:00
views portico_error_pages: Collect zerver error pages into a folder. 2024-06-05 09:06:44 -07:00
webhooks typos: Fix typos caught by mwic. 2024-05-20 13:55:00 -07:00
worker missedmessage_emails: Backoff the background worker retries. 2024-05-06 12:50:27 -07:00
__init__.py
apps.py mypy: Enable new error explicit-override. 2023-10-12 12:28:41 -07:00
context_processors.py zerver: Replace occurrences of uri with url in other templates. 2024-05-24 11:18:35 -07:00
decorator.py test_decorators: Replace some deleted tests. 2024-03-29 09:39:34 -07:00
filters.py mypy: Enable new error explicit-override. 2023-10-12 12:28:41 -07:00
forms.py emails: Replace occurrences of uri with url in email templates. 2024-05-24 11:18:35 -07:00
logging_handlers.py error_notify: Remove custom email error reporting handler. 2023-07-20 11:00:09 -07:00
middleware.py portico: Improve message for deactivated, invalid and moved orgs. 2024-05-13 12:44:20 -07:00
signals.py ruff: Fix UP036 Version block is outdated for minimum Python version. 2024-04-01 18:32:52 -07:00