Browse Source

Merge pull request #11 from andreacampi/COOK-1333

[COOK-1333] Add an example of how to run migrations.
Joshua Timberman 12 years ago
parent
commit
fe76cdd295
1 changed files with 18 additions and 0 deletions
  1. 18 0
      README.md

+ 18 - 0
README.md

@@ -172,6 +172,24 @@ Attributes from the application and from sub-resources are merged together:
     # restart_command #=> kill -1 `cat /var/run/one.pid` && touch /tmp/something
     # environment #=> LC_ALL=en_US FOO=baz
 
+Most databases have the concept of migrations (or you can just use your own):
+
+    application "my_app" do
+      path "/deploy/to/dir"
+      owner "app-user"
+      group "app-group"
+
+      repository "http://git.example.com/my-app.git"
+      revision "production"
+
+      php do
+        migrate true
+        migration_command "your-applications-migrate-command"
+      end
+    end
+
+This will run `your-applications-migrate-command`, with the current directory set to the directory of the current checkout.
+
 To use the application cookbook, we recommend creating a role named after the application, e.g. `my_app`. Create a Ruby DSL role in your chef-repo, or create the role directly with knife.
 
     % knife role show my_app -Fj