<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -18,12 +18,16 @@ module AutoMigrations
     end
   end
   
-  def self.schema_to_migration
-    schema = File.read(File.join(RAILS_ROOT, &quot;db&quot;, &quot;schema.rb&quot;))
-    schema.gsub!(/#(.)+\n/, '')
-    schema.sub!(/ActiveRecord::Schema.define(.+)do[ ]?\n/, '')
-    schema.gsub!(/^/, '  ')
-    schema = &quot;class InitialSchema &lt; ActiveRecord::Migration\n  def self.up\n&quot; + schema
+  def self.schema_to_migration(with_reset = false)
+    schema_in = File.read(File.join(RAILS_ROOT, &quot;db&quot;, &quot;schema.rb&quot;))
+    schema_in.gsub!(/#(.)+\n/, '')
+    schema_in.sub!(/ActiveRecord::Schema.define(.+)do[ ]?\n/, '')
+    schema_in.gsub!(/^/, '  ')
+    schema = &quot;class InitialSchema &lt; ActiveRecord::Migration\n  def self.up\n&quot; 
+    schema += &quot;    # We're resetting the migrations database...\n&quot; +
+              &quot;    drop_table :schema_migrations\n&quot; +
+              &quot;    initialize_schema_migrations_table\n\n&quot; if with_reset
+    schema += schema_in
     schema &lt;&lt; &quot;\n  def self.down\n&quot;
     schema &lt;&lt; (ActiveRecord::Base.connection.tables - %w(schema_info schema_migrations)).map do |table| 
                 &quot;    drop_table :#{table}\n&quot;</diff>
      <filename>lib/auto_migrations.rb</filename>
    </modified>
    <modified>
      <diff>@@ -11,5 +11,10 @@ namespace :db do
     task :to_migration =&gt; :environment do
       AutoMigrations.schema_to_migration
     end
+
+    desc &quot;Create migration from schema.rb and reset migrations log&quot;
+    task :to_migration_with_reset =&gt; :environment do
+      AutoMigrations.schema_to_migration(true)
+    end
   end
 end</diff>
      <filename>tasks/auto_migrations_tasks.rake</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>4154d21011b9731a1cc16e53f03b18e249377d58</id>
    </parent>
  </parents>
  <author>
    <name>Matt Lightner</name>
    <email>mlightner@gmail.com</email>
  </author>
  <url>http://github.com/pjhyett/auto_migrations/commit/cb2b0f36a60c8ec8c62354e8f29109c66afb50fb</url>
  <id>cb2b0f36a60c8ec8c62354e8f29109c66afb50fb</id>
  <committed-date>2009-02-16T12:06:40-08:00</committed-date>
  <authored-date>2009-01-31T05:41:29-08:00</authored-date>
  <message>Added the ability to reset schema migrations table when creating a fresh migration from schema.db

Signed-off-by: PJ Hyett &lt;pjhyett@gmail.com&gt;</message>
  <tree>1c64a80469e5b97bb2fb10d970dcf1f2daf4c8fe</tree>
  <committer>
    <name>PJ Hyett</name>
    <email>pjhyett@gmail.com</email>
  </committer>
</commit>
