<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>mack-active_record/lib/mack-active_record/tasks/test_tasks.rake</filename>
    </added>
    <added>
      <filename>mack-active_record/spec/create_and_drop_task_helper.rb</filename>
    </added>
    <added>
      <filename>mack-active_record/spec/fixtures/002_create_zoos.fixture</filename>
    </added>
    <added>
      <filename>mack-active_record/spec/fixtures/003_create_animals.fixture</filename>
    </added>
    <added>
      <filename>mack-active_record/spec/fixtures/mig_create_zoos_empty.fixture</filename>
    </added>
    <added>
      <filename>mack-active_record/spec/fixtures/mig_create_zoos_full.fixture</filename>
    </added>
    <added>
      <filename>mack-active_record/spec/fixtures/mysql.fixture</filename>
    </added>
    <added>
      <filename>mack-active_record/spec/fixtures/mysql_schema_structure.sql.fixture</filename>
    </added>
    <added>
      <filename>mack-active_record/spec/fixtures/partial_single_model_error.html.erb.fixture</filename>
    </added>
    <added>
      <filename>mack-active_record/spec/fixtures/postgres_schema_structure.sql.fixture</filename>
    </added>
    <added>
      <filename>mack-active_record/spec/fixtures/postgresql.fixture</filename>
    </added>
    <added>
      <filename>mack-active_record/spec/fixtures/sqlite3_schema_structure.sql.fixture</filename>
    </added>
    <added>
      <filename>mack-active_record/spec/lib/database_spec.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -15,7 +15,7 @@ require File.join(crt, &quot;rake_task_requires&quot;)
   s.files = FileList['lib/**/*.*', 'README', 'doc/**/*.*', 'bin/**/*.*']
   s.require_paths &lt;&lt; 'lib'
 
-  s.add_dependency(&quot;activerecord&quot;, &quot;2.0.2&quot;)
+  s.add_dependency(&quot;activerecord&quot;, &quot;2.1.0&quot;)
   s.extra_rdoc_files = [&quot;README&quot;]
   s.has_rdoc = true
   s.required_ruby_version = &quot;&gt;= 1.8.6&quot;</diff>
      <filename>mack-active_record/Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -67,6 +67,38 @@ module Mack
           FileUtils.rm_rf(dbs[:database]) if mode == :drop or mode == :drop_and_create
       end
     end
