poly_belongs_to 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +16 -0
- data/lib/poly_belongs_to/core.rb +5 -5
- data/lib/poly_belongs_to/version.rb +1 -1
- data/test/core_test.rb +28 -0
- data/test/dummy/app/models/coffee.rb +4 -0
- data/test/dummy/db/migrate/20150511161648_create_coffees.rb +9 -0
- data/test/dummy/db/schema.rb +31 -22
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +264 -0
- data/test/dummy/log/test.log +4517 -0
- data/test/dummy/test/fixtures/coffees.yml +8 -0
- data/test/dummy/test/models/coffee_test.rb +13 -0
- metadata +10 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e6054c91db73afab22ff9dc7c29f9571abd9879
|
4
|
+
data.tar.gz: 15bb717fb64810467be0b60106d447b684155fd8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44cc12a9ad44ead468cb743f2c667155770e250cdb89ae860ddff6d1d21f6079bacd51ca02f443f3b4907f068ad221745b516a357a0c7c643a03b1ee54c91db4
|
7
|
+
data.tar.gz: 0c5106163968c48cf6cc7874bd5d6b5533d48fa00f5fe12afd7b2682e0f8ad3eea70978b97e44b821a3c4ca0421a7942364d540e68917f92a7c89aadcf78f7d8
|
data/README.md
CHANGED
@@ -40,6 +40,18 @@ Tire.pbts
|
|
40
40
|
MyObject.pbt_orphans
|
41
41
|
# => #<ActiveRecord::Relation []> # nil for objects without belongs_to
|
42
42
|
|
43
|
+
# Get polymorphic objects for records of invalid class type(s)
|
44
|
+
MyObject.pbt_mistyped
|
45
|
+
# => #<ActiveRecord::Relation []>
|
46
|
+
|
47
|
+
# Get the invalid class types on polymorphic records as a Array of Strings
|
48
|
+
MyObject.pbt_mistypes
|
49
|
+
# => ["Object", "Class", "MyObjectable"]
|
50
|
+
|
51
|
+
# Get the valid class types on polymorphic records as a Array of Strings
|
52
|
+
MyObject.pbt_valid_types
|
53
|
+
# => ["User", "MyObject"]
|
54
|
+
|
43
55
|
# Params name
|
44
56
|
MyObject.pbt_params_name
|
45
57
|
# => :my_objectable_attributes
|
@@ -75,6 +87,10 @@ MyObject.first.pbt_top_parent
|
|
75
87
|
# Mutliple Parent Objects (List of one item for Polymorphic, full list otherwise.)
|
76
88
|
Tire.first.pbt_parents
|
77
89
|
# => [#<User id: 123 ... >, #<Car id: 234 ... >]
|
90
|
+
|
91
|
+
# Determine if object is orphaned (parent no longer exists)
|
92
|
+
Tire.first.orphan?
|
93
|
+
# => false
|
78
94
|
```
|
79
95
|
|
80
96
|
##Also Available
|
data/lib/poly_belongs_to/core.rb
CHANGED
@@ -49,7 +49,7 @@ module PolyBelongsTo
|
|
49
49
|
# @return [Array<String>]
|
50
50
|
def self.pbt_poly_types
|
51
51
|
return [] unless poly?
|
52
|
-
pluck(pbt_type_sym)
|
52
|
+
uniq.pluck(pbt_type_sym)
|
53
53
|
end
|
54
54
|
|
55
55
|
# Returns strings of the invalid class names stored in polymorphic records
|
@@ -86,12 +86,12 @@ module PolyBelongsTo
|
|
86
86
|
# Return Array of current Class polymorphic records that are orphaned from parents
|
87
87
|
# @return [Array<Object>] ActiveRecord orphan objects
|
88
88
|
def self._pbt_polymorphic_orphans
|
89
|
-
|
89
|
+
accumulative = nil
|
90
90
|
pbt_valid_types.each do |type|
|
91
91
|
arel_part = arel_table[pbt_id_sym].not_in(type.constantize.pluck(:id)).and(arel_table[pbt_type_sym].eq(type))
|
92
|
-
|
92
|
+
accumulative = accumulative.present? ? accumulative.or(arel_part) : arel_part
|
93
93
|
end
|
94
|
-
where(
|
94
|
+
where(accumulative)
|
95
95
|
end
|
96
96
|
|
97
97
|
# Return Array of current Class nonpolymorphic records that are orphaned from parents
|
@@ -170,7 +170,7 @@ module PolyBelongsTo
|
|
170
170
|
Array[pbt_parent].compact
|
171
171
|
else
|
172
172
|
self.class.pbts.map {|i|
|
173
|
-
try{ "#{i.capitalize}".constantize.
|
173
|
+
try{ "#{i.capitalize}".constantize.where(id: self.send("#{i}_id")).first }
|
174
174
|
}.compact
|
175
175
|
end
|
176
176
|
end
|
data/test/core_test.rb
CHANGED
@@ -274,6 +274,34 @@ class CoreTest < ActiveSupport::TestCase
|
|
274
274
|
Squishy.pbt_valid_types.sort.must_equal ["Phone", "Address", "GeoLocation"].sort
|
275
275
|
end
|
276
276
|
|
277
|
+
it "#pbt_valid_types returns empty Array for no valid record types" do
|
278
|
+
Coffee.create(Coffee.pbt_id_sym => 12345, Coffee.pbt_type_sym => "Object")
|
279
|
+
Coffee.create(Coffee.pbt_id_sym => 12345, Coffee.pbt_type_sym => "Class")
|
280
|
+
Coffee.create(Coffee.pbt_id_sym => 12345, Coffee.pbt_type_sym => "Squishable")
|
281
|
+
Coffee.pbt_valid_types.to_a.sort.must_be :empty?
|
282
|
+
end
|
283
|
+
|
284
|
+
it "I'm just curious if polymorphic can belong to itself" do
|
285
|
+
coffee = Coffee.create(Coffee.pbt_id_sym => 12345, Coffee.pbt_type_sym => "Coffee")
|
286
|
+
coffee.must_be :valid?
|
287
|
+
coffee.coffeeable_type.must_equal "Coffee"
|
288
|
+
coffee.must_be :persisted?
|
289
|
+
end
|
290
|
+
|
291
|
+
it "#pbt_mistyped returns empty Array for no valid record types" do
|
292
|
+
Coffee.create(Coffee.pbt_id_sym => 12345, Coffee.pbt_type_sym => "Phone")
|
293
|
+
Coffee.create(Coffee.pbt_id_sym => 12345, Coffee.pbt_type_sym => "Address")
|
294
|
+
Coffee.create(Coffee.pbt_id_sym => 12345, Coffee.pbt_type_sym => "User")
|
295
|
+
Coffee.pbt_mistyped.to_a.sort.must_be :empty?
|
296
|
+
end
|
297
|
+
|
298
|
+
it "#pbt_mistypes returns empty Array if only valid polymorphic record types exist" do
|
299
|
+
Squishy.create(Squishy.pbt_id_sym => 12345, Squishy.pbt_type_sym => "Phone")
|
300
|
+
Squishy.create(Squishy.pbt_id_sym => 12345, Squishy.pbt_type_sym => "Address")
|
301
|
+
Squishy.create(Squishy.pbt_id_sym => 12345, Squishy.pbt_type_sym => "GeoLocation")
|
302
|
+
Squishy.pbt_mistypes.sort.must_be :empty?
|
303
|
+
end
|
304
|
+
|
277
305
|
it "#pbt_poly_types returns strings of all polymorphic record types" do
|
278
306
|
Squishy.create(Squishy.pbt_id_sym => 12345, Squishy.pbt_type_sym => "Object")
|
279
307
|
Squishy.create(Squishy.pbt_id_sym => 12345, Squishy.pbt_type_sym => "Class")
|
data/test/dummy/db/schema.rb
CHANGED
@@ -11,9 +11,9 @@
|
|
11
11
|
#
|
12
12
|
# It's strongly recommended that you check this file into your version control system.
|
13
13
|
|
14
|
-
ActiveRecord::Schema.define(version:
|
14
|
+
ActiveRecord::Schema.define(version: 20150511161648) do
|
15
15
|
|
16
|
-
create_table "addresses", force:
|
16
|
+
create_table "addresses", force: :cascade do |t|
|
17
17
|
t.integer "addressable_id"
|
18
18
|
t.string "addressable_type"
|
19
19
|
t.string "content"
|
@@ -21,9 +21,9 @@ ActiveRecord::Schema.define(version: 20150322233755) do
|
|
21
21
|
t.datetime "updated_at"
|
22
22
|
end
|
23
23
|
|
24
|
-
add_index "addresses", ["
|
24
|
+
add_index "addresses", ["addressable_type", "addressable_id"], name: "index_addresses_on_addressable_type_and_addressable_id"
|
25
25
|
|
26
|
-
create_table "alphas", force:
|
26
|
+
create_table "alphas", force: :cascade do |t|
|
27
27
|
t.string "content"
|
28
28
|
t.integer "delta_id"
|
29
29
|
t.datetime "created_at"
|
@@ -32,7 +32,7 @@ ActiveRecord::Schema.define(version: 20150322233755) do
|
|
32
32
|
|
33
33
|
add_index "alphas", ["delta_id"], name: "index_alphas_on_delta_id"
|
34
34
|
|
35
|
-
create_table "beta", force:
|
35
|
+
create_table "beta", force: :cascade do |t|
|
36
36
|
t.string "content"
|
37
37
|
t.integer "alpha_id"
|
38
38
|
t.datetime "created_at"
|
@@ -41,7 +41,7 @@ ActiveRecord::Schema.define(version: 20150322233755) do
|
|
41
41
|
|
42
42
|
add_index "beta", ["alpha_id"], name: "index_beta_on_alpha_id"
|
43
43
|
|
44
|
-
create_table "capas", force:
|
44
|
+
create_table "capas", force: :cascade do |t|
|
45
45
|
t.string "content"
|
46
46
|
t.integer "beta_id"
|
47
47
|
t.datetime "created_at"
|
@@ -50,7 +50,7 @@ ActiveRecord::Schema.define(version: 20150322233755) do
|
|
50
50
|
|
51
51
|
add_index "capas", ["beta_id"], name: "index_capas_on_beta_id"
|
52
52
|
|
53
|
-
create_table "cars", force:
|
53
|
+
create_table "cars", force: :cascade do |t|
|
54
54
|
t.integer "user_id"
|
55
55
|
t.string "content"
|
56
56
|
t.datetime "created_at"
|
@@ -59,7 +59,16 @@ ActiveRecord::Schema.define(version: 20150322233755) do
|
|
59
59
|
|
60
60
|
add_index "cars", ["user_id"], name: "index_cars_on_user_id"
|
61
61
|
|
62
|
-
create_table "
|
62
|
+
create_table "coffees", force: :cascade do |t|
|
63
|
+
t.integer "coffeeable_id"
|
64
|
+
t.string "coffeeable_type"
|
65
|
+
t.datetime "created_at", null: false
|
66
|
+
t.datetime "updated_at", null: false
|
67
|
+
end
|
68
|
+
|
69
|
+
add_index "coffees", ["coffeeable_type", "coffeeable_id"], name: "index_coffees_on_coffeeable_type_and_coffeeable_id"
|
70
|
+
|
71
|
+
create_table "contacts", force: :cascade do |t|
|
63
72
|
t.integer "user_id"
|
64
73
|
t.string "content"
|
65
74
|
t.datetime "created_at"
|
@@ -68,7 +77,7 @@ ActiveRecord::Schema.define(version: 20150322233755) do
|
|
68
77
|
|
69
78
|
add_index "contacts", ["user_id"], name: "index_contacts_on_user_id"
|
70
79
|
|
71
|
-
create_table "delta", force:
|
80
|
+
create_table "delta", force: :cascade do |t|
|
72
81
|
t.string "content"
|
73
82
|
t.integer "capa_id"
|
74
83
|
t.datetime "created_at"
|
@@ -77,7 +86,7 @@ ActiveRecord::Schema.define(version: 20150322233755) do
|
|
77
86
|
|
78
87
|
add_index "delta", ["capa_id"], name: "index_delta_on_capa_id"
|
79
88
|
|
80
|
-
create_table "geo_locations", force:
|
89
|
+
create_table "geo_locations", force: :cascade do |t|
|
81
90
|
t.integer "address_id"
|
82
91
|
t.string "content"
|
83
92
|
t.datetime "created_at"
|
@@ -86,7 +95,7 @@ ActiveRecord::Schema.define(version: 20150322233755) do
|
|
86
95
|
|
87
96
|
add_index "geo_locations", ["address_id"], name: "index_geo_locations_on_address_id"
|
88
97
|
|
89
|
-
create_table "phones", force:
|
98
|
+
create_table "phones", force: :cascade do |t|
|
90
99
|
t.integer "phoneable_id"
|
91
100
|
t.string "phoneable_type"
|
92
101
|
t.string "content"
|
@@ -94,9 +103,9 @@ ActiveRecord::Schema.define(version: 20150322233755) do
|
|
94
103
|
t.datetime "updated_at", null: false
|
95
104
|
end
|
96
105
|
|
97
|
-
add_index "phones", ["
|
106
|
+
add_index "phones", ["phoneable_type", "phoneable_id"], name: "index_phones_on_phoneable_type_and_phoneable_id"
|
98
107
|
|
99
|
-
create_table "photos", force:
|
108
|
+
create_table "photos", force: :cascade do |t|
|
100
109
|
t.integer "photoable_id"
|
101
110
|
t.string "photoable_type"
|
102
111
|
t.string "content"
|
@@ -104,9 +113,9 @@ ActiveRecord::Schema.define(version: 20150322233755) do
|
|
104
113
|
t.datetime "updated_at"
|
105
114
|
end
|
106
115
|
|
107
|
-
add_index "photos", ["
|
116
|
+
add_index "photos", ["photoable_type", "photoable_id"], name: "index_photos_on_photoable_type_and_photoable_id"
|
108
117
|
|
109
|
-
create_table "profiles", force:
|
118
|
+
create_table "profiles", force: :cascade do |t|
|
110
119
|
t.integer "profileable_id"
|
111
120
|
t.string "profileable_type"
|
112
121
|
t.string "content"
|
@@ -114,9 +123,9 @@ ActiveRecord::Schema.define(version: 20150322233755) do
|
|
114
123
|
t.datetime "updated_at"
|
115
124
|
end
|
116
125
|
|
117
|
-
add_index "profiles", ["
|
126
|
+
add_index "profiles", ["profileable_type", "profileable_id"], name: "index_profiles_on_profileable_type_and_profileable_id"
|
118
127
|
|
119
|
-
create_table "squishies", force:
|
128
|
+
create_table "squishies", force: :cascade do |t|
|
120
129
|
t.string "content"
|
121
130
|
t.integer "squishable_id"
|
122
131
|
t.string "squishable_type"
|
@@ -124,9 +133,9 @@ ActiveRecord::Schema.define(version: 20150322233755) do
|
|
124
133
|
t.datetime "updated_at"
|
125
134
|
end
|
126
135
|
|
127
|
-
add_index "squishies", ["
|
136
|
+
add_index "squishies", ["squishable_type", "squishable_id"], name: "index_squishies_on_squishable_type_and_squishable_id"
|
128
137
|
|
129
|
-
create_table "ssns", force:
|
138
|
+
create_table "ssns", force: :cascade do |t|
|
130
139
|
t.integer "user_id"
|
131
140
|
t.string "content"
|
132
141
|
t.datetime "created_at"
|
@@ -135,7 +144,7 @@ ActiveRecord::Schema.define(version: 20150322233755) do
|
|
135
144
|
|
136
145
|
add_index "ssns", ["user_id"], name: "index_ssns_on_user_id"
|
137
146
|
|
138
|
-
create_table "tags", force:
|
147
|
+
create_table "tags", force: :cascade do |t|
|
139
148
|
t.integer "user_id"
|
140
149
|
t.string "content"
|
141
150
|
t.datetime "created_at", null: false
|
@@ -144,7 +153,7 @@ ActiveRecord::Schema.define(version: 20150322233755) do
|
|
144
153
|
|
145
154
|
add_index "tags", ["user_id"], name: "index_tags_on_user_id"
|
146
155
|
|
147
|
-
create_table "tires", force:
|
156
|
+
create_table "tires", force: :cascade do |t|
|
148
157
|
t.integer "user_id"
|
149
158
|
t.integer "car_id"
|
150
159
|
t.string "content"
|
@@ -155,7 +164,7 @@ ActiveRecord::Schema.define(version: 20150322233755) do
|
|
155
164
|
add_index "tires", ["car_id"], name: "index_tires_on_car_id"
|
156
165
|
add_index "tires", ["user_id"], name: "index_tires_on_user_id"
|
157
166
|
|
158
|
-
create_table "users", force:
|
167
|
+
create_table "users", force: :cascade do |t|
|
159
168
|
t.string "content"
|
160
169
|
t.datetime "created_at", null: false
|
161
170
|
t.datetime "updated_at", null: false
|
data/test/dummy/db/test.sqlite3
CHANGED
Binary file
|
@@ -314,3 +314,267 @@ Migrating to CreateDelta (20150322233755)
|
|
314
314
|
[1m[35mSQL (0.1ms)[0m INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20150322233755"]]
|
315
315
|
[1m[36m (12.5ms)[0m [1mcommit transaction[0m
|
316
316
|
[1m[35mActiveRecord::SchemaMigration Load (0.3ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
317
|
+
[1m[36m (15.7ms)[0m [1mCREATE TABLE "schema_migrations" ("version" varchar NOT NULL) [0m
|
318
|
+
[1m[35m (0.2ms)[0m select sqlite_version(*)
|
319
|
+
[1m[36m (12.7ms)[0m [1mCREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")[0m
|
320
|
+
[1m[35mActiveRecord::SchemaMigration Load (0.2ms)[0m SELECT "schema_migrations".* FROM "schema_migrations"
|
321
|
+
Migrating to CreateUsers (20150211224139)
|
322
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
323
|
+
[1m[35m (0.3ms)[0m CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "content" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
|
324
|
+
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "20150211224139"]]
|
325
|
+
[1m[35m (17.2ms)[0m commit transaction
|
326
|
+
Migrating to CreateTags (20150211224157)
|
327
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
328
|
+
[1m[35m (0.6ms)[0m CREATE TABLE "tags" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "content" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
|
329
|
+
[1m[36m (0.3ms)[0m [1mCREATE INDEX "index_tags_on_user_id" ON "tags" ("user_id")[0m
|
330
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20150211224157"]]
|
331
|
+
[1m[36m (22.8ms)[0m [1mcommit transaction[0m
|
332
|
+
Migrating to CreatePhones (20150211224225)
|
333
|
+
[1m[35m (0.1ms)[0m begin transaction
|
334
|
+
[1m[36m (0.6ms)[0m [1mCREATE TABLE "phones" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "phoneable_id" integer, "phoneable_type" varchar, "content" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) [0m
|
335
|
+
[1m[35m (0.3ms)[0m CREATE INDEX "index_phones_on_phoneable_type_and_phoneable_id" ON "phones" ("phoneable_type", "phoneable_id")
|
336
|
+
[1m[36mSQL (0.3ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "20150211224225"]]
|
337
|
+
[1m[35m (24.6ms)[0m commit transaction
|
338
|
+
Migrating to CreateAddresses (20150216092218)
|
339
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
340
|
+
DEPRECATION WARNING: `#timestamp` was called without specifying an option for `null`. In Rails 5, this behavior will change to `null: false`. You should manually specify `null: true` to prevent the behavior of your existing migrations from changing. (called from block in change at /home/danielpclark/dev/PolyBelongsTo/test/dummy/db/migrate/20150216092218_create_addresses.rb:7)
|
341
|
+
[1m[35m (0.6ms)[0m CREATE TABLE "addresses" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "addressable_id" integer, "addressable_type" varchar, "content" varchar, "created_at" datetime, "updated_at" datetime)
|
342
|
+
[1m[36m (0.3ms)[0m [1mCREATE INDEX "index_addresses_on_addressable_type_and_addressable_id" ON "addresses" ("addressable_type", "addressable_id")[0m
|
343
|
+
[1m[35mSQL (0.3ms)[0m INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20150216092218"]]
|
344
|
+
[1m[36m (25.0ms)[0m [1mcommit transaction[0m
|
345
|
+
Migrating to CreateProfiles (20150216092338)
|
346
|
+
[1m[35m (0.1ms)[0m begin transaction
|
347
|
+
DEPRECATION WARNING: `#timestamp` was called without specifying an option for `null`. In Rails 5, this behavior will change to `null: false`. You should manually specify `null: true` to prevent the behavior of your existing migrations from changing. (called from block in change at /home/danielpclark/dev/PolyBelongsTo/test/dummy/db/migrate/20150216092338_create_profiles.rb:7)
|
348
|
+
[1m[36m (0.7ms)[0m [1mCREATE TABLE "profiles" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "profileable_id" integer, "profileable_type" varchar, "content" varchar, "created_at" datetime, "updated_at" datetime) [0m
|
349
|
+
[1m[35m (0.3ms)[0m CREATE INDEX "index_profiles_on_profileable_type_and_profileable_id" ON "profiles" ("profileable_type", "profileable_id")
|
350
|
+
[1m[36mSQL (0.3ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "20150216092338"]]
|
351
|
+
[1m[35m (27.6ms)[0m commit transaction
|
352
|
+
Migrating to CreatePhotos (20150216092411)
|
353
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
354
|
+
DEPRECATION WARNING: `#timestamp` was called without specifying an option for `null`. In Rails 5, this behavior will change to `null: false`. You should manually specify `null: true` to prevent the behavior of your existing migrations from changing. (called from block in change at /home/danielpclark/dev/PolyBelongsTo/test/dummy/db/migrate/20150216092411_create_photos.rb:7)
|
355
|
+
[1m[35m (0.6ms)[0m CREATE TABLE "photos" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "photoable_id" integer, "photoable_type" varchar, "content" varchar, "created_at" datetime, "updated_at" datetime)
|
356
|
+
[1m[36m (0.5ms)[0m [1mCREATE INDEX "index_photos_on_photoable_type_and_photoable_id" ON "photos" ("photoable_type", "photoable_id")[0m
|
357
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20150216092411"]]
|
358
|
+
[1m[36m (28.3ms)[0m [1mcommit transaction[0m
|
359
|
+
Migrating to CreateContacts (20150216092449)
|
360
|
+
[1m[35m (0.1ms)[0m begin transaction
|
361
|
+
DEPRECATION WARNING: `#timestamp` was called without specifying an option for `null`. In Rails 5, this behavior will change to `null: false`. You should manually specify `null: true` to prevent the behavior of your existing migrations from changing. (called from block in change at /home/danielpclark/dev/PolyBelongsTo/test/dummy/db/migrate/20150216092449_create_contacts.rb:7)
|
362
|
+
[1m[36m (0.6ms)[0m [1mCREATE TABLE "contacts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "content" varchar, "created_at" datetime, "updated_at" datetime) [0m
|
363
|
+
[1m[35m (0.3ms)[0m CREATE INDEX "index_contacts_on_user_id" ON "contacts" ("user_id")
|
364
|
+
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "20150216092449"]]
|
365
|
+
[1m[35m (31.5ms)[0m commit transaction
|
366
|
+
Migrating to CreateSsns (20150216092519)
|
367
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
368
|
+
DEPRECATION WARNING: `#timestamp` was called without specifying an option for `null`. In Rails 5, this behavior will change to `null: false`. You should manually specify `null: true` to prevent the behavior of your existing migrations from changing. (called from block in change at /home/danielpclark/dev/PolyBelongsTo/test/dummy/db/migrate/20150216092519_create_ssns.rb:7)
|
369
|
+
[1m[35m (0.6ms)[0m CREATE TABLE "ssns" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "content" varchar, "created_at" datetime, "updated_at" datetime)
|
370
|
+
[1m[36m (0.3ms)[0m [1mCREATE INDEX "index_ssns_on_user_id" ON "ssns" ("user_id")[0m
|
371
|
+
[1m[35mSQL (0.3ms)[0m INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20150216092519"]]
|
372
|
+
[1m[36m (27.7ms)[0m [1mcommit transaction[0m
|
373
|
+
Migrating to CreateGeoLocations (20150220213422)
|
374
|
+
[1m[35m (0.1ms)[0m begin transaction
|
375
|
+
DEPRECATION WARNING: `#timestamp` was called without specifying an option for `null`. In Rails 5, this behavior will change to `null: false`. You should manually specify `null: true` to prevent the behavior of your existing migrations from changing. (called from block in change at /home/danielpclark/dev/PolyBelongsTo/test/dummy/db/migrate/20150220213422_create_geo_locations.rb:7)
|
376
|
+
[1m[36m (0.6ms)[0m [1mCREATE TABLE "geo_locations" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "address_id" integer, "content" varchar, "created_at" datetime, "updated_at" datetime) [0m
|
377
|
+
[1m[35m (0.4ms)[0m CREATE INDEX "index_geo_locations_on_address_id" ON "geo_locations" ("address_id")
|
378
|
+
[1m[36mSQL (0.2ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "20150220213422"]]
|
379
|
+
[1m[35m (29.9ms)[0m commit transaction
|
380
|
+
Migrating to CreateSquishies (20150220230146)
|
381
|
+
[1m[36m (0.2ms)[0m [1mbegin transaction[0m
|
382
|
+
DEPRECATION WARNING: `#timestamp` was called without specifying an option for `null`. In Rails 5, this behavior will change to `null: false`. You should manually specify `null: true` to prevent the behavior of your existing migrations from changing. (called from block in change at /home/danielpclark/dev/PolyBelongsTo/test/dummy/db/migrate/20150220230146_create_squishies.rb:7)
|
383
|
+
[1m[35m (0.7ms)[0m CREATE TABLE "squishies" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "content" varchar, "squishable_id" integer, "squishable_type" varchar, "created_at" datetime, "updated_at" datetime)
|
384
|
+
[1m[36m (0.5ms)[0m [1mCREATE INDEX "index_squishies_on_squishable_type_and_squishable_id" ON "squishies" ("squishable_type", "squishable_id")[0m
|
385
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20150220230146"]]
|
386
|
+
[1m[36m (26.3ms)[0m [1mcommit transaction[0m
|
387
|
+
Migrating to CreateTires (20150301100658)
|
388
|
+
[1m[35m (0.2ms)[0m begin transaction
|
389
|
+
DEPRECATION WARNING: `#timestamp` was called without specifying an option for `null`. In Rails 5, this behavior will change to `null: false`. You should manually specify `null: true` to prevent the behavior of your existing migrations from changing. (called from block in change at /home/danielpclark/dev/PolyBelongsTo/test/dummy/db/migrate/20150301100658_create_tires.rb:8)
|
390
|
+
[1m[36m (0.7ms)[0m [1mCREATE TABLE "tires" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "car_id" integer, "content" varchar, "created_at" datetime, "updated_at" datetime) [0m
|
391
|
+
[1m[35m (0.3ms)[0m CREATE INDEX "index_tires_on_user_id" ON "tires" ("user_id")
|
392
|
+
[1m[36m (0.2ms)[0m [1m SELECT sql
|
393
|
+
FROM sqlite_master
|
394
|
+
WHERE name='index_tires_on_user_id' AND type='index'
|
395
|
+
UNION ALL
|
396
|
+
SELECT sql
|
397
|
+
FROM sqlite_temp_master
|
398
|
+
WHERE name='index_tires_on_user_id' AND type='index'
|
399
|
+
[0m
|
400
|
+
[1m[35m (0.3ms)[0m CREATE INDEX "index_tires_on_car_id" ON "tires" ("car_id")
|
401
|
+
[1m[36mSQL (0.3ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "20150301100658"]]
|
402
|
+
[1m[35m (22.0ms)[0m commit transaction
|
403
|
+
Migrating to CreateCars (20150301100722)
|
404
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
405
|
+
DEPRECATION WARNING: `#timestamp` was called without specifying an option for `null`. In Rails 5, this behavior will change to `null: false`. You should manually specify `null: true` to prevent the behavior of your existing migrations from changing. (called from block in change at /home/danielpclark/dev/PolyBelongsTo/test/dummy/db/migrate/20150301100722_create_cars.rb:7)
|
406
|
+
[1m[35m (0.3ms)[0m CREATE TABLE "cars" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "user_id" integer, "content" varchar, "created_at" datetime, "updated_at" datetime)
|
407
|
+
[1m[36m (0.2ms)[0m [1mCREATE INDEX "index_cars_on_user_id" ON "cars" ("user_id")[0m
|
408
|
+
[1m[35mSQL (0.1ms)[0m INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20150301100722"]]
|
409
|
+
[1m[36m (26.1ms)[0m [1mcommit transaction[0m
|
410
|
+
Migrating to CreateAlphas (20150322233720)
|
411
|
+
[1m[35m (0.1ms)[0m begin transaction
|
412
|
+
DEPRECATION WARNING: `#timestamp` was called without specifying an option for `null`. In Rails 5, this behavior will change to `null: false`. You should manually specify `null: true` to prevent the behavior of your existing migrations from changing. (called from block in change at /home/danielpclark/dev/PolyBelongsTo/test/dummy/db/migrate/20150322233720_create_alphas.rb:7)
|
413
|
+
[1m[36m (0.7ms)[0m [1mCREATE TABLE "alphas" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "content" varchar, "delta_id" integer, "created_at" datetime, "updated_at" datetime) [0m
|
414
|
+
[1m[35m (0.4ms)[0m CREATE INDEX "index_alphas_on_delta_id" ON "alphas" ("delta_id")
|
415
|
+
[1m[36mSQL (0.2ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "20150322233720"]]
|
416
|
+
[1m[35m (31.0ms)[0m commit transaction
|
417
|
+
Migrating to CreateBeta (20150322233733)
|
418
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
419
|
+
DEPRECATION WARNING: `#timestamp` was called without specifying an option for `null`. In Rails 5, this behavior will change to `null: false`. You should manually specify `null: true` to prevent the behavior of your existing migrations from changing. (called from block in change at /home/danielpclark/dev/PolyBelongsTo/test/dummy/db/migrate/20150322233733_create_beta.rb:7)
|
420
|
+
[1m[35m (0.5ms)[0m CREATE TABLE "beta" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "content" varchar, "alpha_id" integer, "created_at" datetime, "updated_at" datetime)
|
421
|
+
[1m[36m (0.3ms)[0m [1mCREATE INDEX "index_beta_on_alpha_id" ON "beta" ("alpha_id")[0m
|
422
|
+
[1m[35mSQL (0.3ms)[0m INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20150322233733"]]
|
423
|
+
[1m[36m (27.2ms)[0m [1mcommit transaction[0m
|
424
|
+
Migrating to CreateCapas (20150322233743)
|
425
|
+
[1m[35m (0.1ms)[0m begin transaction
|
426
|
+
DEPRECATION WARNING: `#timestamp` was called without specifying an option for `null`. In Rails 5, this behavior will change to `null: false`. You should manually specify `null: true` to prevent the behavior of your existing migrations from changing. (called from block in change at /home/danielpclark/dev/PolyBelongsTo/test/dummy/db/migrate/20150322233743_create_capas.rb:7)
|
427
|
+
[1m[36m (0.7ms)[0m [1mCREATE TABLE "capas" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "content" varchar, "beta_id" integer, "created_at" datetime, "updated_at" datetime) [0m
|
428
|
+
[1m[35m (0.5ms)[0m CREATE INDEX "index_capas_on_beta_id" ON "capas" ("beta_id")
|
429
|
+
[1m[36mSQL (0.2ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "20150322233743"]]
|
430
|
+
[1m[35m (26.4ms)[0m commit transaction
|
431
|
+
Migrating to CreateDelta (20150322233755)
|
432
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
433
|
+
DEPRECATION WARNING: `#timestamp` was called without specifying an option for `null`. In Rails 5, this behavior will change to `null: false`. You should manually specify `null: true` to prevent the behavior of your existing migrations from changing. (called from block in change at /home/danielpclark/dev/PolyBelongsTo/test/dummy/db/migrate/20150322233755_create_delta.rb:7)
|
434
|
+
[1m[35m (0.7ms)[0m CREATE TABLE "delta" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "content" varchar, "capa_id" integer, "created_at" datetime, "updated_at" datetime)
|
435
|
+
[1m[36m (0.3ms)[0m [1mCREATE INDEX "index_delta_on_capa_id" ON "delta" ("capa_id")[0m
|
436
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO "schema_migrations" ("version") VALUES (?) [["version", "20150322233755"]]
|
437
|
+
[1m[36m (26.0ms)[0m [1mcommit transaction[0m
|
438
|
+
Migrating to CreateCoffees (20150511161648)
|
439
|
+
[1m[35m (0.1ms)[0m begin transaction
|
440
|
+
[1m[36m (0.7ms)[0m [1mCREATE TABLE "coffees" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "coffeeable_id" integer, "coffeeable_type" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) [0m
|
441
|
+
[1m[35m (0.3ms)[0m CREATE INDEX "index_coffees_on_coffeeable_type_and_coffeeable_id" ON "coffees" ("coffeeable_type", "coffeeable_id")
|
442
|
+
[1m[36mSQL (0.1ms)[0m [1mINSERT INTO "schema_migrations" ("version") VALUES (?)[0m [["version", "20150511161648"]]
|
443
|
+
[1m[35m (22.4ms)[0m commit transaction
|
444
|
+
[1m[36mActiveRecord::SchemaMigration Load (0.3ms)[0m [1mSELECT "schema_migrations".* FROM "schema_migrations"[0m
|
445
|
+
[1m[35m (0.3ms)[0m SELECT sql
|
446
|
+
FROM sqlite_master
|
447
|
+
WHERE name='index_addresses_on_addressable_type_and_addressable_id' AND type='index'
|
448
|
+
UNION ALL
|
449
|
+
SELECT sql
|
450
|
+
FROM sqlite_temp_master
|
451
|
+
WHERE name='index_addresses_on_addressable_type_and_addressable_id' AND type='index'
|
452
|
+
|
453
|
+
[1m[36m (0.1ms)[0m [1m SELECT sql
|
454
|
+
FROM sqlite_master
|
455
|
+
WHERE name='index_alphas_on_delta_id' AND type='index'
|
456
|
+
UNION ALL
|
457
|
+
SELECT sql
|
458
|
+
FROM sqlite_temp_master
|
459
|
+
WHERE name='index_alphas_on_delta_id' AND type='index'
|
460
|
+
[0m
|
461
|
+
[1m[35m (0.1ms)[0m SELECT sql
|
462
|
+
FROM sqlite_master
|
463
|
+
WHERE name='index_beta_on_alpha_id' AND type='index'
|
464
|
+
UNION ALL
|
465
|
+
SELECT sql
|
466
|
+
FROM sqlite_temp_master
|
467
|
+
WHERE name='index_beta_on_alpha_id' AND type='index'
|
468
|
+
|
469
|
+
[1m[36m (0.1ms)[0m [1m SELECT sql
|
470
|
+
FROM sqlite_master
|
471
|
+
WHERE name='index_capas_on_beta_id' AND type='index'
|
472
|
+
UNION ALL
|
473
|
+
SELECT sql
|
474
|
+
FROM sqlite_temp_master
|
475
|
+
WHERE name='index_capas_on_beta_id' AND type='index'
|
476
|
+
[0m
|
477
|
+
[1m[35m (0.1ms)[0m SELECT sql
|
478
|
+
FROM sqlite_master
|
479
|
+
WHERE name='index_cars_on_user_id' AND type='index'
|
480
|
+
UNION ALL
|
481
|
+
SELECT sql
|
482
|
+
FROM sqlite_temp_master
|
483
|
+
WHERE name='index_cars_on_user_id' AND type='index'
|
484
|
+
|
485
|
+
[1m[36m (0.1ms)[0m [1m SELECT sql
|
486
|
+
FROM sqlite_master
|
487
|
+
WHERE name='index_coffees_on_coffeeable_type_and_coffeeable_id' AND type='index'
|
488
|
+
UNION ALL
|
489
|
+
SELECT sql
|
490
|
+
FROM sqlite_temp_master
|
491
|
+
WHERE name='index_coffees_on_coffeeable_type_and_coffeeable_id' AND type='index'
|
492
|
+
[0m
|
493
|
+
[1m[35m (0.1ms)[0m SELECT sql
|
494
|
+
FROM sqlite_master
|
495
|
+
WHERE name='index_contacts_on_user_id' AND type='index'
|
496
|
+
UNION ALL
|
497
|
+
SELECT sql
|
498
|
+
FROM sqlite_temp_master
|
499
|
+
WHERE name='index_contacts_on_user_id' AND type='index'
|
500
|
+
|
501
|
+
[1m[36m (0.1ms)[0m [1m SELECT sql
|
502
|
+
FROM sqlite_master
|
503
|
+
WHERE name='index_delta_on_capa_id' AND type='index'
|
504
|
+
UNION ALL
|
505
|
+
SELECT sql
|
506
|
+
FROM sqlite_temp_master
|
507
|
+
WHERE name='index_delta_on_capa_id' AND type='index'
|
508
|
+
[0m
|
509
|
+
[1m[35m (0.1ms)[0m SELECT sql
|
510
|
+
FROM sqlite_master
|
511
|
+
WHERE name='index_geo_locations_on_address_id' AND type='index'
|
512
|
+
UNION ALL
|
513
|
+
SELECT sql
|
514
|
+
FROM sqlite_temp_master
|
515
|
+
WHERE name='index_geo_locations_on_address_id' AND type='index'
|
516
|
+
|
517
|
+
[1m[36m (0.1ms)[0m [1m SELECT sql
|
518
|
+
FROM sqlite_master
|
519
|
+
WHERE name='index_phones_on_phoneable_type_and_phoneable_id' AND type='index'
|
520
|
+
UNION ALL
|
521
|
+
SELECT sql
|
522
|
+
FROM sqlite_temp_master
|
523
|
+
WHERE name='index_phones_on_phoneable_type_and_phoneable_id' AND type='index'
|
524
|
+
[0m
|
525
|
+
[1m[35m (0.1ms)[0m SELECT sql
|
526
|
+
FROM sqlite_master
|
527
|
+
WHERE name='index_photos_on_photoable_type_and_photoable_id' AND type='index'
|
528
|
+
UNION ALL
|
529
|
+
SELECT sql
|
530
|
+
FROM sqlite_temp_master
|
531
|
+
WHERE name='index_photos_on_photoable_type_and_photoable_id' AND type='index'
|
532
|
+
|
533
|
+
[1m[36m (0.1ms)[0m [1m SELECT sql
|
534
|
+
FROM sqlite_master
|
535
|
+
WHERE name='index_profiles_on_profileable_type_and_profileable_id' AND type='index'
|
536
|
+
UNION ALL
|
537
|
+
SELECT sql
|
538
|
+
FROM sqlite_temp_master
|
539
|
+
WHERE name='index_profiles_on_profileable_type_and_profileable_id' AND type='index'
|
540
|
+
[0m
|
541
|
+
[1m[35m (0.1ms)[0m SELECT sql
|
542
|
+
FROM sqlite_master
|
543
|
+
WHERE name='index_squishies_on_squishable_type_and_squishable_id' AND type='index'
|
544
|
+
UNION ALL
|
545
|
+
SELECT sql
|
546
|
+
FROM sqlite_temp_master
|
547
|
+
WHERE name='index_squishies_on_squishable_type_and_squishable_id' AND type='index'
|
548
|
+
|
549
|
+
[1m[36m (0.1ms)[0m [1m SELECT sql
|
550
|
+
FROM sqlite_master
|
551
|
+
WHERE name='index_ssns_on_user_id' AND type='index'
|
552
|
+
UNION ALL
|
553
|
+
SELECT sql
|
554
|
+
FROM sqlite_temp_master
|
555
|
+
WHERE name='index_ssns_on_user_id' AND type='index'
|
556
|
+
[0m
|
557
|
+
[1m[35m (0.1ms)[0m SELECT sql
|
558
|
+
FROM sqlite_master
|
559
|
+
WHERE name='index_tags_on_user_id' AND type='index'
|
560
|
+
UNION ALL
|
561
|
+
SELECT sql
|
562
|
+
FROM sqlite_temp_master
|
563
|
+
WHERE name='index_tags_on_user_id' AND type='index'
|
564
|
+
|
565
|
+
[1m[36m (0.1ms)[0m [1m SELECT sql
|
566
|
+
FROM sqlite_master
|
567
|
+
WHERE name='index_tires_on_car_id' AND type='index'
|
568
|
+
UNION ALL
|
569
|
+
SELECT sql
|
570
|
+
FROM sqlite_temp_master
|
571
|
+
WHERE name='index_tires_on_car_id' AND type='index'
|
572
|
+
[0m
|
573
|
+
[1m[35m (0.1ms)[0m SELECT sql
|
574
|
+
FROM sqlite_master
|
575
|
+
WHERE name='index_tires_on_user_id' AND type='index'
|
576
|
+
UNION ALL
|
577
|
+
SELECT sql
|
578
|
+
FROM sqlite_temp_master
|
579
|
+
WHERE name='index_tires_on_user_id' AND type='index'
|
580
|
+
|