Models should be the same as the state in DB after migration
We are using declarative_base in neutron.
For creation we are using migrations.
We don't have any tests that checks, that our models are up-to-date.
1) Use always explicit nullable parameter for columns. There are mistakes in current neutron models implementation. (sometimes in schema is nullable=True and in model nullable=False and vise versa). Also at this moment when you see Column description without nullable, you couldn't be sure that is author forget to set nullable='False' or it is really nullable='True'. So the easiest way to track all this and to fix and to avoid such things is to have one rule "always use explicit nullable".
2) Add in __table_args__ indexes and unique constraints
3) Fix all mistakes in models
4) Fix all mistekes in migrations
5) Sync effects of migrations in different backends.
6) Add tests that ensures that models are up-to-date.
This will allow us to find probably some mistake, or missing indexes and make work with db more clean.
Blueprint information
- Status:
- Complete
- Approver:
- None
- Priority:
- Undefined
- Drafter:
- None
- Direction:
- Needs approval
- Assignee:
- Ann Taraday
- Definition:
- New
- Series goal:
- None
- Implementation:
- Implemented
- Milestone target:
- None
- Started by
- Armando Migliaccio
- Completed by
- Armando Migliaccio
Related branches
Related bugs
Sprints
Whiteboard
Gerrit topic: https:/
Gerrit topic: https:/
Addressed by: https:/
Sync models with migrations
Addressed by: https:/
Set correct nullable parameter for columns