zulip/zproject
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
..
jinja2 jinja2: Make sure that 500 pages have support_email set. 2023-04-12 16:41:07 -07:00
__init__.py
backends.py models: Replace realm.uri with realm.url. 2024-05-08 11:12:43 -07:00
computed_settings.py models: Migrate ids of all non-Message-related tables to bigint. 2024-06-05 11:48:27 -07:00
config.py config: Use logic from zulip_tools, to support bools. 2024-03-15 15:34:12 -07:00
configured_settings.py settings: Print about custom settings from runtornado. 2023-12-05 12:33:34 -08:00
default_settings.py user_groups: Add server level setting disallow anonymous groups for settings. 2024-06-03 09:45:26 -07:00
dev_settings.py user_groups: Add server level setting disallow anonymous groups for settings. 2024-06-03 09:45:26 -07:00
dev_urls.py dev_urls: Make requests to /docs redirect to the index. 2024-03-21 11:27:14 -07:00
email_backends.py mypy: Enable new error explicit-override. 2023-10-12 12:28:41 -07:00
prod_settings.pyi lint: Replace pycodestyle and pyflakes with ruff. 2022-11-03 12:10:15 -07:00
prod_settings_template.py rabbitmq: Support non-/ vhosts. 2024-05-31 15:41:19 -07:00
sentry.py docs: Update Django links to our current version. 2024-05-24 10:18:37 -07:00
settings.py settings: Hide django_stubs_ext from mypy. 2024-04-17 16:49:03 -07:00
settings_types.py scim: Add config option to disable initial streams for guests. 2024-04-11 12:28:26 -07:00
template_loaders.py mypy: Enable new error explicit-override. 2023-10-12 12:28:41 -07:00
test_extra_settings.py user_groups: Add server level setting disallow anonymous groups for settings. 2024-06-03 09:45:26 -07:00
test_settings.py settings: Refactor how TEST_SUITE is configured. 2023-12-04 09:50:14 -08:00
urls.py api: Add "users/<int:user_id>/status" endpoint. 2024-05-22 18:07:22 -07:00
wsgi.py requirements: Upgrade Python requirements. 2024-01-29 10:41:54 -08:00