<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>mack-data_mapper/spec/fixtures/test_test_mysql_schema_structure.sql.fixture</filename>
    </added>
    <added>
      <filename>mack-data_mapper/spec/fixtures/test_test_postgres_schema_structure.sql.fixture</filename>
    </added>
    <added>
      <filename>mack-data_mapper/spec/fixtures/test_test_sqlite3_schema_structure.sql.fixture</filename>
    </added>
    <added>
      <filename>mack-data_mapper/spec/lib/database_spec.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -27,33 +27,6 @@ module Mack
       Mack::Database.establish_connection(env)
       drop_database(repis)
     end
-
-    # abcs = ActiveRecord::Base.configurations
-    # case abcs[RAILS_ENV][&quot;adapter&quot;]
-    # when &quot;mysql&quot;, &quot;oci&quot;, &quot;oracle&quot;
-    #   ActiveRecord::Base.establish_connection(abcs[RAILS_ENV])
-    #   File.open(&quot;db/#{RAILS_ENV}_structure.sql&quot;, &quot;w+&quot;) { |f| f &lt;&lt; ActiveRecord::Base.connection.structure_dump }
-    # when &quot;postgresql&quot;
-    #   ENV['PGHOST']     = abcs[RAILS_ENV][&quot;host&quot;] if abcs[RAILS_ENV][&quot;host&quot;]
-    #   ENV['PGPORT']     = abcs[RAILS_ENV][&quot;port&quot;].to_s if abcs[RAILS_ENV][&quot;port&quot;]
-    #   ENV['PGPASSWORD'] = abcs[RAILS_ENV][&quot;password&quot;].to_s if abcs[RAILS_ENV][&quot;password&quot;]
-    #   search_path = abcs[RAILS_ENV][&quot;schema_search_path&quot;]
-    #   search_path = &quot;--schema=#{search_path}&quot; if search_path
-    #   `pg_dump -i -U &quot;#{abcs[RAILS_ENV][&quot;username&quot;]}&quot; -s -x -O -f db/#{RAILS_ENV}_structure.sql #{search_path} #{abcs[RAILS_ENV][&quot;database&quot;]}`
-    #   raise &quot;Error dumping database&quot; if $?.exitstatus == 1
-    # when &quot;sqlite&quot;, &quot;sqlite3&quot;
-    #   dbfile = abcs[RAILS_ENV][&quot;database&quot;] || abcs[RAILS_ENV][&quot;dbfile&quot;]
-    #   `#{abcs[RAILS_ENV][&quot;adapter&quot;]} #{dbfile} .schema &gt; db/#{RAILS_ENV}_structure.sql`
-    # when &quot;sqlserver&quot;
-    #   `scptxfr /s #{abcs[RAILS_ENV][&quot;host&quot;]} /d #{abcs[RAILS_ENV][&quot;database&quot;]} /I /f db\\#{RAILS_ENV}_structure.sql /q /A /r`
-    #   `scptxfr /s #{abcs[RAILS_ENV][&quot;host&quot;]} /d #{abcs[RAILS_ENV][&quot;database&quot;]} /I /F db\ /q /A /r`
-    # when &quot;firebird&quot;
-    #   set_firebird_env(abcs[RAILS_ENV])
-    #   db_string = firebird_db_string(abcs[RAILS_ENV])
-    #   sh &quot;isql -a #{db_string} &gt; db/#{RAILS_ENV}_structure.sql&quot;
-    # else
-    #   raise &quot;Task not supported by '#{abcs[&quot;test&quot;][&quot;adapter&quot;]}'&quot;
-    # end
     
     def self.structure_dump(env = Mack.env, repis = :default)
       adapter = repository(repis).adapter
@@ -61,28 +34,22 @@ module Mack
       structure = &quot;&quot;
       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
-            structure += show.attributes[&quot;create table&quot;.to_sym]
-            structure += &quot;;\n\n&quot;
-          end
-          # puts structure
-          File.open(output_file, &quot;w&quot;) {|f| f.puts structure}
-        when /Postgres/
-          `pg_dump -i -U &quot;#{uri.user}&quot; -s -x -O -f #{output_file} #{uri.basename}`
-          # setup_temp(uri, &quot;postgres&quot;)
-          # repository(:tmp) do |repo|
-          #   puts &quot;Creating (PostgreSQL): #{uri.basename}&quot;
-          #   repo.adapter.execute &quot;CREATE DATABASE #{uri.basename} ENCODING = 'utf8'&quot;
-          # end
-        when /Sqlite3/
-          db_dir = File.join(Mack.root, &quot;db&quot;)
-          `sqlite3 #{File.join(db_dir, uri.basename)} .schema &gt; #{output_file}`
-        else
-          raise &quot;Task not supported for '#{repository(repis).adapter.class.name}'&quot;
+      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
+          structure += show.attributes[&quot;create table&quot;.to_sym]
+          structure += &quot;;\n\n&quot;
+        end
+        File.open(output_file, &quot;w&quot;) {|f| f.puts structure}
+      when /Postgres/
+        `pg_dump -i -U &quot;#{uri.user}&quot; -s -x -O -f #{output_file} #{uri.basename}`
+      when /Sqlite3/
+        db_dir = File.join(Mack.root, &quot;db&quot;)
+        `sqlite3 #{File.join(db_dir, uri.basename)} .schema &gt; #{output_file}`
+      else
+        raise &quot;Task not supported for '#{repository(repis).adapter.class.name}'&quot;
       end
     end
     
