nautobot-app-ssot icon indicating copy to clipboard operation
nautobot-app-ssot copied to clipboard

Installing SSoT App to existing Nautobot 2.1.5 installation fails migrations

Open Renrut5 opened this issue 10 months ago • 1 comments

Environment

  • Python version: 3.9.18
  • Nautobot version: 2.1.5
  • nautobot-ssot version: 2.5.0

Expected Behavior

Nautobot SSoT App successfully migrate with existing Nautobot 2.1.5 installation when Nautobot installation already exists and migrated.

Observed Behavior

Installation failed during migrations:

Error Message:

psycopg2.errors.UndefinedColumn: column ipam_vlan.location_id does not exist
LINE 1: ...M "ipam_vlan" LEFT OUTER JOIN "dcim_location" ON ("ipam_vlan...

Steps to Reproduce

  1. Set up existing Nautobot 2.1.5 installation with out SSoT app installed
  2. Migrate Nautobot instance (without SSoT)
  3. Install SSoT application into Nautobot
  4. Attempt to migrate SSoT changes

Renrut5 avatar Apr 01 '24 13:04 Renrut5

I think this can be fixed by not importing the Models directly in https://github.com/nautobot/nautobot-app-ssot/blob/fd3299780bcdfd60b7408f9e842978c602ead04d/nautobot_ssot/migrations/0007_replace_dashed_custom_fields.py#L2-L5

EX:

for app, model [("dcim", "Device"), ("ipam", "VLAN")...]:
    model = apps.get_model(app, model)
    ...

https://docs.djangoproject.com/en/5.0/topics/migrations/#historical-models

jmcgill298 avatar Apr 01 '24 14:04 jmcgill298