Skip to content

Commit

Permalink
PageView: use BigAutoField for primary key
Browse files Browse the repository at this point in the history
How to deploy

We create page views on 404 and on page views (duh),
so while we do the migration this may slow down
doc serving (specially on .com where we have this feature enable for
everyone), so in order to avoid that we need to disable page views
while we do the migration.

Luckily we already have a feature flag for that:

https://github.com/readthedocs/readthedocs.org/blob/a09bc1a976a93bcc3f987fa0a052901f0065619f/readthedocs/projects/models.py#L1897-L1900

ref #9492
  • Loading branch information
stsewd committed Oct 18, 2022
1 parent a09bc1a commit f31caea
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions readthedocs/analytics/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ class AnalyticsAppConfig(AppConfig):

"""Analytics app init code."""

default_auto_field = "django.db.models.BigAutoField"
name = 'readthedocs.analytics'
verbose_name = 'Analytics'
20 changes: 20 additions & 0 deletions readthedocs/analytics/migrations/0006_alter_pageview_id.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Generated by Django 3.2.15 on 2022-10-18 15:25

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("analytics", "0005_add_unique_constraint"),
]

operations = [
migrations.AlterField(
model_name="pageview",
name="id",
field=models.BigAutoField(
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
),
),
]

0 comments on commit f31caea

Please sign in to comment.