nautobot-app-device-onboarding icon indicating copy to clipboard operation
nautobot-app-device-onboarding copied to clipboard

Zeroed migrations not completing cleanly

Open whitej6 opened this issue 11 months ago • 1 comments

Environment

  • Python version: 3.11
  • Nautobot version: 2.1.X
  • nautobot-device-onboarding version: latest

Expected Behavior

nautobot-server migrate nautobot_device_onboarding zero

Observed Behavior

IF install used 0001_squash__0001_0004_0005_0006 the migration is not deleted from django_migrations table

Steps to Reproduce

whitej6 avatar Mar 13 '24 18:03 whitej6

Need to thoroughly reproduce this issue and figure out where and why Django isn't handling this.

bryanculver avatar Sep 27 '24 17:09 bryanculver

This appears to be a Django 3 bug because I'm unable to reproduce with Nautobot v2.3.0 but I can reproduce in v2.2.9.

v2.3.0

nautobot=# select * from django_migrations where app = 'nautobot_device_onboarding';
 id  |            app             |                 name                 |            applied            
-----+----------------------------+--------------------------------------+-------------------------------
 332 | nautobot_device_onboarding | 0001_initial                         | 2024-10-17 20:53:40.049002+00
 333 | nautobot_device_onboarding | 0004_migrate_to_extras_role_part_1   | 2024-10-17 20:53:40.054806+00
 334 | nautobot_device_onboarding | 0004_migrate_to_extras_role_part_2   | 2024-10-17 20:53:40.060287+00
 335 | nautobot_device_onboarding | 0004_migrate_to_extras_role_part_3   | 2024-10-17 20:53:40.065957+00
 336 | nautobot_device_onboarding | 0005_migrate_site_to_location_part_1 | 2024-10-17 20:53:40.071793+00
 337 | nautobot_device_onboarding | 0005_migrate_site_to_location_part_2 | 2024-10-17 20:53:40.077544+00
 338 | nautobot_device_onboarding | 0005_migrate_site_to_location_part_3 | 2024-10-17 20:53:40.083369+00
 339 | nautobot_device_onboarding | 0006_update_model_fields_part_1      | 2024-10-17 20:53:40.089305+00
 340 | nautobot_device_onboarding | 0006_update_model_fields_part_2      | 2024-10-17 20:53:40.095226+00
 341 | nautobot_device_onboarding | 0006_update_model_fields_part_3      | 2024-10-17 20:53:40.101056+00
 342 | nautobot_device_onboarding | 0007_alter_onboardingtask_ip_address | 2024-10-17 20:53:40.143007+00
 343 | nautobot_device_onboarding | 0002_create_onboardingdevice         | 2024-10-17 20:53:40.379855+00
 344 | nautobot_device_onboarding | 0003_onboardingtask_label            | 2024-10-17 20:53:40.500358+00
 345 | nautobot_device_onboarding | 0008_alter_onboardingtask_options    | 2024-10-17 20:53:40.583451+00
 346 | nautobot_device_onboarding | 0009_remove_models                   | 2024-10-17 20:53:41.05658+00
 411 | nautobot_device_onboarding | 0001_squash__0001_0004_0005_0006     | 2024-10-17 20:53:45.860509+00
(16 rows)

nautobot=# select * from django_migrations where app = 'nautobot_device_onboarding';
 id | app | name | applied 
----+-----+------+---------
(0 rows)

v2.2.9

nautobot=# select * from django_migrations where app = 'nautobot_device_onboarding';
 id  |            app             |                 name                 |            applied            
-----+----------------------------+--------------------------------------+-------------------------------
 318 | nautobot_device_onboarding | 0001_initial                         | 2024-10-17 20:46:57.73508+00
 319 | nautobot_device_onboarding | 0004_migrate_to_extras_role_part_1   | 2024-10-17 20:46:57.737007+00
 320 | nautobot_device_onboarding | 0004_migrate_to_extras_role_part_2   | 2024-10-17 20:46:57.738733+00
 321 | nautobot_device_onboarding | 0004_migrate_to_extras_role_part_3   | 2024-10-17 20:46:57.740483+00
 322 | nautobot_device_onboarding | 0005_migrate_site_to_location_part_1 | 2024-10-17 20:46:57.742323+00
 323 | nautobot_device_onboarding | 0005_migrate_site_to_location_part_2 | 2024-10-17 20:46:57.744042+00
 324 | nautobot_device_onboarding | 0005_migrate_site_to_location_part_3 | 2024-10-17 20:46:57.745755+00
 325 | nautobot_device_onboarding | 0006_update_model_fields_part_1      | 2024-10-17 20:46:57.747605+00
 326 | nautobot_device_onboarding | 0006_update_model_fields_part_2      | 2024-10-17 20:46:57.749518+00
 327 | nautobot_device_onboarding | 0006_update_model_fields_part_3      | 2024-10-17 20:46:57.751269+00
 328 | nautobot_device_onboarding | 0007_alter_onboardingtask_ip_address | 2024-10-17 20:46:57.787773+00
 329 | nautobot_device_onboarding | 0002_create_onboardingdevice         | 2024-10-17 20:46:57.98082+00
 330 | nautobot_device_onboarding | 0003_onboardingtask_label            | 2024-10-17 20:46:58.080157+00
 331 | nautobot_device_onboarding | 0008_alter_onboardingtask_options    | 2024-10-17 20:46:58.153406+00
 332 | nautobot_device_onboarding | 0009_remove_models                   | 2024-10-17 20:46:58.583387+00
 394 | nautobot_device_onboarding | 0001_squash__0001_0004_0005_0006     | 2024-10-17 20:47:02.322324+00
(16 rows)

nautobot=# select * from django_migrations where app = 'nautobot_device_onboarding';
 id  |            app             |               name               |            applied            
-----+----------------------------+----------------------------------+-------------------------------
 394 | nautobot_device_onboarding | 0001_squash__0001_0004_0005_0006 | 2024-10-17 20:47:02.322324+00
(1 row)

gsnider2195 avatar Oct 17 '24 20:10 gsnider2195

This was fixed upstream in Django. Closing

gsnider2195 avatar Oct 17 '24 21:10 gsnider2195