rails3_pg_deferred_constraints 0.0.4 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -24,5 +24,6 @@ Add to your Gemfile:
24
24
 
25
25
  ## Testing
26
26
 
27
+ * `cd test/dummy && bundle install`
27
28
  * Open ./test/dummy/config/database.yml and modified db connections
28
29
  * Run `rake test` from the root directory of gem(not dummy application)
data/Rakefile CHANGED
@@ -1,9 +1,5 @@
1
1
  #!/usr/bin/env rake
2
- begin
3
- require 'bundler/setup'
4
- rescue LoadError
5
- puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
- end
2
+
7
3
  begin
8
4
  require 'rdoc/task'
9
5
  rescue LoadError
@@ -20,10 +16,6 @@ RDoc::Task.new(:rdoc) do |rdoc|
20
16
  rdoc.rdoc_files.include('lib/**/*.rb')
21
17
  end
22
18
 
23
-
24
-
25
- Bundler::GemHelper.install_tasks
26
-
27
19
  require 'rake/testtask'
28
20
 
29
21
  Rake::TestTask.new(:test) do |t|
@@ -32,5 +24,4 @@ Rake::TestTask.new(:test) do |t|
32
24
  t.verbose = false
33
25
  end
34
26
 
35
-
36
27
  task :default => :test
@@ -37,7 +37,7 @@ class ::ActiveRecord::Fixtures
37
37
  connection,
38
38
  table_name,
39
39
  class_names[table_name.to_sym] || table_name.classify,
40
- File.join(fixtures_directory, path))
40
+ ::File.join(fixtures_directory, path))
41
41
  end
42
42
 
43
43
  all_loaded_fixtures.update(fixtures_map)
@@ -1,3 +1,3 @@
1
1
  module Rails3PgDeferredConstraints
2
- VERSION = "0.0.4"
2
+ VERSION = "0.1.0"
3
3
  end
data/test/dummy/Gemfile CHANGED
@@ -1,5 +1,5 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
3
  gem 'foreigner'
4
- gem 'rails'
4
+ gem 'rails', '~> 3.2.0'
5
5
  gem 'pg'
@@ -1,87 +1,85 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- actionmailer (3.1.0)
5
- actionpack (= 3.1.0)
6
- mail (~> 2.3.0)
7
- actionpack (3.1.0)
8
- activemodel (= 3.1.0)
9
- activesupport (= 3.1.0)
4
+ actionmailer (3.2.1)
5
+ actionpack (= 3.2.1)
6
+ mail (~> 2.4.0)
7
+ actionpack (3.2.1)
8
+ activemodel (= 3.2.1)
9
+ activesupport (= 3.2.1)
10
10
  builder (~> 3.0.0)
11
11
  erubis (~> 2.7.0)
12
- i18n (~> 0.6)
13
- rack (~> 1.3.2)
14
- rack-cache (~> 1.0.3)
15
- rack-mount (~> 0.8.2)
12
+ journey (~> 1.0.1)
13
+ rack (~> 1.4.0)
14
+ rack-cache (~> 1.1)
16
15
  rack-test (~> 0.6.1)
17
- sprockets (~> 2.0.0)
18
- activemodel (3.1.0)
19
- activesupport (= 3.1.0)
20
- bcrypt-ruby (~> 3.0.0)
16
+ sprockets (~> 2.1.2)
17
+ activemodel (3.2.1)
18
+ activesupport (= 3.2.1)
21
19
  builder (~> 3.0.0)
22
- i18n (~> 0.6)
23
- activerecord (3.1.0)
24
- activemodel (= 3.1.0)
25
- activesupport (= 3.1.0)
26
- arel (~> 2.2.1)
20
+ activerecord (3.2.1)
21
+ activemodel (= 3.2.1)
22
+ activesupport (= 3.2.1)
23
+ arel (~> 3.0.0)
27
24
  tzinfo (~> 0.3.29)
28
- activeresource (3.1.0)
29
- activemodel (= 3.1.0)
30
- activesupport (= 3.1.0)
31
- activesupport (3.1.0)
25
+ activeresource (3.2.1)
26
+ activemodel (= 3.2.1)
27
+ activesupport (= 3.2.1)
28
+ activesupport (3.2.1)
29
+ i18n (~> 0.6)
32
30
  multi_json (~> 1.0)
