Skip to content

Commit

Permalink
Merge pull request #971 from readthedocs/davidfischer/switch-to-uuid7
Browse files Browse the repository at this point in the history
Switch to UUID7s
  • Loading branch information
davidfischer authored Jan 2, 2025
2 parents 73cc33c + 9f3234f commit 68173cd
Show file tree
Hide file tree
Showing 7 changed files with 103 additions and 70 deletions.
29 changes: 29 additions & 0 deletions adserver/migrations/0102_switch_uuid7.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Generated by Django 5.0.10 on 2025-01-02 21:27

import uuid_utils.compat
from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('adserver', '0101_domainimpression_aggregation'),
]

operations = [
migrations.AlterField(
model_name='historicalpublisherpayout',
name='id',
field=models.UUIDField(db_index=True, default=uuid_utils.compat.uuid7, editable=False),
),
migrations.AlterField(
model_name='offer',
name='id',
field=models.UUIDField(default=uuid_utils.compat.uuid7, editable=False, primary_key=True, serialize=False),
),
migrations.AlterField(
model_name='publisherpayout',
name='id',
field=models.UUIDField(default=uuid_utils.compat.uuid7, editable=False, primary_key=True, serialize=False),
),
]
6 changes: 3 additions & 3 deletions adserver/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
import logging
import math
import re
import uuid
from collections import Counter

import bleach
import djstripe.models as djstripe_models
import pytz
import uuid_utils.compat as uuid
from django.conf import settings
from django.core.cache import cache
from django.core.cache import caches
Expand Down Expand Up @@ -2689,7 +2689,7 @@ class Offer(AdBase):
MAX_VIEW_TIME = 5 * 60 # seconds

# Use an ok user-facing pk value
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
id = models.UUIDField(primary_key=True, default=uuid.uuid7, editable=False)

advertisement = models.ForeignKey(
Advertisement,
Expand Down Expand Up @@ -2777,7 +2777,7 @@ class Meta:
class PublisherPayout(TimeStampedModel):
"""Details on historical publisher payouts."""

id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
id = models.UUIDField(primary_key=True, default=uuid.uuid7, editable=False)
publisher = models.ForeignKey(
Publisher, related_name="payouts", on_delete=models.PROTECT
)
Expand Down
24 changes: 12 additions & 12 deletions requirements/analyzer.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ catalogue==2.0.10
# srsly
# textacy
# thinc
certifi==2024.8.30
certifi==2024.12.14
# via
# requests
# trafilatura
charset-normalizer==3.4.0
charset-normalizer==3.4.1
# via
# htmldate
# requests
# trafilatura
click==8.1.7
click==8.1.8
# via
# nltk
# typer
Expand All @@ -42,7 +42,7 @@ cymem==2.0.10
# preshed
# spacy
# thinc
cytoolz==1.0.0
cytoolz==1.0.1
# via textacy
dateparser==1.2.0
# via htmldate
Expand All @@ -56,11 +56,11 @@ filelock==3.16.1
# triton
floret==0.10.5
# via textacy
fsspec==2024.10.0
fsspec==2024.12.0
# via
# huggingface-hub
# torch
htmldate==1.9.2
htmldate==1.9.3
# via trafilatura
huggingface-hub==0.24.7
# via
Expand All @@ -69,9 +69,9 @@ huggingface-hub==0.24.7
# transformers
idna==3.10
# via requests
jellyfish==1.1.2
jellyfish==1.1.3
# via textacy
jinja2==3.1.4
jinja2==3.1.5
# via
# spacy
# torch
Expand Down Expand Up @@ -174,7 +174,7 @@ pathy==0.11.0
# via spacy
pgvector==0.3.6
# via -r analyzer.in
pillow==11.0.0
pillow==11.1.0
# via torchvision
preshed==3.0.9
# via
Expand Down Expand Up @@ -210,7 +210,7 @@ requests==2.32.3
# textacy
# transformers
# weasel
scikit-learn==1.5.2
scikit-learn==1.6.0
# via
# sentence-transformers
# textacy
Expand Down Expand Up @@ -248,7 +248,7 @@ spacy-loggers==1.0.5
# via spacy
spacy-transformers==1.1.9
# via -r analyzer.in
srsly==2.4.8
srsly==2.5.0
# via
# confection
# spacy
Expand Down Expand Up @@ -305,7 +305,7 @@ typing-extensions==4.12.2
# torch
tzlocal==5.2
# via dateparser
urllib3==2.2.3
urllib3==2.3.0
# via
# courlan
# htmldate
Expand Down
4 changes: 4 additions & 0 deletions requirements/base.in
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,7 @@ django-cors-headers

# Deprecated, but still used in migrations
jsonfield

# Used until UUID7 is in the Python stdlib (3.14 or 3.15)
# https://github.com/python/cpython/pull/121119
uuid_utils >=0.9.0, <1.0.0
30 changes: 15 additions & 15 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
#
aiohappyeyeballs==2.4.4
# via aiohttp
aiohttp==3.11.9
aiohttp==3.11.11
# via geoip2
aiosignal==1.3.1
aiosignal==1.3.2
# via aiohttp
amqp==5.3.1
# via kombu
Expand All @@ -22,19 +22,19 @@ async-timeout==5.0.1
# via
# aiohttp
# redis
attrs==24.2.0
attrs==24.3.0
# via aiohttp
billiard==4.2.1
# via celery
bleach==6.2.0
# via -r base.in
celery[redis]==5.5.0rc1
# via -r base.in
certifi==2024.8.30
certifi==2024.12.14
# via requests
charset-normalizer==3.4.0
charset-normalizer==3.4.1
# via requests
click==8.1.7
click==8.1.8
# via
# celery
# click-didyoumean
Expand Down Expand Up @@ -63,7 +63,7 @@ django==5.0.10
# django-slack
# djangorestframework
# jsonfield
django-allauth==65.3.0
django-allauth==65.3.1
# via -r base.in
django-cors-headers==4.6.0
# via -r base.in
Expand Down Expand Up @@ -111,7 +111,7 @@ multidict==6.1.0
# via
# aiohttp
# yarl
pillow==11.0.0
pillow==11.1.0
# via -r base.in
prompt-toolkit==3.0.48
# via click-repl
Expand All @@ -125,7 +125,7 @@ python-dateutil==2.9.0.post0
# via celery
pytz==2024.2
# via -r base.in
redis==5.2.0
redis==5.2.1
# via celery
requests==2.32.3
# via
Expand All @@ -134,7 +134,7 @@ requests==2.32.3
# stripe
six==1.17.0
# via python-dateutil
sqlparse==0.5.2
sqlparse==0.5.3
# via django
stripe==4.2.0
# via
Expand All @@ -148,15 +148,15 @@ typing-extensions==4.12.2
tzdata==2024.2
# via kombu
ua-parser==1.0.0
# via
# ua-parser-builtins
# user-agents
ua-parser-builtins==0.18.0
# via user-agents
ua-parser-builtins==0.18.0.post1
# via ua-parser
urllib3==2.2.3
urllib3==2.3.0
# via requests
user-agents==2.2.0
# via -r base.in
uuid-utils==0.10.0
# via -r base.in
vine==5.1.0
# via
# amqp
Expand Down
Loading

0 comments on commit 68173cd

Please sign in to comment.