we changed small part of schema of database our project. originally, 1 of columns allowed null never utilized. implemented feature utilized column, , require loaded integer. have done adding following table definition:
column("amount", integer, nullable = false, default = 1) obviously, run if creating new table. of our users have pre-existing database, run migration converts previous values 1. works greats.
however, if have user downgrade reason , program adds row, value again null. when upgrade again, conversion not run again. limitation in our (simple) migration process (it increments db version, not decrement, not know run conversion database incremented)
this causes issue because have null value not expected. there way define default value in sqlalchemy when loaded database, , set 1 if value illegal?
i think downgrading databases dangerous thing in complex systems. imagine in version x have business rule tells "in table y, records should unique". then, in version x + 1 business rule falls down (is obsolete, no longer valid). imagine user works in version x + 1 while sudently realise wants go version x. have version x business rule broken.
another thing you've said (in other words) if user makes upgrade , others running (are logged in or somehow) older binaries. in case think design issue , should check happening (maybe having version field in database , check current client version equal database version. if not, force upgrade current client).
Comments
Post a Comment