Snapshot with dependencies #11
Labels
No labels
bug
confirmed
critical
discussion
documentation
Doing
enhancement
suggestion
support
To Do
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: hazaar/hazaar-dbi#11
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I'm getting into a bit of trouble with the order in which things are being deposited into the migration file.
For example, a snapshot I just produced created the constraints array BEFORE the tables array because a table that was processed was not new and only had a column change. This causes an 'alter' section to be created, not a table section. Then constraints were processed on the table, creating the 'table' section. Then finally the tables were processed creating the 'tables' section.
When we run the migrate replay, everything is done in the order in which it exists in the file. This is on purpose so that the order can be defined specifically. However, because the snapshot messed things up, constraints were attempted to be created on tables that did not yet exist.
This will be fixed in stages.
Stage 1
Define a specific order in the
$changes
array. So do 'drop' first, which removed things such as constraints and tables. Then 'alter' next. Then 'create' using the order of 'tables', 'constraints', 'indexes'.Stage 2
We will need some form of intelligent dependency management. That way we can generate a migration file that will replay things in the correct order. So if we are creating a constraint, we can be assured that the table it is referencing has been created.
added ~160 label
removed ~160 label
assigned to @jamie
mentioned in issue #27
created merge request !6 to address this issue
mentioned in merge request !6
This has completely changed. The
$changes
is being completely defined upfront now, but it's layout has changed slightly. Instead of the sequence beingmode->action->type
it is nowmode->type->action
. This means that all table actions are performed first, then all constraint actions, followed by index, view and functions. This is in line with the way the whole schema file operates and makes more sense.Because this is a change to the layout of a schema migration file, I have added a
version
attribute. If this does not exist, then the version is1
. Version2
is this new version and we loop through the migration actions in a slightly different way. Things should work as they did previously as there were no changes to the actual action execution code, just the order in which the migration sections are processed. It will still be possible to process version 1 migration scripts going forward so there is no need for developers to update old scripts.mentioned in commit
054068652d
mentioned in commit
daa54ece4a
closed via merge request !6
closed via commit
054068652d