I can't get migrations working with my team. We are undergoing some major db changes that involve adding/removing keys. The database has a lot of orphaned data, and without removing it first with a migration, the key cannot be added by source control on get latest.
Steps we have taken:
- Both myself and my colleague have linked to a migrations folder in our TFS on the setup tab.
- I right clicked on one change to one table, and selected add migration script.
- I then copied in the migration script that I have written in a separate file.
- After giving the migration script a name, I then clicked proceed to commit. I see that I am committing both the migration script and the schema change I selected.
- I committed the changes in.
- I can now see that there is a migration on the migrations tab associated with the change between two revisions. The one previous, and the one that was created when I committed in.
- My colleague can also see this migration on their migrations tab.
- I checked the extended properties of my colleagues database, and I see they are definitely on a revision prior to the first revision referenced by the migration script.
- My colleague then "Gets Latest".
- Error is thrown.
- We click on "Manually edit script". I can see that migration script I wrote is not included in the sql that it intends to execute.... This is why it fails, because the foreign key can't be added.
- I noticed that there is a section at the bottom of the SQL to be executed setting extended properties (of note: one stores a location to the migrations folder).
- I ran the extended properties section of the script seperately in-case as this was the first attempt of getting a migration, it was breaking?
- No luck. The second attempt of getting latest results in the same error and the SQL script it is trying to run is no different.
Any help would be hugely appreciated.
Many thanks in advance.