33
- arel (2.2.1)
34
- bcrypt-ruby (3.0.0)
31
+ arel (3.0.0)
35
32
  builder (3.0.0)
36
33
  erubis (2.7.0)
37
- foreigner (1.1.1)
34
+ foreigner (1.1.2)
38
35
  activerecord (>= 3.0.0)
39
36
  hike (1.2.1)
40
37
  i18n (0.6.0)
41
- mail (2.3.0)
38
+ journey (1.0.1)
39
+ json (1.6.5)
40
+ mail (2.4.1)
42
41
  i18n (>= 0.4.0)
43
42
  mime-types (~> 1.16)
44
43
  treetop (~> 1.4.8)
45
- mime-types (1.16)
46
- multi_json (1.0.3)
47
- pg (0.11.0)
48
- polyglot (0.3.2)
49
- rack (1.3.2)
50
- rack-cache (1.0.3)
44
+ mime-types (1.17.2)
45
+ multi_json (1.0.4)
46
+ pg (0.13.1)
47
+ polyglot (0.3.3)
48
+ rack (1.4.1)
49
+ rack-cache (1.1)
51
50
  rack (>= 0.4)
52
- rack-mount (0.8.3)
53
- rack (>= 1.0.0)
54
51
  rack-ssl (1.3.2)
55
52
  rack
56
53
  rack-test (0.6.1)
57
54
  rack (>= 1.0)
58
- rails (3.1.0)
59
- actionmailer (= 3.1.0)
60
- actionpack (= 3.1.0)
61
- activerecord (= 3.1.0)
62
- activeresource (= 3.1.0)
63
- activesupport (= 3.1.0)
55
+ rails (3.2.1)
56
+ actionmailer (= 3.2.1)
57
+ actionpack (= 3.2.1)
58
+ activerecord (= 3.2.1)
59
+ activeresource (= 3.2.1)
60
+ activesupport (= 3.2.1)
64
61
  bundler (~> 1.0)
65
- railties (= 3.1.0)
66
- railties (3.1.0)
67
- actionpack (= 3.1.0)
68
- activesupport (= 3.1.0)
62
+ railties (= 3.2.1)
63
+ railties (3.2.1)
64
+ actionpack (= 3.2.1)
65
+ activesupport (= 3.2.1)
69
66
  rack-ssl (~> 1.3.2)
70
67
  rake (>= 0.8.7)
71
68
  rdoc (~> 3.4)
72
69
  thor (~> 0.14.6)
73
- rake (0.9.2)
74
- rdoc (3.9.4)
75
- sprockets (2.0.0)
70
+ rake (0.9.2.2)
71
+ rdoc (3.12)
72
+ json (~> 1.4)
73
+ sprockets (2.1.2)
76
74
  hike (~> 1.2)
77
75
  rack (~> 1.0)
78
- tilt (!= 1.3.0, ~> 1.1)
76
+ tilt (~> 1.1, != 1.3.0)
79
77
  thor (0.14.6)
80
78
  tilt (1.3.3)
81
79
  treetop (1.4.10)
82
80
  polyglot
83
81
  polyglot (>= 0.3.1)
84
- tzinfo (0.3.29)
82
+ tzinfo (0.3.31)
85
83
 
86
84
  PLATFORMS
87
85
  ruby
@@ -89,4 +87,4 @@ PLATFORMS
89
87
  DEPENDENCIES
90
88
  foreigner
91
89
  pg
92
- rails
90
+ rails (~> 3.2.0)
@@ -2,9 +2,16 @@ require File.expand_path('../boot', __FILE__)
2
2
 
3
3
  require 'rails/all'
4
4
 
5
- Bundler.require
5
+ if ENV['PG_DEFERRED_CONSTRAINTS'] == 'true'
6
+ require File.expand_path(File.join('..', '..', '..', '..', 'lib', 'rails3_pg_deferred_constraints'), __FILE__)
7
+ end
6
8
 