@@ -100,50 +67,49 @@ module Mack
     def self.create_database(repis = :default)
       uri = repository(repis).adapter.uri
       case repository(repis).adapter.class.name
-        when /Mysql/
-          setup_temp(uri, &quot;mysql&quot;)
-          repository(:tmp) do |repo|
-            puts &quot;Creating (MySQL): #{uri.basename}&quot;
-            repo.adapter.execute &quot;CREATE DATABASE `#{uri.basename}` DEFAULT CHARACTER SET `utf8`&quot;
-          end
-        when /Postgres/
-          setup_temp(uri, &quot;postgres&quot;)
-          repository(:tmp) do |repo|
-            puts &quot;Creating (PostgreSQL): #{uri.basename}&quot;
-            repo.adapter.execute &quot;CREATE DATABASE #{uri.basename} ENCODING = 'utf8'&quot;
-          end
-        when /Sqlite3/
-          db_dir = File.join(Mack.root, &quot;db&quot;)
-          puts &quot;Creating (SQLite3): #{uri.basename}&quot;
-          FileUtils.mkdir_p(db_dir)
-          FileUtils.touch(File.join(db_dir, uri.basename))
-        else
-          raise &quot;Task not supported for '#{repository(repis).adapter.class.name}'&quot;
+      when /Mysql/
+        setup_temp(uri, &quot;mysql&quot;)
+        repository(:tmp) do |repo|
+          puts &quot;Creating (MySQL): #{uri.basename}&quot;
+          repo.adapter.execute &quot;CREATE DATABASE `#{uri.basename}` DEFAULT CHARACTER SET `utf8`&quot;
+        end
+      when /Postgres/
+        setup_temp(uri, &quot;postgres&quot;)
+        repository(:tmp) do |repo|
+          puts &quot;Creating (PostgreSQL): #{uri.basename}&quot;
+          repo.adapter.execute &quot;CREATE DATABASE #{uri.basename} ENCODING = 'utf8'&quot;
+        end
+      when /Sqlite3/
+        db_dir = File.join(Mack.root, &quot;db&quot;)
+        puts &quot;Creating (SQLite3): #{uri.basename}&quot;
+        FileUtils.mkdir_p(db_dir)
+        FileUtils.touch(File.join(db_dir, uri.basename))
+      else
+        raise &quot;Task not supported for '#{repository(repis).adapter.class.name}'&quot;
       end
     end
     
-    
     def self.drop_database(repis = :default)
       uri = repository(repis).adapter.uri
       case repository(repis).adapter.class.name
-        when /Mysql/
-          setup_temp(uri, &quot;mysql&quot;)
-          repository(:tmp) do |repo|
-            puts &quot;Dropping (MySQL): #{uri.basename}&quot;
-            repo.adapter.execute &quot;DROP DATABASE IF EXISTS `#{uri.basename}`&quot;
-          end
-        when /Postgres/
-          setup_temp(uri, &quot;postgres&quot;)
-          repository(:tmp) do |repo|
-            puts &quot;Dropping (PostgreSQL): #{uri.basename}&quot;
-            repo.adapter.execute &quot;DROP DATABASE IF EXISTS #{uri.basename}&quot;
-          end
-        when /Sqlite3/
-          puts &quot;Dropping (SQLite3): #{uri.basename}&quot;
-          db_dir = File.join(Mack.root, &quot;db&quot;)
-          FileUtils.rm_rf(File.join(db_dir.to_s, uri.basename))
-        else
-          raise &quot;Task not supported for '#{repository(repis).adapter.class.name}'&quot;
+      when /Mysql/
+        setup_temp(uri, &quot;mysql&quot;)
+        repository(:tmp) do |repo|
+          puts &quot;Dropping (MySQL): #{uri.basename}&quot;
+          repo.adapter.execute &quot;DROP DATABASE IF EXISTS `#{uri.basename}`&quot;
+        end
+      when /Postgres/
+        setup_temp(uri, &quot;postgres&quot;)
+        repository(:tmp) do |repo|
+          puts &quot;Dropping (PostgreSQL): #{uri.basename}&quot;
+          repo.adapter.execute &quot;DROP DATABASE IF EXISTS #{uri.basename}&quot;
+        end
+      when /Sqlite3/
+        puts &quot;Dropping (SQLite3): #{uri.basename}&quot;
+        db_dir = File.join(Mack.root, &quot;db&quot;)
+        FileUtils.rm_rf(File.join(db_dir.to_s, uri.basename))
+      else
+        raise &quot;Task not supported for '#{repository(repis).adapter.class.name}'&quot;
       end
     end
     </diff>
      <filename>mack-data_mapper/lib/mack-data_mapper/database.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>2263caf43ab79d61970f3e7148dafc39ffbaa0ff</id>
    </parent>
  </parents>
  <author>
    <name>Mark Bates</name>
    <email>mark@mackframework.com</email>
  </author>
  <url>http://github.com/markbates/mack-more/commit/41ec8a0fe9fb206f5a6bb490a1e58655a712cef0</url>
  <id>41ec8a0fe9fb206f5a6bb490a1e58655a712cef0</id>
  <committed-date>2008-08-08T18:09:42-07:00</committed-date>
  <authored-date>2008-08-08T18:09:42-07:00</authored-date>
  <message>Added specs for mack-data_mapper structure_dump [#67]</message>
  <tree>627fad1c8d4e2f5290a4231214ff2086496a3bfd</tree>
  <committer>
    <name>Mark Bates</name>
    <email>mark@mackframework.com</email>
  </committer>
</commit>
