Browse files

Make destructive nature of auto_migrate! clearer

  • Loading branch information...
1 parent b3b55fb commit 731083b7fb336f1a26db9987f87c01b471f29151 @namelessjon namelessjon committed Apr 26, 2010
Showing with 12 additions and 8 deletions.
  1. +12 −8 getting-started.markdown
View
20 getting-started.markdown
@@ -159,19 +159,23 @@ Set up your database tables
---------------------------
{% highlight ruby %}
-Post.auto_migrate!
-Category.auto_migrate!
-Comment.auto_migrate!
-Categorization.auto_migrate!
+DataMapper.auto_migrate!
{% endhighlight %}
-This will issue the necessary `CREATE` statements to define each storage according
-to their properties.
+This will issue the necessary `CREATE` statements (`DROP`ing the table first, if
+it exists) to define each storage according to their properties. After
+`auto_migrate!` has been run, the database should be in a pristine state, reset
+back to the starting state.
-You could also do:
+This can be too extreme, so you could also do:
{% highlight ruby %}
-DataMapper.auto_migrate!
+DataMapper.auto_upgrade!
{% endhighlight %}
+This tries to make the schema match the model. It will `CREATE` new tables, and
+add columns to existing tables. It won't change any existing columns though
+(say, to add a NOT NULL constraint) and it doesn't drop any columns. Both these commands
+also can be used on an individual model (e.g. `Post.auto_migrate!`)
+
[DataMapper_Resource]:http://www.yardoc.org/docs/datamapper-dm-core/DataMapper/Resource

0 comments on commit 731083b

Please sign in to comment.