[change] Squashed migrations 0001-0042 for faster fresh installs #705#739
[change] Squashed migrations 0001-0042 for faster fresh installs #705#739CodingWithSaksham wants to merge 6 commits into
Conversation
…wisp#705 Squashed only the migrations released up to 1.2.x (0001-0042) into `0001_squashed_0042_initial`, keeping 0043-0048 (unreleased 1.3.0 work) standalone. Flagged the data-migration helpers used solely by the squashed range in `migrations/__init__.py` for removal in a future release. Closes openwisp#705
…ues/705-squash-migrations
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
📜 Recent review details⏰ Context from checks skipped due to timeout. (11)
📝 WalkthroughWalkthroughAdds a squashed Django initial migration that replaces the earlier Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@openwisp_radius/migrations/0001_squashed_0042_initial.py`:
- Line 1631: The migration references a misspelled helper name, so update the
`code` argument in the squashed migration to use the actual UUID population
function from `openwisp_radius.migrations` (likely `populate_uuids` instead of
`popluate_uuids`). Check the migration’s `code=` callback and the corresponding
function defined in `openwisp_radius/migrations/__init__.py`, then make the
names match exactly so the migration can run without an AttributeError.
- Around line 31-33: The comment in the squashed migration is ambiguous about
which helper came from which source migration. Update the note in
0001_squashed_0042_initial.py around the copied migration helpers so it clearly
maps clean_fallback_fields to 0038_clean_fallbackfields and
set_existing_batches_completed to 0042_set_existing_batches_completed, or split
it into separate comments for each symbol; keep the existing reminder about
squashmigrations and syncing changes.
- Around line 2254-2256: The RunPython migration for
set_existing_batches_completed is missing a reverse_code, which makes backwards
migration stop at this operation. Update the migration entry in the squashed
initial migration to pass a reverse_code using noop, matching the pattern used
for irreversible data migrations. Use the existing
set_existing_batches_completed RunPython call so it can be located even if line
numbers change.
- Around line 1630-1632: The RunPython operation in the migration has a typo in
the UUID population callable name and is missing a reverse_code. Update the
migration to reference the correct UUID population function name, and add
reverse_code=django.db.migrations.operations.special.RunPython.noop to the
migrations.RunPython call so it behaves consistently with the other migration
steps and can be reversed safely.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 56f6b4dd-bd5a-446c-adc5-8e76468412b8
📒 Files selected for processing (2)
openwisp_radius/migrations/0001_squashed_0042_initial.pyopenwisp_radius/migrations/__init__.py
📜 Review details
⏰ Context from checks skipped due to timeout. (11)
- GitHub Check: Python==3.11 | django~=5.1.0
- GitHub Check: Python==3.10 | django~=4.2.0
- GitHub Check: Python==3.13 | django~=5.2.0
- GitHub Check: Python==3.11 | django~=5.2.0
- GitHub Check: Python==3.13 | django~=5.1.0
- GitHub Check: Python==3.12 | django~=5.1.0
- GitHub Check: Python==3.12 | django~=5.2.0
- GitHub Check: Python==3.10 | django~=5.1.0
- GitHub Check: Python==3.12 | django~=4.2.0
- GitHub Check: Python==3.10 | django~=5.2.0
- GitHub Check: Python==3.11 | django~=4.2.0
🧰 Additional context used
📓 Path-based instructions (1)
**/*.py
📄 CodeRabbit inference engine (AGENTS.md)
**/*.py: Place imports at the top of the file. Only defer imports when necessary (e.g., Django model imports inside functions or methods where the app registry is not yet ready).
Avoid unnecessary blank lines inside function and method bodies.
Mark user-facing strings for translation with Django i18n helpers in Django code.
Write comments and docstrings only when they explain why code is shaped a certain way. Put comments before the relevant code block instead of scattering them inside it.
Files:
openwisp_radius/migrations/0001_squashed_0042_initial.pyopenwisp_radius/migrations/__init__.py
🪛 ast-grep (0.44.0)
openwisp_radius/migrations/0001_squashed_0042_initial.py
[info] 161-166: use help_text to document model columns
Context: models.CharField(
db_index=True,
max_length=255,
unique=True,
verbose_name="group name",
)
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 170-172: use help_text to document model columns
Context: models.CharField(
blank=True, max_length=64, null=True, verbose_name="description"
)
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 234-239: use help_text to document model columns
Context: models.CharField(
blank=True,
db_index=True,
max_length=64,
verbose_name="group name",
)
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 243-243: use help_text to document model columns
Context: models.CharField(max_length=64, verbose_name="attribute")
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 247-266: use help_text to document model columns
Context: models.CharField(
choices=[
("=", "="),
(":=", ":="),
("==", "=="),
("+=", "+="),
("!=", "!="),
(">", ">"),
(">=", ">="),
("<", "<"),
("<=", "<="),
("=", "="),
("!", "!"),
("=", "="),
("!", "!"),
],
default=":=",
max_length=2,
verbose_name="operator",
)
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 268-268: use help_text to document model columns
Context: models.CharField(max_length=253, verbose_name="value")
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 318-323: use help_text to document model columns
Context: models.CharField(
blank=True,
db_index=True,
max_length=64,
verbose_name="group name",
)
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 327-327: use help_text to document model columns
Context: models.CharField(max_length=64, verbose_name="attribute")
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 331-336: use help_text to document model columns
Context: models.CharField(
choices=[("=", "="), (":=", ":="), ("+=", "+=")],
default="=",
max_length=2,
verbose_name="operator",
)
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 338-338: use help_text to document model columns
Context: models.CharField(max_length=253, verbose_name="value")
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 388-393: use help_text to document model columns
Context: models.CharField(
blank=True,
db_index=True,
max_length=64,
verbose_name="username",
)
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 397-399: use help_text to document model columns
Context: models.CharField(
blank=True, max_length=64, verbose_name="group name"
)
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 644-646: use help_text to document model columns
Context: models.CharField(
db_column="shortname", max_length=32, verbose_name="short name"
)
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 650-718: use help_text to document model columns
Context: models.CharField(
choices=[
("cisco", "Cisco Router"),
("Async", "Async"),
("Sync", "Sync"),
("ISDN Sync", "ISDN Sync"),
("ISDN Async V.120", "ISDN Async V.120"),
("ISDN Async V.110", "ISDN Async V.110"),
("Virtual", "Virtual"),
("PIAFS", "PIAFS"),
("HDLC Clear", "HDLC Clear"),
("Channel", "Channel"),
("X.25", "X.25"),
("X.75", "X.75"),
("G.3 Fax", "G.3 Fax"),
("SDSL", "SDSL - Symmetric DSL"),
("ADSL-CAP", "ADSL-CAP"),
("ADSL-DMT", "ADSL-DMT"),
("IDSL", "IDSL"),
("Ethernet", "Ethernet"),
("xDSL", "xDSL"),
("Cable", "Cable"),
("Wireless - Other", "Wireless - Other"),
("IEEE 802.11", "Wireless - IEEE 802.11"),
("Token-Ring", "Token-Ring"),
("FDDI", "FDDI"),
("Wireless - CDMA2000", "Wireless - CDMA2000"),
("Wireless - UMTS", "Wireless - UMTS"),
("Wireless - 1X-EV", "Wireless - 1X-EV"),
("IAPP", "IAPP"),
("FTTP", "FTTP"),
("IEEE 802.16", "Wireless - IEEE 802.16"),
("IEEE 802.20", "Wireless - IEEE 802.20"),
("IEEE 802.22", "Wireless - IEEE 802.22"),
("PPPoA", "PPPoA - PPP over ATM"),
("PPPoEoA", "PPPoEoA - PPP over Ethernet over ATM"),
("PPPoEoE", "PPPoEoE - PPP over Ethernet over Ethernet"),
("PPPoEoVLAN", "PPPoEoVLAN - PPP over Ethernet over VLAN"),
(
"PPPoEoQinQ",
"PPPoEoQinQ - PPP over Ethernet over IEEE 802.1QinQ",
),
("xPON", "xPON - Passive Optical Network"),
("Wireless - XGP", "Wireless - XGP"),
("WiMAX", " WiMAX Pre-Release 8 IWK Function"),
(
"WIMAX-WIFI-IWK",
"WIMAX-WIFI-IWK: WiMAX WIFI Interworking",
),
(
"WIMAX-SFF",
(
"WIMAX-SFF: Signaling Forwarding Function for"
" LTE/3GPP2"
),
),
(
"WIMAX-HA-LMA",
"WIMAX-HA-LMA: WiMAX HA and or LMA function",
),
("WIMAX-DHCP", "WIMAX-DHCP: WIMAX DCHP service"),
("WIMAX-LBS", "WIMAX-LBS: WiMAX location based service"),
("WIMAX-WVS", "WIMAX-WVS: WiMAX voice service"),
("Other", "Other"),
],
default="other",
max_length=30,
verbose_name="type",
)
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 734-736: use help_text to document model columns
Context: models.CharField(
blank=True, max_length=50, null=True, verbose_name="community"
)
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 740-745: use help_text to document model columns
Context: models.CharField(
blank=True,
max_length=200,
null=True,
verbose_name="description",
)
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 749-751: use help_text to document model columns
Context: models.CharField(
blank=True, max_length=64, null=True, verbose_name="server"
)
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 783-788: use help_text to document model columns
Context: models.CharField(
db_column="acctsessionid",
db_index=True,
max_length=64,
verbose_name="session ID",
)
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 792-797: use help_text to document model columns
Context: models.CharField(
db_column="acctuniqueid",
max_length=32,
unique=True,
verbose_name="accounting unique ID",
)
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 801-807: use help_text to document model columns
Context: models.CharField(
blank=True,
db_index=True,
max_length=64,
null=True,
verbose_name="username",
)
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 811-813: use help_text to document model columns
Context: models.CharField(
blank=True, max_length=64, null=True, verbose_name="group name"
)
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 817-819: use help_text to document model columns
Context: models.CharField(
blank=True, max_length=64, null=True, verbose_name="realm"
)
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 831-837: use help_text to document model columns
Context: models.CharField(
blank=True,
db_column="nasportid",
max_length=15,
null=True,
verbose_name="NAS port ID",
)
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 841-847: use help_text to document model columns
Context: models.CharField(
blank=True,
db_column="nasporttype",
max_length=32,
null=True,
verbose_name="NAS port type",
)
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 880-886: use help_text to document model columns
Context: models.CharField(
blank=True,
db_column="acctauthentic",
max_length=32,
null=True,
verbose_name="authentication",
)
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 890-896: use help_text to document model columns
Context: models.CharField(
blank=True,
db_column="connectinfo_start",
max_length=50,
null=True,
verbose_name="connection info start",
)
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 900-906: use help_text to document model columns
Context: models.CharField(
blank=True,
db_column="connectinfo_stop",
max_length=50,
null=True,
verbose_name="connection info stop",
)
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 928-935: use help_text to document model columns
Context: models.CharField(
blank=True,
db_column="callingstationid",
db_index=True,
max_length=50,
null=True,
verbose_name="calling station ID",
)
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 939-946: use help_text to document model columns
Context: models.CharField(
blank=True,
db_column="calledstationid",
db_index=True,
max_length=50,
null=True,
verbose_name="called station ID",
)
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 950-956: use help_text to document model columns
Context: models.CharField(
blank=True,
db_column="acctterminatecause",
max_length=32,
null=True,
verbose_name="termination cause",
)
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 960-966: use help_text to document model columns
Context: models.CharField(
blank=True,
db_column="servicetype",
max_length=32,
null=True,
verbose_name="service type",
)
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 970-976: use help_text to document model columns
Context: models.CharField(
blank=True,
db_column="framedprotocol",
max_length=32,
null=True,
verbose_name="framed protocol",
)
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 1055-1060: use help_text to document model columns
Context: models.CharField(
blank=True,
db_index=True,
max_length=64,
verbose_name="username",
)
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 1062-1062: use help_text to document model columns
Context: models.CharField(max_length=253, verbose_name="value")
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 1065-1084: use help_text to document model columns
Context: models.CharField(
choices=[
("=", "="),
(":=", ":="),
("==", "=="),
("+=", "+="),
("!=", "!="),
(">", ">"),
(">=", ">="),
("<", "<"),
("<=", "<="),
("=", "="),
("!", "!"),
("=", "="),
("!", "!"),
],
default=":=",
max_length=2,
verbose_name="operator",
)
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 1088-1105: use help_text to document model columns
Context: models.CharField(
choices=[
("Max-Daily-Session", "Max-Daily-Session"),
("Max-All-Session", "Max-All-Session"),
("Max-Daily-Session-Traffic", "Max-Daily-Session-Traffic"),
("Cleartext-Password", "Cleartext-Password"),
("NT-Password", "NT-Password"),
("LM-Password", "LM-Password"),
("MD5-Password", "MD5-Password"),
("SMD5-Password", "SMD5-Password"),
("SHA-Password", "SHA-Password"),
("SSHA-Password", "SSHA-Password"),
("Crypt-Password", "Crypt-Password"),
],
default="NT-Password",
max_length=64,
verbose_name="attribute",
)
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 1154-1154: use help_text to document model columns
Context: models.CharField(max_length=64, verbose_name="username")
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 1157-1162: use help_text to document model columns
Context: models.CharField(
blank=True,
db_column="pass",
max_length=64,
verbose_name="password",
)
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 1164-1164: use help_text to document model columns
Context: models.CharField(max_length=32, verbose_name="reply")
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 1173-1179: use help_text to document model columns
Context: models.CharField(
blank=True,
db_column="calledstationid",
max_length=50,
null=True,
verbose_name="called station ID",
)
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 1183-1189: use help_text to document model columns
Context: models.CharField(
blank=True,
db_column="callingstationid",
max_length=50,
null=True,
verbose_name="calling station ID",
)
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 1240-1245: use help_text to document model columns
Context: models.CharField(
blank=True,
db_index=True,
max_length=64,
verbose_name="username",
)
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 1247-1247: use help_text to document model columns
Context: models.CharField(max_length=253, verbose_name="value")
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 1250-1255: use help_text to document model columns
Context: models.CharField(
choices=[("=", "="), (":=", ":="), ("+=", "+=")],
default="=",
max_length=2,
verbose_name="operator",
)
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 1259-1259: use help_text to document model columns
Context: models.CharField(max_length=64, verbose_name="attribute")
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 1367-1372: use help_text to document model columns
Context: models.CharField(
max_length=40,
primary_key=True,
serialize=False,
verbose_name="Key",
)
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 1394-1401: use help_text to document model columns
Context: models.CharField(
blank=True,
db_column="delegatedipv6prefix",
max_length=44,
null=True,
validators=[openwisp_radius.base.validators.ipv6_network_validator],
verbose_name="delegated IPv6 prefix",
)
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 1406-1412: use help_text to document model columns
Context: models.CharField(
blank=True,
db_column="framedinterfaceid",
max_length=19,
null=True,
verbose_name="framed interface ID",
)
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 1428-1435: use help_text to document model columns
Context: models.CharField(
blank=True,
db_column="framedipv6prefix",
max_length=44,
null=True,
validators=[openwisp_radius.base.validators.ipv6_network_validator],
verbose_name="framed IPv6 prefix",
)
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 1509-1513: use help_text to document model columns
Context: models.CharField(
default=openwisp_radius.utils.generate_sms_token,
editable=False,
max_length=8,
)
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 1667-1674: use help_text to document model columns
Context: models.CharField(
db_column="acctuniqueid",
max_length=32,
primary_key=True,
serialize=False,
unique=True,
verbose_name="accounting unique ID",
)
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 1916-1916: use help_text to document model columns
Context: models.CharField(max_length=64, verbose_name="attribute")
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 2185-2192: use help_text to document model columns
Context: models.CharField(
blank=True,
db_column="calledstationid",
db_index=True,
max_length=253,
null=True,
verbose_name="called station ID",
)
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 2197-2204: use help_text to document model columns
Context: models.CharField(
blank=True,
db_column="callingstationid",
db_index=True,
max_length=253,
null=True,
verbose_name="calling station ID",
)
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 2209-2215: use help_text to document model columns
Context: models.CharField(
blank=True,
db_column="calledstationid",
max_length=253,
null=True,
verbose_name="called station ID",
)
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 2220-2226: use help_text to document model columns
Context: models.CharField(
blank=True,
db_column="callingstationid",
max_length=253,
null=True,
verbose_name="calling station ID",
)
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
[info] 2241-2251: use help_text to document model columns
Context: models.CharField(
choices=[
("pending", "Pending"),
("processing", "Processing"),
("completed", "Completed"),
("failed", "Failed"),
],
db_index=True,
default="pending",
max_length=16,
)
Note: [CWE-710] Improper Adherence to Coding Standards.
(model-help-text)
🔇 Additional comments (9)
openwisp_radius/migrations/0001_squashed_0042_initial.py (2)
34-60: 🩺 Stability & AvailabilityNo action needed regarding
clean_fallback_fieldshistorical model handling.The function relies on
get_fields()filtered byisinstance(field, FallbackMixin). In Django,FallbackMixinfilters to actual field instances, safely excluding reverse relations and auto-created fields even on historical models. The search forOPENWISP_RADIUS_ORGANIZATIONRADIUSSETTINGSyielded no results, indicating the model follows the defaultAUTH_USER_MODEL-style swappability pattern whereget_swapped_modelresolves correctly without custom swappable settings. Since this logic is a direct copy of a working migration and the swappable configuration is standard, the approach is robust and does not require the suggestedinclude_parentsarguments or manual re-verification.
122-129: 🗄️ Data Integrity & IntegrationManually verify swapper dependency version against pinned openwisp-users release
The migration
swapper.dependency(*swapper.split(settings.AUTH_USER_MODEL), version="0004_default_groups")references a migration that must exist in theopenwisp-userspackage pinned to version1.3(via GitHub tarball insetup.py).Since the referenced package is not locally available for inspection, please confirm that
0004_default_groups.pyexists in theopenwisp_users/migrations/directory of theopenwisp-usersv1.3 release. If the migration filename differs (e.g., due to renaming or reordering in that specific commit), update theversionstring in the dependency to match the actual filename (excluding.py).openwisp_radius/migrations/__init__.py (7)
346-356: LGTM!
380-382: LGTM!
391-393: LGTM!
418-431: LGTM!
474-476: LGTM!
494-496: LGTM!
346-501: No action required: comments are accurate.The comments correctly state these helpers are used only by the squashed 0001‑0042 migration. A codebase search found no external references in tests, newer migrations, or other modules. The planned removal in 1.3.x is safe.
Migration Failure: Duplicate Column NameHello @CodingWithSaksham, There's a To fix this:
This error is preventing the tests from running. Please address this migration issue and push a new commit. |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
openwisp_radius/migrations/0001_squashed_0042_initial.py (1)
2049-2058: 🎯 Functional Correctness | 🔴 CriticalRemove the invalid
RenameIndexoperations usingold_fields.The
migrations.RenameIndexactions at lines 2049–2058 use the argumentold_fields, which is not supported by Django's standardRenameIndexoperation (it requiresold_nameandnew_name). Since no customRenameIndexclass exists in the codebase, this migration will fail with a TypeError during execution. Additionally, thephonetokenmodel already creates indexes with these exact names at lines 1524–1532, making these operations redundant. Delete these two lines.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@openwisp_radius/migrations/0001_squashed_0042_initial.py` around lines 2049 - 2058, The migration contains invalid and redundant RenameIndex operations in the phonetoken migration block. Remove the two migrations.RenameIndex entries in the squashed initial migration that use old_fields, since Django’s standard RenameIndex expects old_name/new_name and the phonetoken indexes are already created earlier by the model’s index definitions.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@openwisp_radius/migrations/0001_squashed_0042_initial.py`:
- Around line 2049-2058: The migration contains invalid and redundant
RenameIndex operations in the phonetoken migration block. Remove the two
migrations.RenameIndex entries in the squashed initial migration that use
old_fields, since Django’s standard RenameIndex expects old_name/new_name and
the phonetoken indexes are already created earlier by the model’s index
definitions.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 167d65b1-ee32-4cbe-a49e-7ec52ce8dfe8
📒 Files selected for processing (1)
openwisp_radius/migrations/0001_squashed_0042_initial.py
📜 Review details
🧰 Additional context used
📓 Path-based instructions (1)
**/*.py
📄 CodeRabbit inference engine (AGENTS.md)
**/*.py: Place imports at the top of the file. Only defer imports when necessary (e.g., Django model imports inside functions or methods where the app registry is not yet ready).
Avoid unnecessary blank lines inside function and method bodies.
Mark user-facing strings for translation with Django i18n helpers in Django code.
Write comments and docstrings only when they explain why code is shaped a certain way. Put comments before the relevant code block instead of scattering them inside it.
Files:
openwisp_radius/migrations/0001_squashed_0042_initial.py
🔇 Additional comments (1)
openwisp_radius/migrations/0001_squashed_0042_initial.py (1)
2074-2076: Duplicate: addreverse_codefor the batch-status data migration.This same
set_existing_batches_completedRunPythonoperation was already flagged in a previous review for missingreverse_code=django.db.migrations.operations.special.RunPython.noop.
|
@coderabbitai resolve |
✅ Action performedComments resolved and changes approved. |
There was a problem hiding this comment.
AFAIK on postgres we can't run DB schema changes and data migrations in one single run, see https://stackoverflow.com/a/66799446/462707.
Moreover, some data migrations won't be necessary if migrations are squashed so it may be that we don't have to run them at all. Others, like the addition of the permissions to operator and administrator groups will always be necessary and we need to maintain them.
|
The CI is failing due to transient infrastructure issues (not related to your code). I have restarted the failed jobs automatically (1/3). |
Checklist
Reference to Existing Issue
Closes #705
Description of Changes
migrations/__init__.pyindicating that they should be removed as part of the 1.3.x release series.