fresh database

9 views
Skip to first unread message

kirill.petrov

unread,
Sep 15, 2009, 10:09:18 PM9/15/09
to Carbon Five DB Migration Discussion Group
What happens if I want to create a fresh database? Do I have to run
all the migrations one by one? Theoretically that might be expensive
as you might accumulate a bunch of the scripts and they might be time
consuming, is there a shortcut? This might be important for the
integration environment.

thank you,

Kirill

Christian Nelson

unread,
Sep 15, 2009, 10:28:28 PM9/15/09
to c5-db-m...@googlegroups.com
Kirill,

Running db-migration:reset is the quickest way to create a new database that is up to date (i.e. all migrations applied).  The reset target is a composite of the targets drop, create, and migrate.

We roll migrations up from time to time, when we have enough of them and it's starting to get slow to run them all.  You create a new migration that includes the complete up-to-date state of the database (minus the schema_version table) and remove all of the previous migrations.  All of the CREATE statements in the new uber-migration should include the IF NOT EXISTS keywords.

If you haven't yet found it, there is a summary of all db-migration goals and parameters on the project website.

Cheers,
Christian
--
Christian Nelson -- (e) cne...@slac.com -- (m) 415-378-3988
Reply all
Reply to author
Forward
0 new messages