How to work with a constantly changing database in the version control system?

0 like 0 dislike
4 views
Use subversion, MySQL, NetBeans.


I would like to than code base, too, would be in svn. Base of the project is updated quite often. As with the lowest labor costs to upgrade, fix, etc. tables, procedures, views, etc.?
by | 4 views

6 Answers

0 like 0 dislike
by
0 like 0 dislike
by
0 like 0 dislike
store sql generation database?
\r
use flexible ORM that allows you to store the dB structure to config. type hibernate for java or doctrine for php
by
0 like 0 dislike
Use the following option:
\r
\r
    \r
  1. a new database always compatible with the previous version of the code (that is, backward compatibility, 1 for the gear train is maintained — and if the code will have to roll back to the old, with a new base it will work correctly). in fact, it looks like this: if you want to delete a field in the database to display N, then the field is removed only in the computation N+1
  2. \r
  3. changes in the DB structure from version to version are stored in the file sql/alter/n.sql. the changes are transferred to /sql/alter/done. the files are numbered in order, each developer create their own new to ismerete conflict with merge
  4. \r

In the end when rolling out new code, we first performed alter's, then pour code. In case the code is error — the old code is guaranteed to work with the new base.
by
0 like 0 dislike
Yuzayte Git
by
0 like 0 dislike
In Rails, this problem is solved by means of migrations. Every change of the database is described using DSL and not applied directly to the base. It turns out that migration is a normal source code files, which are easily entered into the same svn. For PHP (if on it) you can either look for the right library that will translate php code into sql queries, or write your own. Complex there's nothing there.
by

Related questions

110,608 questions
257,186 answers
0 comments
28,701 users