Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple migrations not reversible #288

Open
whitej6 opened this issue Mar 13, 2024 · 1 comment
Open

Multiple migrations not reversible #288

whitej6 opened this issue Mar 13, 2024 · 1 comment

Comments

@whitej6
Copy link
Contributor

whitej6 commented Mar 13, 2024

Environment

  • Python version: 3.11
  • Nautobot version: 2.1.X
  • nautobot-circuit-maintenance version:

Expected Behavior

Observed Behavior

Following migrations throw unable to reverse exceptions

  • 0013 (can be noop)
  • 0010 (can be noop)
  • 0008 (can be noop)
  • 0004 (can be noop)
  • 0003 (can be noop)

Other non-reversable migrations not-related to reverse_code

  • 0009 (needs documented steps to delete all data first otherwise not reversable)

Steps to Reproduce

  1. nautobot-server migrate nautobot_circuit_maintenance zero
@gsnider2195
Copy link
Contributor

Can we also update the migrations to separate the data migrations from the schema migrations? These should not be in the same file. Also, take another look at this migration file with different logic for mysql and postgres:

if connection.vendor == "postgresql":
operations = [
migrations.AddField(
model_name="rawnotification",
name="_raw_md5",
field=models.TextField(null=True),
),
migrations.RunPython(gen_raw_md5),
migrations.AlterField(
model_name="rawnotification",
name="_raw_md5",
field=models.TextField(unique=True),
),
migrations.AlterField(
model_name="rawnotification",
name="raw",
field=models.TextField(),
),
]
elif connection.vendor == "mysql":
operations = [
migrations.AddField(
model_name="rawnotification",
name="_raw_md5",
field=models.CharField(null=True, max_length=512),
),
migrations.RunPython(gen_raw_md5),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants