From 729ea4c26ceabf59f658bb7c72af70491bff1331 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Wed, 4 Nov 2015 20:00:39 +0100 Subject: [PATCH] README.md --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 283097855..6fb99f4da 100644 --- a/README.md +++ b/README.md @@ -1125,10 +1125,14 @@ migrator.registerMigration("AddAgeToPersons") { db in try db.execute("ALTER TABLE persons ADD COLUMN age INT") } +// (Future migrations here) + try migrator.migrate(dbQueue) ``` -Each migration runs in a separate transaction. Should one throw an error, its transaction is rollbacked, and subsequent migrations do not run. +**Each migration runs in a separate transaction.** Should one throw an error, its transaction is rollbacked, subsequent migrations do not run, and the error is eventually thrown by `migrator.migrate(dbQueue)`. + +**The memory of applied migrations is stored in the database itself** (in a reserved table). When you are tuning your migrations, you may need to execute one several times. All you need then is to feed your application with a database file from a previous state. You might use Database.executeMultiStatement(): this method takes a SQL string containing multiple statements separated by semi-colons: