rails3_pg_deferred_constraints 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +5 -0
- data/Rakefile +1 -2
- data/lib/rails3_pg_deferred_constraints/postgresql_adapter.rb +3 -0
- data/lib/rails3_pg_deferred_constraints/version.rb +1 -1
- data/test/dummy/Gemfile +5 -0
- data/test/dummy/Gemfile.lock +92 -0
- data/test/dummy/app/models/book.rb +2 -0
- data/test/dummy/app/models/user.rb +2 -0
- data/test/dummy/config/application.rb +2 -1
- data/test/dummy/config/boot.rb +4 -6
- data/test/dummy/config/database.yml +15 -12
- data/test/dummy/db/migrate/20110908165659_create_users.rb +9 -0
- data/test/dummy/db/migrate/20110908165716_create_books.rb +10 -0
- data/test/dummy/db/migrate/20110909072642_add_references.rb +11 -0
- data/test/dummy/db/schema.rb +31 -0
- data/test/dummy/db/seeds.rb +7 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +234 -0
- data/test/dummy/log/test.log +1110 -0
- data/test/dummy/test/fixtures/books.yml +9 -0
- data/test/dummy/test/fixtures/users.yml +9 -0
- data/test/dummy/test/performance/browsing_test.rb +12 -0
- data/test/dummy/test/test_helper.rb +13 -0
- data/test/dummy/test/unit/book_test.rb +13 -0
- data/test/dummy/test/unit/user_test.rb +7 -0
- data/test/rails3_pg_deferred_constraints_test.rb +17 -2
- metadata +85 -62
data/README.md
CHANGED
data/Rakefile
CHANGED
@@ -27,9 +27,8 @@ Bundler::GemHelper.install_tasks
|
|
27
27
|
require 'rake/testtask'
|
28
28
|
|
29
29
|
Rake::TestTask.new(:test) do |t|
|
30
|
-
t.libs << 'lib'
|
31
30
|
t.libs << 'test'
|
32
|
-
t.pattern = 'test
|
31
|
+
t.pattern = 'test/rails3_pg_deferred_constraints_test.rb'
|
33
32
|
t.verbose = false
|
34
33
|
end
|
35
34
|
|
@@ -5,6 +5,9 @@
|
|
5
5
|
#
|
6
6
|
# source: http://kopongo.com/2008/7/25/postgres-ri_constrainttrigger-error
|
7
7
|
# ref: https://github.com/matthuhiggins/foreigner/issues/61
|
8
|
+
|
9
|
+
ActiveRecord::Base
|
10
|
+
|
8
11
|
class ::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter < ::ActiveRecord::ConnectionAdapters::AbstractAdapter
|
9
12
|
|
10
13
|
alias_method :supports_deferring_all_constraints?, :supports_disable_referential_integrity?
|
data/test/dummy/Gemfile
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
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)
|
10
|
+
builder (~> 3.0.0)
|
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)
|
16
|
+
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)
|
21
|
+
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)
|
27
|
+
tzinfo (~> 0.3.29)
|
28
|
+
activeresource (3.1.0)
|
29
|
+
activemodel (= 3.1.0)
|
30
|
+
activesupport (= 3.1.0)
|
31
|
+
activesupport (3.1.0)
|
32
|
+
multi_json (~> 1.0)
|
33
|
+
arel (2.2.1)
|
34
|
+
bcrypt-ruby (3.0.0)
|
35
|
+
builder (3.0.0)
|
36
|
+
erubis (2.7.0)
|
37
|
+
foreigner (1.1.1)
|
38
|
+
activerecord (>= 3.0.0)
|
39
|
+
hike (1.2.1)
|
40
|
+
i18n (0.6.0)
|
41
|
+
mail (2.3.0)
|
42
|
+
i18n (>= 0.4.0)
|
43
|
+
mime-types (~> 1.16)
|
44
|
+
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)
|
51
|
+
rack (>= 0.4)
|
52
|
+
rack-mount (0.8.3)
|
53
|
+
rack (>= 1.0.0)
|
54
|
+
rack-ssl (1.3.2)
|
55
|
+
rack
|
56
|
+
rack-test (0.6.1)
|
57
|
+
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)
|
64
|
+
bundler (~> 1.0)
|
65
|
+
railties (= 3.1.0)
|
66
|
+
railties (3.1.0)
|
67
|
+
actionpack (= 3.1.0)
|
68
|
+
activesupport (= 3.1.0)
|
69
|
+
rack-ssl (~> 1.3.2)
|
70
|
+
rake (>= 0.8.7)
|
71
|
+
rdoc (~> 3.4)
|
72
|
+
thor (~> 0.14.6)
|
73
|
+
rake (0.9.2)
|
74
|
+
rdoc (3.9.4)
|
75
|
+
sprockets (2.0.0)
|
76
|
+
hike (~> 1.2)
|
77
|
+
rack (~> 1.0)
|
78
|
+
tilt (!= 1.3.0, ~> 1.1)
|
79
|
+
thor (0.14.6)
|
80
|
+
tilt (1.3.3)
|
81
|
+
treetop (1.4.10)
|
82
|
+
polyglot
|
83
|
+
polyglot (>= 0.3.1)
|
84
|
+
tzinfo (0.3.29)
|
85
|
+
|
86
|
+
PLATFORMS
|
87
|
+
ruby
|
88
|
+
|
89
|
+
DEPENDENCIES
|
90
|
+
foreigner
|
91
|
+
pg
|
92
|
+
rails
|
@@ -3,7 +3,8 @@ require File.expand_path('../boot', __FILE__)
|
|
3
3
|
require 'rails/all'
|
4
4
|
|
5
5
|
Bundler.require
|
6
|
-
|
6
|
+
|
7
|
+
require "rails3_pg_deferred_constraints" if ENV['PG_DEFERRED_CONSTRAINTS'] == 'true'
|
7
8
|
|
8
9
|
module Dummy
|
9
10
|
class Application < Rails::Application
|
data/test/dummy/config/boot.rb
CHANGED
@@ -1,10 +1,8 @@
|
|
1
1
|
require 'rubygems'
|
2
|
-
gemfile = File.expand_path('../../../../Gemfile', __FILE__)
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
end
|
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
|
+
|
9
7
|
|
10
8
|
$:.unshift File.expand_path('../../../../lib', __FILE__)
|
@@ -4,22 +4,25 @@
|
|
4
4
|
# Ensure the SQLite 3 gem is defined in your Gemfile
|
5
5
|
# gem 'sqlite3'
|
6
6
|
development:
|
7
|
-
adapter:
|
8
|
-
|
7
|
+
adapter: postgresql
|
8
|
+
encoding: unicode
|
9
|
+
database: tmp_fix_development
|
9
10
|
pool: 5
|
10
|
-
|
11
|
+
host: localhost
|
12
|
+
port: 5432
|
13
|
+
username: rails_bug
|
14
|
+
password: secret
|
15
|
+
|
11
16
|
|
12
17
|
# Warning: The database defined as "test" will be erased and
|
13
18
|
# re-generated from your development database when you run "rake".
|
14
19
|
# Do not set this db to the same as development or production.
|
15
20
|
test:
|
16
|
-
adapter:
|
17
|
-
|
18
|
-
|
19
|
-
timeout: 5000
|
20
|
-
|
21
|
-
production:
|
22
|
-
adapter: sqlite3
|
23
|
-
database: db/production.sqlite3
|
21
|
+
adapter: postgresql
|
22
|
+
encoding: unicode
|
23
|
+
database: tmp_fix_test
|
24
24
|
pool: 5
|
25
|
-
|
25
|
+
host: localhost
|
26
|
+
port: 5432
|
27
|
+
username: rails_bug
|
28
|
+
password: secret
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
# This file is auto-generated from the current state of the database. Instead
|
3
|
+
# of editing this file, please use the migrations feature of Active Record to
|
4
|
+
# incrementally modify your database, and then regenerate this schema definition.
|
5
|
+
#
|
6
|
+
# Note that this schema.rb definition is the authoritative source for your
|
7
|
+
# database schema. If you need to create the application database on another
|
8
|
+
# system, you should be using db:schema:load, not running all the migrations
|
9
|
+
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
|
10
|
+
# you'll amass, the slower it'll run and the greater likelihood for issues).
|
11
|
+
#
|
12
|
+
# It's strongly recommended to check this file into your version control system.
|
13
|
+
|
14
|
+
ActiveRecord::Schema.define(:version => 20110909072642) do
|
15
|
+
|
16
|
+
create_table "books", :force => true do |t|
|
17
|
+
t.string "name"
|
18
|
+
t.integer "user_id"
|
19
|
+
t.datetime "created_at"
|
20
|
+
t.datetime "updated_at"
|
21
|
+
end
|
22
|
+
|
23
|
+
create_table "users", :force => true do |t|
|
24
|
+
t.string "name"
|
25
|
+
t.datetime "created_at"
|
26
|
+
t.datetime "updated_at"
|
27
|
+
end
|
28
|
+
|
29
|
+
add_foreign_key "books", "users", :name => "books_user_id_fk"
|
30
|
+
|
31
|
+
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# This file should contain all the record creation needed to seed the database with its default values.
|
2
|
+
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
|
3
|
+
#
|
4
|
+
# Examples:
|
5
|
+
#
|
6
|
+
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
|
7
|
+
# Mayor.create(name: 'Emanuel', city: cities.first)
|
File without changes
|
@@ -0,0 +1,234 @@
|
|
1
|
+
[1m[36m (0.2ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
2
|
+
[1m[35m (0.1ms)[0m SET search_path TO public
|
3
|
+
[1m[36m (0.1ms)[0m [1mDROP DATABASE IF EXISTS "tmp_fix_test"[0m
|
4
|
+
[1m[35m (0.1ms)[0m SET search_path TO public
|
5
|
+
[1m[36m (0.2ms)[0m [1mCREATE DATABASE "tmp_fix_test" ENCODING = 'unicode'[0m
|
6
|
+
PGError: ERROR: permission denied to create database
|
7
|
+
: CREATE DATABASE "tmp_fix_test" ENCODING = 'unicode'
|
8
|
+
[1m[36m (0.2ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
9
|
+
[1m[35m (0.1ms)[0m SET search_path TO public
|
10
|
+
[1m[36m (245.4ms)[0m [1mDROP DATABASE IF EXISTS "tmp_fix_test"[0m
|
11
|
+
[1m[35m (0.1ms)[0m SET search_path TO public
|
12
|
+
[1m[36m (0.2ms)[0m [1mCREATE DATABASE "tmp_fix_test" ENCODING = 'unicode'[0m
|
13
|
+
PGError: ERROR: permission denied to create database
|
14
|
+
: CREATE DATABASE "tmp_fix_test" ENCODING = 'unicode'
|
15
|
+
[1m[36m (0.2ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
16
|
+
Migrating to CreateUsers (20110908165659)
|
17
|
+
Migrating to CreateBooks (20110908165716)
|
18
|
+
Migrating to AddReferences (20110909072642)
|
19
|
+
[1m[35m (0.2ms)[0m SELECT "schema_migrations"."version" FROM "schema_migrations"
|
20
|
+
[1m[36m (0.1ms)[0m [1mSHOW search_path[0m
|
21
|
+
[1m[35m (1.5ms)[0m 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
|
+
[1m[36m (0.8ms)[0m [1m SELECT distinct i.relname, d.indisunique, d.indkey, t.oid
|
31
|
+
FROM pg_class t
|
32
|
+
INNER JOIN pg_index d ON t.oid = d.indrelid
|
33
|
+
INNER JOIN pg_class i ON d.indexrelid = i.oid
|
34
|
+
WHERE i.relkind = 'i'
|
35
|
+
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
|
+
[0m
|
40
|
+
[1m[36m (0.2ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
41
|
+
Migrating to CreateUsers (20110908165659)
|
42
|
+
Migrating to CreateBooks (20110908165716)
|
43
|
+
Migrating to AddReferences (20110909072642)
|
44
|
+
[1m[35m (0.2ms)[0m SELECT "schema_migrations"."version" FROM "schema_migrations"
|
45
|
+
[1m[36m (0.1ms)[0m [1mSHOW search_path[0m
|
46
|
+
[1m[35m (2.3ms)[0m 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
|
+
[1m[36m (0.8ms)[0m [1m 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'
|
62
|
+
AND i.relnamespace IN (SELECT oid FROM pg_namespace WHERE nspname IN ('"$user"','public') )
|
63
|
+
ORDER BY i.relname
|
64
|
+
[0m
|
65
|
+
[1m[36m (0.2ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
66
|
+
Migrating to CreateUsers (20110908165659)
|
67
|
+
Migrating to CreateBooks (20110908165716)
|
68
|
+
Migrating to AddReferences (20110909072642)
|
69
|
+
[1m[35m (0.3ms)[0m SELECT "schema_migrations"."version" FROM "schema_migrations"
|
70
|
+
[1m[36m (0.2ms)[0m [1mSHOW search_path[0m
|
71
|
+
[1m[35m (1.6ms)[0m SELECT distinct i.relname, d.indisunique, d.indkey, t.oid
|
72
|
+
FROM pg_class t
|
73
|
+
INNER JOIN pg_index d ON t.oid = d.indrelid
|
74
|
+
INNER JOIN pg_class i ON d.indexrelid = i.oid
|
75
|
+
WHERE i.relkind = 'i'
|
76
|
+
AND d.indisprimary = 'f'
|
77
|
+
AND t.relname = 'books'
|
78
|
+
AND i.relnamespace IN (SELECT oid FROM pg_namespace WHERE nspname IN ('"$user"','public') )
|
79
|
+
ORDER BY i.relname
|
80
|
+
[1m[36m (1.0ms)[0m [1m SELECT distinct i.relname, d.indisunique, d.indkey, t.oid
|
81
|
+
FROM pg_class t
|
82
|
+
INNER JOIN pg_index d ON t.oid = d.indrelid
|
83
|
+
INNER JOIN pg_class i ON d.indexrelid = i.oid
|
84
|
+
WHERE i.relkind = 'i'
|
85
|
+
AND d.indisprimary = 'f'
|
86
|
+
AND t.relname = 'users'
|
87
|
+
AND i.relnamespace IN (SELECT oid FROM pg_namespace WHERE nspname IN ('"$user"','public') )
|
88
|
+
ORDER BY i.relname
|
89
|
+
[0m
|
90
|
+
[1m[36m (0.2ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
91
|
+
[1m[35m (0.1ms)[0m SET search_path TO public
|
92
|
+
[1m[36m (213.5ms)[0m [1mDROP DATABASE IF EXISTS "tmp_fix_test"[0m
|
93
|
+
[1m[35m (0.1ms)[0m SET search_path TO public
|
94
|
+
[1m[36m (0.2ms)[0m [1mCREATE DATABASE "tmp_fix_test" ENCODING = 'unicode'[0m
|
95
|
+
PGError: ERROR: permission denied to create database
|
96
|
+
: CREATE DATABASE "tmp_fix_test" ENCODING = 'unicode'
|
97
|
+
[1m[36m (0.2ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
98
|
+
[1m[35m (0.1ms)[0m SET search_path TO public
|
99
|
+
[1m[36m (0.1ms)[0m [1mDROP DATABASE IF EXISTS "tmp_fix_test"[0m
|
100
|
+
[1m[35m (0.1ms)[0m SET search_path TO public
|
101
|
+
[1m[36m (0.3ms)[0m [1mCREATE DATABASE "tmp_fix_test" ENCODING = 'unicode'[0m
|
102
|
+
PGError: ERROR: permission denied to create database
|
103
|
+
: CREATE DATABASE "tmp_fix_test" ENCODING = 'unicode'
|
104
|
+
[1m[36m (50.6ms)[0m [1mCREATE TABLE "schema_migrations" ("version" character varying(255) NOT NULL) [0m
|
105
|
+
[1m[35m (0.1ms)[0m SHOW search_path
|
106
|
+
[1m[36m (2.1ms)[0m [1m 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
|
+
[0m
|
116
|
+
[1m[35m (39.0ms)[0m CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
|
117
|
+
[1m[36m (0.2ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
118
|
+
Migrating to CreateUsers (20110908165659)
|
119
|
+
[1m[35m (0.1ms)[0m BEGIN
|
120
|
+
[1m[36m (37.5ms)[0m [1mCREATE TABLE "users" ("id" serial primary key, "name" character varying(255), "created_at" timestamp, "updated_at" timestamp) [0m
|
121
|
+
[1m[35m (0.4ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ('20110908165659')
|
122
|
+
[1m[36m (63.1ms)[0m [1mCOMMIT[0m
|
123
|
+
Migrating to CreateBooks (20110908165716)
|
124
|
+
[1m[35m (0.1ms)[0m BEGIN
|
125
|
+
[1m[36m (33.0ms)[0m [1mCREATE TABLE "books" ("id" serial primary key, "name" character varying(255), "user_id" integer, "created_at" timestamp, "updated_at" timestamp) [0m
|
126
|
+
[1m[35m (0.3ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ('20110908165716')
|
127
|
+
[1m[36m (5.1ms)[0m [1mCOMMIT[0m
|
128
|
+
Migrating to AddReferences (20110909072642)
|
129
|
+
[1m[35m (0.1ms)[0m BEGIN
|
130
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
131
|
+
[1m[36m (0.2ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
132
|
+
Migrating to CreateUsers (20110908165659)
|
133
|
+
Migrating to CreateBooks (20110908165716)
|
134
|
+
Migrating to AddReferences (20110909072642)
|
135
|
+
[1m[35m (0.1ms)[0m BEGIN
|
136
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
137
|
+
[1m[36m (0.2ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
138
|
+
Migrating to CreateUsers (20110908165659)
|
139
|
+
Migrating to CreateBooks (20110908165716)
|
140
|
+
Migrating to AddReferences (20110909072642)
|
141
|
+
[1m[35m (0.1ms)[0m BEGIN
|
142
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
143
|
+
[1m[36m (0.2ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
144
|
+
Migrating to CreateUsers (20110908165659)
|
145
|
+
Migrating to CreateBooks (20110908165716)
|
146
|
+
Migrating to AddReferences (20110909072642)
|
147
|
+
[1m[35m (0.1ms)[0m BEGIN
|
148
|
+
[1m[36m (0.5ms)[0m [1mROLLBACK[0m
|
149
|
+
[1m[36m (0.2ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
150
|
+
Migrating to CreateUsers (20110908165659)
|
151
|
+
Migrating to CreateBooks (20110908165716)
|
152
|
+
Migrating to AddReferences (20110909072642)
|
153
|
+
[1m[35m (0.1ms)[0m BEGIN
|
154
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
155
|
+
[1m[36m (0.2ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
156
|
+
Migrating to CreateUsers (20110908165659)
|
157
|
+
Migrating to CreateBooks (20110908165716)
|
158
|
+
Migrating to AddReferences (20110909072642)
|
159
|
+
[1m[35m (0.1ms)[0m BEGIN
|
160
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
161
|
+
[1m[36m (0.4ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
162
|
+
Migrating to CreateUsers (20110908165659)
|
163
|
+
Migrating to CreateBooks (20110908165716)
|
164
|
+
Migrating to AddReferences (20110909072642)
|
165
|
+
[1m[35m (0.1ms)[0m BEGIN
|
166
|
+
[1m[36m (0.1ms)[0m [1mROLLBACK[0m
|
167
|
+
[1m[36m (0.2ms)[0m [1mSELECT "schema_migrations"."version" FROM "schema_migrations" [0m
|
168
|
+
Migrating to CreateUsers (20110908165659)
|
169
|
+
Migrating to CreateBooks (20110908165716)
|
170
|
+
Migrating to AddReferences (20110909072642)
|
171
|
+
[1m[35m (0.1ms)[0m BEGIN
|
172
|
+
[1m[36m (2.0ms)[0m [1mALTER TABLE "books" ADD CONSTRAINT "books_user_id_fk" FOREIGN KEY ("user_id") REFERENCES "users"(id)[0m
|
173
|
+
[1m[35m (0.2ms)[0m INSERT INTO "schema_migrations" ("version") VALUES ('20110909072642')
|
174
|
+
[1m[36m (17.0ms)[0m [1mCOMMIT[0m
|
175
|
+
[1m[35m (0.2ms)[0m SELECT "schema_migrations"."version" FROM "schema_migrations"
|
176
|
+
[1m[36m (0.1ms)[0m [1mSHOW search_path[0m
|
177
|
+
[1m[35m (1.3ms)[0m 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
|
+
[1m[36m (0.8ms)[0m [1m 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
|
+
[0m
|
196
|
+
[1m[35m (2.9ms)[0m
|
197
|
+
SELECT t2.relname AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confdeltype AS dependency
|
198
|
+
FROM pg_constraint c
|
199
|
+
JOIN pg_class t1 ON c.conrelid = t1.oid
|
200
|
+
JOIN pg_class t2 ON c.confrelid = t2.oid
|
201
|
+
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
202
|
+
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
203
|
+
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
204
|
+
WHERE c.contype = 'f'
|
205
|
+
AND t1.relname = 'books'
|
206
|
+
AND t3.nspname = ANY (current_schemas(false))
|
207
|
+
ORDER BY c.conname
|
208
|
+
|
209
|
+
[1m[36m (3.0ms)[0m [1m
|
210
|
+
SELECT t2.relname AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confdeltype AS dependency
|
211
|
+
FROM pg_constraint c
|
212
|
+
JOIN pg_class t1 ON c.conrelid = t1.oid
|
213
|
+
JOIN pg_class t2 ON c.confrelid = t2.oid
|
214
|
+
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
215
|
+
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
216
|
+
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
217
|
+
WHERE c.contype = 'f'
|
218
|
+
AND t1.relname = 'schema_migrations'
|
219
|
+
AND t3.nspname = ANY (current_schemas(false))
|
220
|
+
ORDER BY c.conname
|
221
|
+
[0m
|
222
|
+
[1m[35m (2.7ms)[0m
|
223
|
+
SELECT t2.relname AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confdeltype AS dependency
|
224
|
+
FROM pg_constraint c
|
225
|
+
JOIN pg_class t1 ON c.conrelid = t1.oid
|
226
|
+
JOIN pg_class t2 ON c.confrelid = t2.oid
|
227
|
+
JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
|
228
|
+
JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
|
229
|
+
JOIN pg_namespace t3 ON c.connamespace = t3.oid
|
230
|
+
WHERE c.contype = 'f'
|
231
|
+
AND t1.relname = 'users'
|
232
|
+
AND t3.nspname = ANY (current_schemas(false))
|
233
|
+
ORDER BY c.conname
|
234
|
+
|