iati-data-access / data-backend

GNU Affero General Public License v3.0
0 stars 0 forks source link

Database migrations not up to date with model #12

Open simon-20 opened 11 months ago

simon-20 commented 11 months ago

Setup a clean install, then run flask db upgrade. Then run flask db check. It reports that new upgrade operations have been detected.

(pyenv) user@workpc:~/dev/data-backend$ flask db check
INFO  [alembic.runtime.migration] Context impl PostgresqlImpl.
INFO  [alembic.runtime.migration] Will assume transactional DDL.
INFO  [alembic.autogenerate.compare] Detected added index 'ix_iati_activity_reporting_organisation' on '['reporting_organisation']'
INFO  [alembic.autogenerate.compare] Detected added foreign key (provider_organisation_type)(code) on table iati_line
INFO  [alembic.autogenerate.compare] Detected added foreign key (receiver_organisation_type)(code) on table iati_line
ERROR [flask_migrate] Error: New upgrade operations detected: [('add_index', Index('ix_iati_activity_reporting_organisation', Column('reporting_organisation', UnicodeText(), table=<iati_activity>))), ('add_fk', ForeignKeyConstraint(<sqlalchemy.sql.base.ReadOnlyColumnCollection object at 0x7fb6a71ad2c0>, None, ondelete='CASCADE', table=Table('iati_line', MetaData(), Column('provider_organisation_type', NullType(), ForeignKey('provider_organisation_type.code'), table=<iati_line>), schema=None))), ('add_fk', ForeignKeyConstraint(<sqlalchemy.sql.base.ReadOnlyColumnCollection object at 0x7fb6a71ad360>, None, ondelete='CASCADE', table=Table('iati_line', MetaData(), Column('receiver_organisation_type', NullType(), ForeignKey('receiver_organisation_type.code'), table=<iati_line>), schema=None)))]

@markbrough, I will fix this next week.

markbrough commented 11 months ago

I think I didn't include these migrations at the time as I wasn't sure what the effect would be on the existing database - these are changes to the data model made recently.

simon-20 commented 11 months ago

Cool, okay. I'll investigate and test before committing anything :)