+    
+    def self.load_structure(file, env = Mack.env)
+      Mack::Database.establish_connection(env)
+      dbs = db_settings(env)
+      sql = File.read(file)
+      case dbs[:adapter]
+      when &quot;mysql&quot;
+        sql.split(&quot;;&quot;).each do |s|
+          s.strip! 
+          ActiveRecord::Base.connection.execute(s) unless s.blank?
+        end
+      else
+        ActiveRecord::Base.connection.execute(sql) unless sql.blank?
+      end
+    end
+    
+    def self.dump_structure(env = Mack.env)
+      Mack::Database.establish_connection(env)
+      dbs = db_settings(env)
+      structure = &quot;&quot;
+      output_file = File.join(Mack.root, &quot;db&quot;, &quot;#{env}_schema_structure.sql&quot;)
+      case dbs[:adapter]
+      when &quot;mysql&quot;
+        File.open(output_file, &quot;w&quot;) {|f| f.puts ActiveRecord::Base.connection.structure_dump}
+      when &quot;postgresql&quot;
+        `pg_dump -i -U &quot;#{dbs[:username]}&quot; -s -x -O -n #{ENV[&quot;SCHEMA&quot;] ||= &quot;public&quot;} -f #{output_file} #{dbs[:database]}`
+      when &quot;sqlite3&quot;
+        `sqlite3 #{dbs[:database]} .schema &gt; #{output_file}`
+      else
+        raise &quot;Task not supported for '#{dbs[:adapter]}'&quot;
+      end
+    end
             
     private
     </diff>
      <filename>mack-active_record/lib/mack-active_record/database.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,5 @@
 require 'pathname'
 require Pathname(__FILE__).dirname.expand_path.parent.parent + 'spec_helper'
-require Pathname(__FILE__).dirname.expand_path + 'create_and_drop_task_helper'
 
 describe &quot;rake&quot; do
 </diff>
      <filename>mack-active_record/spec/lib/tasks/db_create_drop_tasks_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,5 @@
 require 'pathname'
 require Pathname(__FILE__).dirname.expand_path.parent.parent + 'spec_helper'
-require Pathname(__FILE__).dirname.expand_path + 'create_and_drop_task_helper'
 
 describe &quot;rake&quot; do
 </diff>
      <filename>mack-active_record/spec/lib/tasks/db_migration_tasks_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -15,6 +15,7 @@ $genosaurus_output_directory = Mack.root
 
 require File.join(File.dirname(__FILE__), &quot;..&quot;, &quot;..&quot;, &quot;mack-paths&quot;, &quot;lib&quot;, &quot;mack-paths&quot;)
 
+require File.join(File.dirname(__FILE__), 'create_and_drop_task_helper')
 
 def migrations_directory
   File.join(Mack.root, &quot;db&quot;, &quot;migrations&quot;)
@@ -24,6 +25,10 @@ def cleanup(file)
   File.delete(file) if !file.nil? and File.exists?(file)
 end
 
-def fixture(file)
-  File.read(File.join(File.dirname(__FILE__), &quot;lib&quot;, &quot;fixtures&quot;, file + &quot;.fixtures&quot;))
+def fixture(name)
+  File.read(fixture_location(name))
+end
+
+def fixture_location(name)
+  File.join(File.dirname(__FILE__), &quot;fixtures&quot;, &quot;#{name}.fixture&quot;)
 end</diff>
      <filename>mack-active_record/spec/spec_helper.rb</filename>
    </modified>
    <modified>
      <diff>@@ -51,7 +51,6 @@ module Mack
       output_file = File.join(Mack.root, &quot;db&quot;, &quot;#{env}_#{repis}_schema_structure.sql&quot;)
       case adapter.class.name
       when /Mysql/
-        sql = &quot;SHOW FULL TABLES WHERE Table_type = 'BASE TABLE'&quot;
         sql = &quot;SHOW TABLES&quot;
         adapter.query(sql).each do |res|
           show = adapter.query(&quot;SHOW CREATE TABLE #{res}&quot;).first</diff>
      <filename>mack-data_mapper/lib/mack-data_mapper/database.rb</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>mack-active_record/spec/lib/fixtures/002_create_zoos.fixtures</filename>
    </removed>
    <removed>
      <filename>mack-active_record/spec/lib/fixtures/003_create_animals.fixtures</filename>
    </removed>
    <removed>
      <filename>mack-active_record/spec/lib/fixtures/mig_create_zoos_empty.fixtures</filename>
    </removed>
    <removed>
      <filename>mack-active_record/spec/lib/fixtures/mig_create_zoos_full.fixtures</filename>
    </removed>
    <removed>
      <filename>mack-active_record/spec/lib/fixtures/mysql.fixtures</filename>
    </removed>
    <removed>
      <filename>mack-active_record/spec/lib/fixtures/partial_single_model_error.html.erb.fixtures</filename>
    </removed>
    <removed>
      <filename>mack-active_record/spec/lib/fixtures/postgresql.fixtures</filename>
    </removed>
    <removed>
      <filename>mack-active_record/spec/lib/tasks/create_and_drop_task_helper.rb</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>7a172b53d81204a5afe56ec67926eb5a3e9e362e</id>
    </parent>
  </parents>
  <author>
    <name>Mark Bates</name>
    <email>mark@markbates.com</email>
  </author>
  <url>http://github.com/markbates/mack-more/commit/5b2d5db9aeea49c0b4fe749a139b74c7f9cfb874</url>
  <id>5b2d5db9aeea49c0b4fe749a139b74c7f9cfb874</id>
  <committed-date>2008-08-12T10:08:59-07:00</committed-date>
  <authored-date>2008-08-12T10:08:59-07:00</authored-date>
  <message>Added 'proper' test:setup tasks for data_mapper and active_record. [#67 state:resolved]</message>
  <tree>4251450dda7aaedd0b3b0380a12fb641f09c220b</tree>
  <committer>
    <name>Mark Bates</name>
    <email>mark@markbates.com</email>
  </committer>
</commit>