7
- require "rails3_pg_deferred_constraints" if ENV['PG_DEFERRED_CONSTRAINTS'] == 'true'
9
+ if defined?(Bundler)
10
+ # If you precompile assets before deploying to production, use this line
11
+ Bundler.require(*Rails.groups(:assets => %w(development test)))
12
+ # If you want your assets lazily compiled in production, use this line
13
+ # Bundler.require(:default, :assets, Rails.env)
14
+ end
8
15
 
9
16
  module Dummy
10
17
  class Application < Rails::Application
@@ -36,6 +43,17 @@ module Dummy
36
43
  # Configure sensitive parameters which will be filtered from the log file.
37
44
  config.filter_parameters += [:password]
38
45
 
46
+ # Use SQL instead of Active Record's schema dumper when creating the database.
47
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
48
+ # like if you have constraints or database-specific column types
49
+ # config.active_record.schema_format = :sql
50
+
51
+ # Enforce whitelist mode for mass assignment.
52
+ # This will create an empty whitelist of attributes available for mass-assignment for all models
53
+ # in your app. As such, your models will need to explicitly whitelist or blacklist accessible
54
+ # parameters by using an attr_accessible or attr_protected declaration.
55
+ # config.active_record.whitelist_attributes = true
56
+
39
57
  # Enable the asset pipeline
40
58
  config.assets.enabled = true
41
59
 
@@ -43,4 +61,3 @@ module Dummy
43
61
  config.assets.version = '1.0'
44
62
  end
45
63
  end
46
-
@@ -1,8 +1,6 @@
1
1
  require 'rubygems'
2
2
 
3
3
  # Set up gems listed in the Gemfile.
4
- ENV['BUNDLE_GEMFILE'] = File.expand_path('../../Gemfile', __FILE__)
5
- require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
6
-
4
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
7
5
 
8
- $:.unshift File.expand_path('../../../../lib', __FILE__)
6
+ require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
@@ -1,28 +1,26 @@
1
- # SQLite version 3.x
2
- # gem install sqlite3
3
- #
4
- # Ensure the SQLite 3 gem is defined in your Gemfile
5
- # gem 'sqlite3'
6
1
  development:
7
2
  adapter: postgresql
8
3
  encoding: unicode
9
- database: tmp_fix_development
4
+ database: autocash_rails3_pg_deferred_constraints_development
10
5
  pool: 5
11
- host: localhost
12
- port: 5432
13
- username: rails_bug
6
+ username: postgres
14
7
  password: secret
8
+ host: localhost
15
9
 
16
-
17
- # Warning: The database defined as "test" will be erased and
18
- # re-generated from your development database when you run "rake".
19
- # Do not set this db to the same as development or production.
20
10
  test:
21
11
  adapter: postgresql
22
12
  encoding: unicode
23
- database: tmp_fix_test
13
+ database: autocash_rails3_pg_deferred_constraints_test
24
14
  pool: 5
15
+ username: postgres
16
+ password: secret
25
17
  host: localhost
26
- port: 5432
27
- username: rails_bug
18
+
19
+ production:
20
+ adapter: postgresql
21
+ encoding: unicode
22
+ database: autocash_rails3_pg_deferred_constraints_production
23
+ pool: 5
24
+ username: postgres
28
25
  password: secret
26
+ host: localhost
@@ -2,7 +2,7 @@ Dummy::Application.configure do
2
2
  # Settings specified here will take precedence over those in config/application.rb
3
3
 
4
4
  # In the development environment your application's code is reloaded on
5
- # every request. This slows down response time but is perfect for development
5
+ # every request. This slows down response time but is perfect for development
6
6
  # since you don't have to restart the web server when you make code changes.
7
7
  config.cache_classes = false
8
8
 
@@ -22,6 +22,13 @@ Dummy::Application.configure do
22
22
  # Only use best-standards-support built into browsers
23
23
  config.action_dispatch.best_standards_support = :builtin
24
24
 
25
+ # Raise exception on mass assignment protection for Active Record models
26
+ config.active_record.mass_assignment_sanitizer = :strict
27
+
28
+ # Log the query plan for queries taking more than this (works
29
+ # with SQLite, MySQL, and PostgreSQL)
30
+ config.active_record.auto_explain_threshold_in_seconds = 0.5
31
+
25
32
  # Do not compress assets
