S
S
Sergey Beresnev2010-10-20 04:40:32
MySQL
Sergey Beresnev, 2010-10-20 04:40:32

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

We use subversion, MySQL, NetBeans.
It would be desirable that, besides the code, the base would also be in svn. The project database is updated quite often. How to update, fix, etc. with the least effort. tables, procedures, views, etc.?

Answer the question

In order to leave comments, you need to log in

6 answer(s)
M
mythmaker, 2010-10-20
@sectus

Pay attention to liquibase

M
mecommayou, 2010-10-20
@mecommayou

habrahabr.ru/blogs/php/63585/

O
ojiga, 2010-10-20
@ojiga

store sql database generation?
use a flexible ORM that allows you to store the database structure in configs. like hibernate for java or doctrine for php

C
casey, 2010-10-20
@casey

I use the following at work:

  1. the new base is always compatible with the previous version of the code (that is, backward compatibility 1 for the layout is ironically preserved - and if the code has to be rolled back to the old one, then it will work correctly with the new base). in fact, it looks like this: if you need to delete some field in the database in layout N, then the field will be deleted only when layout N + 1
  2. changes in the database structure from version to version are stored in the sql/alter/n.sql files. changes made are transferred to /sql/alter/done. files are numbered in order, each developer creates a new one for himself to avoid conflict during merge

As a result, when rolling out a new code, we first execute alters, then pour the code. If there are errors in the code, the old code is guaranteed to work with the new base.

M
multik, 2010-10-20
@multik

Use Git

K
kirsan_vlz, 2010-10-20
@kirsan_vlz

Rails solves this problem with migrations. Each database change is described through the DSL, and not applied directly to the database. It turns out that migrations are ordinary files with source code that are easily brought into the same svn. For PHP (if development is based on it), you can either look for a suitable library that will translate php code into sql queries, or write it yourself. There is nothing difficult there.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question