Frage

Das ist eine Frage für die von Ihnen auf einem Team von Entwicklern zu entwickeln, wo alle Sie getrennte Datenbanken haben. Sie Versionierung Ihrer Datenbank Quellcodeverwaltung und andere Tools, die automatisch Datenbanken dev bringen wird auf dem neuesten Stand auf die neueste Version der Datenbank (Schema, Daten, SP, Funktionen, etc.).

OK Great! Aber warte! Was ist, wenn Sie auf der Version 4.0 der Software entwickeln, aber jetzt müssen Sie Zweige auf den 3.2 Zweig wechseln einen Fehler zu beheben? Das Schema könnte (fast ist sicher) ganz anders jetzt ...

Ich nehme an, wenn Sie durch den zusätzlichen Aufwand zu schreiben Rollback-Skripte zusammen mit Ihrer Änderungsskripts gehen, dies funktionieren könnte. Aber das scheint wie eine Menge Arbeit - ist es wirklich wert

War es hilfreich?

Lösung

Much easier would be to create a new 3.2-branch database and work with that while working on the 3.2-branch code. It doesn't seem reasonable to me to require that each developer has exactly one database to work with.

Andere Tipps

I'm going on a limb and assume that you are versioning the database as a binary? If all your database assets were in the form of constructive code (eg SQL scripts and/or text data dumps), the solution would be simple, as suggested by Mark: store these assets as part of the development branch. To work on version 3.2, switch the branch, re-run the create scripts and presto, 3.2 database. Merging would be just as easy as with regular code (or just as painful, depending on your version control system of choice).

Here are some suggestions to work in this mode:

  • If creating the database instances from text is too slow, make a cache on a shared disk volume, keyed by the contents of all the schema / data files (or the MD5 sum thereof).
  • Write a pre-commit hook to ensure that the schema and data dumps in the developer's instance are the same as the ones under version control. This prevents people from making changes to their dev database with an interactive tool, and then forgetting to commit them.
  • You mention change scripts; treat them as a liability. While they may be required by your deployment scenario (eg for customers who want to upgrade in-place), they duplicate information from the version history of the database, and per Murphy's law duplication means desynchronization sooner or later. Try to auto-generate the change scripts from the versioned database assets using "diff"; or if this cannot be achieved, dedicate some serious unit tests to database upgrades.
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top