26
33
  config.assets.compress = false
27
34
 
@@ -33,8 +33,11 @@ Dummy::Application.configure do
33
33
  # See everything in the log (default is :info)
34
34
  # config.log_level = :debug
35
35
 
36
+ # Prepend all log lines with the following tags
37
+ # config.log_tags = [ :subdomain, :uuid ]
38
+
36
39
  # Use a different logger for distributed setups
37
- # config.logger = SyslogLogger.new
40
+ # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
38
41
 
39
42
  # Use a different cache store in production
40
43
  # config.cache_store = :mem_cache_store
@@ -57,4 +60,8 @@ Dummy::Application.configure do
57
60
 
58
61
  # Send deprecation notices to registered listeners
59
62
  config.active_support.deprecation = :notify
63
+
64
+ # Log the query plan for queries taking more than this (works
65
+ # with SQLite, MySQL, and PostgreSQL)
66
+ # config.active_record.auto_explain_threshold_in_seconds = 0.5
60
67
  end
@@ -2,9 +2,9 @@ Dummy::Application.configure do
2
2
  # Settings specified here will take precedence over those in config/application.rb
3
3
 
4
4
  # The test environment is used exclusively to run your application's
5
- # test suite. You never need to work with it otherwise. Remember that
5
+ # test suite. You never need to work with it otherwise. Remember that
6
6
  # your test database is "scratch space" for the test suite and is wiped
7
- # and recreated between test runs. Don't rely on the data there!
7
+ # and recreated between test runs. Don't rely on the data there!
8
8
  config.cache_classes = true
9
9
 
10
10
  # Configure static asset server for tests with Cache-Control for performance
@@ -29,14 +29,9 @@ Dummy::Application.configure do
29
29
  # ActionMailer::Base.deliveries array.
30
30
  config.action_mailer.delivery_method = :test
31
31
 
32
- # Use SQL instead of Active Record's schema dumper when creating the test database.
33
- # This is necessary if your schema can't be completely dumped by the schema dumper,
34
- # like if you have constraints or database-specific column types
35
- # config.active_record.schema_format = :sql
32
+ # Raise exception on mass assignment protection for Active Record models
33
+ config.active_record.mass_assignment_sanitizer = :strict
36
34
 
37
35
  # Print deprecation notices to the stderr
38
36
  config.active_support.deprecation = :stderr
39
-
40
- # Allow pass debug_assets=true as a query parameter to load pages with unpackaged assets
41
- config.assets.allow_debugging = true
42
37
  end
@@ -8,3 +8,8 @@
8
8
  # inflect.irregular 'person', 'people'
9
9
  # inflect.uncountable %w( fish sheep )
10
10
  # end
11
+ #
12
+ # These inflection rules are supported but not enabled by default:
13
+ # ActiveSupport::Inflector.inflections do |inflect|
14
+ # inflect.acronym 'RESTful'
15
+ # end
@@ -54,5 +54,5 @@ Dummy::Application.routes.draw do
54
54
 
55
55
  # This is a legacy wild controller route that's not recommended for RESTful applications.
56
56
  # Note: This route will make all actions in every controller accessible via GET requests.
57
- # match ':controller(/:action(/:id(.:format)))'
57
+ # match ':controller(/:action(/:id))(.:format)'
58
58
  end
@@ -1,74 +1,35 @@
1
-  (0.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
2
-  (0.1ms) SET search_path TO public
3
-  (0.1ms) DROP DATABASE IF EXISTS "tmp_fix_test"
4
-  (0.1ms) SET search_path TO public
5
-  (0.2ms) CREATE DATABASE "tmp_fix_test" ENCODING = 'unicode'
6
- PGError: ERROR: permission denied to create database
7
- : CREATE DATABASE "tmp_fix_test" ENCODING = 'unicode'
8
-  (0.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
9
-  (0.1ms) SET search_path TO public
10
-  (245.4ms) DROP DATABASE IF EXISTS "tmp_fix_test"
11
-  (0.1ms) SET search_path TO public
12
-  (0.2ms) CREATE DATABASE "tmp_fix_test" ENCODING = 'unicode'
13
- PGError: ERROR: permission denied to create database
14
- : CREATE DATABASE "tmp_fix_test" ENCODING = 'unicode'
15
-  (0.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
16
- Migrating to CreateUsers (20110908165659)
17
- Migrating to CreateBooks (20110908165716)
18
- Migrating to AddReferences (20110909072642)
19
-  (0.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
20
-  (0.1ms) SHOW search_path
21
-  (1.5ms) SELECT distinct i.relname, d.indisunique, d.indkey, t.oid
22
- FROM pg_class t
23
- INNER JOIN pg_index d ON t.oid = d.indrelid
24
- INNER JOIN pg_class i ON d.indexrelid = i.oid
25
- WHERE i.relkind = 'i'
26
- AND d.indisprimary = 'f'
27
- AND t.relname = 'books'
28
- AND i.relnamespace IN (SELECT oid FROM pg_namespace WHERE nspname IN ('"$user"','public') )
29
- ORDER BY i.relname
30
-  (0.8ms)  SELECT distinct i.relname, d.indisunique, d.indkey, t.oid
1
+  (29.2ms) CREATE TABLE "schema_migrations" ("version" character varying(255) NOT NULL) 
2
+  (0.7ms) SHOW search_path
3
+  (11.6ms)  SELECT distinct i.relname, d.indisunique, d.indkey, t.oid
31
4
  FROM pg_class t
32
5
  INNER JOIN pg_index d ON t.oid = d.indrelid
33
6
  INNER JOIN pg_class i ON d.indexrelid = i.oid
34
7
  WHERE i.relkind = 'i'
35
8
  AND d.indisprimary = 'f'
36
- AND t.relname = 'users'
37
- AND i.relnamespace IN (SELECT oid FROM pg_namespace WHERE nspname IN ('"$user"','public') )
38
- ORDER BY i.relname
39
- 
40
-  (0.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
41
- Migrating to CreateUsers (20110908165659)
42
- Migrating to CreateBooks (20110908165716)
43
- Migrating to AddReferences (20110909072642)
44
-  (0.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
45
-  (0.1ms) SHOW search_path
46
-  (2.3ms) SELECT distinct i.relname, d.indisunique, d.indkey, t.oid
47
- FROM pg_class t
48
- INNER JOIN pg_index d ON t.oid = d.indrelid
49
- INNER JOIN pg_class i ON d.indexrelid = i.oid
50
- WHERE i.relkind = 'i'
51
- AND d.indisprimary = 'f'
52
- AND t.relname = 'books'
53
- AND i.relnamespace IN (SELECT oid FROM pg_namespace WHERE nspname IN ('"$user"','public') )
54
- ORDER BY i.relname
55
-  (0.8ms)  SELECT distinct i.relname, d.indisunique, d.indkey, t.oid
56
- FROM pg_class t
57
- INNER JOIN pg_index d ON t.oid = d.indrelid
58
- INNER JOIN pg_class i ON d.indexrelid = i.oid
59
- WHERE i.relkind = 'i'
60
- AND d.indisprimary = 'f'
61
- AND t.relname = 'users'
9
+ AND t.relname = 'schema_migrations'
62
10
  AND i.relnamespace IN (SELECT oid FROM pg_namespace WHERE nspname IN ('"$user"','public') )
63
11
  ORDER BY i.relname
64
12
  
65
-  (0.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
13
+  (61.5ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
14
+  (1.1ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
66
15
  Migrating to CreateUsers (20110908165659)
16
+  (0.6ms) BEGIN
17
+  (45.9ms) CREATE TABLE "users" ("id" serial primary key, "name" character varying(255), "created_at" timestamp, "updated_at" timestamp) 
18
+  (0.7ms) INSERT INTO "schema_migrations" ("version") VALUES ('20110908165659')
19
+  (13.0ms) COMMIT
67
20
  Migrating to CreateBooks (20110908165716)
21
+  (0.5ms) BEGIN
22
+  (31.2ms) CREATE TABLE "books" ("id" serial primary key, "name" character varying(255), "user_id" integer, "created_at" timestamp, "updated_at" timestamp) 
23
+  (1.8ms) INSERT INTO "schema_migrations" ("version") VALUES ('20110908165716')
24
+  (9.0ms) COMMIT
68
25
  Migrating to AddReferences (20110909072642)
69
-  (0.3ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
26
+  (0.6ms) BEGIN
27
+  (22.1ms) ALTER TABLE "books" ADD CONSTRAINT "books_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "users"(id)
28
+  (0.7ms) INSERT INTO "schema_migrations" ("version") VALUES ('20110909072642')
29
+  (10.7ms) COMMIT
30
+  (1.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
70
31
   (0.2ms) SHOW search_path
71
-  (1.6ms) SELECT distinct i.relname, d.indisunique, d.indkey, t.oid
32
+  (1.5ms) SELECT distinct i.relname, d.indisunique, d.indkey, t.oid
72
33
  FROM pg_class t
73
34
  INNER JOIN pg_index d ON t.oid = d.indrelid
74
35
  INNER JOIN pg_class i ON d.indexrelid = i.oid
@@ -87,113 +48,7 @@ Migrating to AddReferences (20110909072642)
87
48
  AND i.relnamespace IN (SELECT oid FROM pg_namespace WHERE nspname IN ('"$user"','public') )
88
49
  ORDER BY i.relname
89
50
  
90
-  (0.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
91
-  (0.1ms) SET search_path TO public
92
-  (213.5ms) DROP DATABASE IF EXISTS "tmp_fix_test"
93
-  (0.1ms) SET search_path TO public
94
-  (0.2ms) CREATE DATABASE "tmp_fix_test" ENCODING = 'unicode'
95
- PGError: ERROR: permission denied to create database
96
- : CREATE DATABASE "tmp_fix_test" ENCODING = 'unicode'
97
-  (0.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
98
-  (0.1ms) SET search_path TO public
99
-  (0.1ms) DROP DATABASE IF EXISTS "tmp_fix_test"
100
-  (0.1ms) SET search_path TO public
101
-  (0.3ms) CREATE DATABASE "tmp_fix_test" ENCODING = 'unicode'
102
- PGError: ERROR: permission denied to create database
103
- : CREATE DATABASE "tmp_fix_test" ENCODING = 'unicode'
104
-  (50.6ms) CREATE TABLE "schema_migrations" ("version" character varying(255) NOT NULL) 
105
-  (0.1ms) SHOW search_path
106
-  (2.1ms)  SELECT distinct i.relname, d.indisunique, d.indkey, t.oid
107
- FROM pg_class t
108
- INNER JOIN pg_index d ON t.oid = d.indrelid
109
- INNER JOIN pg_class i ON d.indexrelid = i.oid
110
- WHERE i.relkind = 'i'
111
- AND d.indisprimary = 'f'
112
- AND t.relname = 'schema_migrations'
113
- AND i.relnamespace IN (SELECT oid FROM pg_namespace WHERE nspname IN ('"$user"','public') )
114
- ORDER BY i.relname
115
- 
116
-  (39.0ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
117
-  (0.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
118
- Migrating to CreateUsers (20110908165659)
119
-  (0.1ms) BEGIN
120
-  (37.5ms) CREATE TABLE "users" ("id" serial primary key, "name" character varying(255), "created_at" timestamp, "updated_at" timestamp) 
121
-  (0.4ms) INSERT INTO "schema_migrations" ("version") VALUES ('20110908165659')
122
-  (63.1ms) COMMIT
123
- Migrating to CreateBooks (20110908165716)
124
-  (0.1ms) BEGIN
125
-  (33.0ms) CREATE TABLE "books" ("id" serial primary key, "name" character varying(255), "user_id" integer, "created_at" timestamp, "updated_at" timestamp) 
126
-  (0.3ms) INSERT INTO "schema_migrations" ("version") VALUES ('20110908165716')
127
-  (5.1ms) COMMIT
128
- Migrating to AddReferences (20110909072642)
129
-  (0.1ms) BEGIN
130
-  (0.1ms) ROLLBACK
131
-  (0.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
132
- Migrating to CreateUsers (20110908165659)
133
- Migrating to CreateBooks (20110908165716)
134
- Migrating to AddReferences (20110909072642)
135
-  (0.1ms) BEGIN
136
-  (0.1ms) ROLLBACK
137
-  (0.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
138
- Migrating to CreateUsers (20110908165659)
139
- Migrating to CreateBooks (20110908165716)
140
- Migrating to AddReferences (20110909072642)
141
-  (0.1ms) BEGIN
142
-  (0.1ms) ROLLBACK
143
-  (0.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
144
- Migrating to CreateUsers (20110908165659)
145
- Migrating to CreateBooks (20110908165716)
146
- Migrating to AddReferences (20110909072642)
147
-  (0.1ms) BEGIN
148
-  (0.5ms) ROLLBACK
149
-  (0.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
150
- Migrating to CreateUsers (20110908165659)
151
- Migrating to CreateBooks (20110908165716)
152
- Migrating to AddReferences (20110909072642)
153
-  (0.1ms) BEGIN
154
-  (0.1ms) ROLLBACK
155
-  (0.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
156
- Migrating to CreateUsers (20110908165659)
157
- Migrating to CreateBooks (20110908165716)
158
- Migrating to AddReferences (20110909072642)
159
-  (0.1ms) BEGIN
160
-  (0.1ms) ROLLBACK
161
-  (0.4ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
162
- Migrating to CreateUsers (20110908165659)
163
- Migrating to CreateBooks (20110908165716)
164
- Migrating to AddReferences (20110909072642)
165
-  (0.1ms) BEGIN
166
-  (0.1ms) ROLLBACK
167
-  (0.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations" 
168
- Migrating to CreateUsers (20110908165659)
169
- Migrating to CreateBooks (20110908165716)
170
- Migrating to AddReferences (20110909072642)
171
-  (0.1ms) BEGIN
172
-  (2.0ms) ALTER TABLE "books" ADD CONSTRAINT "books_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "users"(id)
173
-  (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ('20110909072642')
174
-  (17.0ms) COMMIT
175
-  (0.2ms) SELECT "schema_migrations"."version" FROM "schema_migrations"
176
-  (0.1ms) SHOW search_path
177
-  (1.3ms) SELECT distinct i.relname, d.indisunique, d.indkey, t.oid
178
- FROM pg_class t
179
- INNER JOIN pg_index d ON t.oid = d.indrelid
180
- INNER JOIN pg_class i ON d.indexrelid = i.oid
181
- WHERE i.relkind = 'i'
182
- AND d.indisprimary = 'f'
183
- AND t.relname = 'books'
184
- AND i.relnamespace IN (SELECT oid FROM pg_namespace WHERE nspname IN ('"$user"','public') )
185
- ORDER BY i.relname
186
-  (0.8ms)  SELECT distinct i.relname, d.indisunique, d.indkey, t.oid
187
- FROM pg_class t
188
- INNER JOIN pg_index d ON t.oid = d.indrelid
189
- INNER JOIN pg_class i ON d.indexrelid = i.oid
190
- WHERE i.relkind = 'i'
191
- AND d.indisprimary = 'f'
192
- AND t.relname = 'users'
193
- AND i.relnamespace IN (SELECT oid FROM pg_namespace WHERE nspname IN ('"$user"','public') )
194
- ORDER BY i.relname
195
- 
196
-  (2.9ms)
51
+  (3.0ms)
197
52
  SELECT t2.relname AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confdeltype AS dependency
198
53
  FROM pg_constraint c
199
54
  JOIN pg_class t1 ON c.conrelid = t1.oid
@@ -206,7 +61,7 @@ Migrating to AddReferences (20110909072642)
206
61
  AND t3.nspname = ANY (current_schemas(false))
207
62
  ORDER BY c.conname
208
63
 
209
-  (3.0ms) 
64
+  (2.6ms) 
210
65
  SELECT t2.relname AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confdeltype AS dependency
211
66
  FROM pg_constraint c
212
67
  JOIN pg_class t1 ON c.conrelid = t1.oid