g5_updatable 0.10.3 → 0.20.3.pre.1

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.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +33 -2
  3. data/app/concerns/g5_updatable/belongs_to_client.rb +3 -3
  4. data/app/controllers/g5_updatable/feed_controller.rb +1 -1
  5. data/app/controllers/g5_updatable/locations_controller.rb +2 -2
  6. data/app/controllers/g5_updatable/syncs_controller.rb +3 -3
  7. data/app/models/g5_updatable/client.rb +4 -4
  8. data/app/models/g5_updatable/hub_amenities_location.rb +6 -0
  9. data/app/models/g5_updatable/hub_amenity.rb +21 -0
  10. data/app/models/g5_updatable/location.rb +75 -2
  11. data/app/serializers/g5_updatable/location_serializer.rb +8 -0
  12. data/db/migrate/20151103043916_add_latitude_and_longitude_to_location.rb +6 -0
  13. data/db/migrate/20151103050229_copy_lat_long_props_to_lat_long_columns.rb +19 -0
  14. data/db/migrate/20151106070749_add_latitude_longitude_indexes_to_location.rb +6 -0
  15. data/db/migrate/20161122070749_add_amenities.rb +25 -0
  16. data/db/migrate/20161209070749_add_client_urn_to_locations.rb +6 -0
  17. data/lib/g5_updatable.rb +5 -3
  18. data/lib/g5_updatable/all_client_urns_fetcher.rb +17 -0
  19. data/lib/g5_updatable/client_feed_processor.rb +26 -14
  20. data/lib/g5_updatable/client_updater.rb +37 -12
  21. data/lib/g5_updatable/factories.rb +2 -2
  22. data/lib/g5_updatable/fetcher.rb +22 -0
  23. data/lib/g5_updatable/indifferentizer.rb +11 -0
  24. data/lib/g5_updatable/locations_updater.rb +68 -20
  25. data/lib/g5_updatable/rspec/factories.rb +53 -2
  26. data/lib/g5_updatable/version.rb +1 -1
  27. data/lib/tasks/g5_updatable_tasks.rake +11 -4
  28. data/spec/concerns/g5_updatable/belongs_to_client_spec.rb +1 -3
  29. data/spec/controllers/feed_controller_spec.rb +21 -0
  30. data/spec/controllers/syncs_controller_spec.rb +3 -3
  31. data/spec/dummy/config/database.yml +2 -2
  32. data/spec/dummy/db/schema.rb +28 -1
  33. data/spec/dummy/log/development.log +172 -146
  34. data/spec/dummy/log/test.log +101011 -13426
  35. data/spec/dummy/log/tests.log +0 -0
  36. data/spec/fixtures/client-g5-c-1soj8m6e-g5-multifamily-missing-locations.json +121 -0
  37. data/spec/fixtures/client-g5-c-1soj8m6e-g5-multifamily-no-locations.json +41 -0
  38. data/spec/fixtures/client-g5-c-1soj8m6e-g5-multifamily.json +471 -0
  39. data/spec/fixtures/hub-client.json +187 -0
  40. data/spec/fixtures/hub-clients.json +19972 -0
  41. data/spec/fixtures/hub-location.json +166 -0
  42. data/spec/fixtures/location-g5-cl-1soj9pe2-541-apartments.json +98 -0
  43. data/spec/fixtures/urns.json +10 -0
  44. data/spec/lib/g5_updatable/all_client_urns_fetcher_spec.rb +56 -0
  45. data/spec/lib/g5_updatable/client_feed_processor_spec.rb +86 -33
  46. data/spec/lib/g5_updatable/client_updater_spec.rb +55 -23
  47. data/spec/lib/g5_updatable/locations_updater_spec.rb +140 -54
  48. data/spec/models/g5_updatable/client_spec.rb +2 -0
  49. data/spec/models/g5_updatable/hub_amenities_location_spec.rb +6 -0
  50. data/spec/models/g5_updatable/hub_amenity_spec.rb +29 -0
  51. data/spec/models/g5_updatable/location_spec.rb +240 -10
  52. data/spec/serializers/g5_updatable/location_serializer_spec.rb +2 -1
  53. data/spec/spec_helper.rb +2 -1
  54. data/spec/support/fixture_helper.rb +5 -0
  55. data/spec/support/shared_examples/belongs_to_client.rb +4 -5
  56. metadata +84 -17
@@ -1,19 +1,44 @@
1
1
  class G5Updatable::ClientUpdater
2
- def initialize(g5_client)
3
- @g5_client = g5_client
2
+ include ::G5Updatable::Indifferentizer
3
+ cattr_writer :on_create_callbacks
4
+
5
+ def initialize(client_hash)
6
+ @client_hash = indifferentize_hash(client_hash.dup)
7
+ @location_hashes = @client_hash.delete(:locations)
8
+ end
9
+
10
+ def self.on_create(&block)
11
+ self.on_create_callbacks ||= []
12
+ self.on_create_callbacks += [block]
13
+ end
14
+
15
+ def self.on_create_callbacks
16
+ @@on_create_callbacks || []
4
17
  end
5
18
 
6
19
  def update
7
- attributes = @g5_client.client_hash.dup
8
- attributes.delete(:locations)
20
+ is_new_client = client.new_record?
21
+ update_client
22
+ self.class.on_create_callbacks.each { |cb| cb.call(client) } if is_new_client
23
+ update_locations
24
+ end
25
+
26
+ def update_client
27
+ client.update_attributes!(
28
+ uid: @client_hash[:uid],
29
+ name: @client_hash[:name],
30
+ properties: @client_hash,
31
+ updated_at: Time.now
32
+ )
33
+ end
34
+
35
+ def client
36
+ @client ||= G5Updatable::Client.find_or_initialize_by(urn: @client_hash[:urn])
37
+ end
9
38
 
10
- G5Updatable::Client.
11
- find_or_initialize_by(uid: attributes[:uid]).
12
- update_attributes!(
13
- urn: attributes[:urn],
14
- name: attributes[:name],
15
- properties: attributes,
16
- updated_at: DateTime.now
17
- )
39
+ def update_locations
40
+ G5Updatable::LocationsUpdater.new(@location_hashes,
41
+ client_urn: @client_hash[:urn],
42
+ destroy_orphaned_locations: true).update
18
43
  end
19
44
  end
@@ -10,7 +10,7 @@ FactoryGirl.define do
10
10
  sequence(:urn) { |n| "location_urn_#{n}" }
11
11
  uid { "#{client.urn}/locations/#{urn}" }
12
12
 
13
- sequence(:phone_number) {|n| "123-321-#{n}" }
13
+ sequence(:phone_number) { |n| "123-321-#{n}" }
14
14
  corporate false
15
15
  status "Pending"
16
16
  street_address_1 "123 Test Way"
@@ -172,7 +172,7 @@ FactoryGirl.define do
172
172
  G5Updatable::Location.column_names.include?(key.to_s)
173
173
  attrs[key] = value
174
174
  else
175
- attrs[:properties] ||= {}
175
+ attrs[:properties] ||= {}
176
176
  attrs[:properties][key] = value
177
177
  end
178
178
  end
@@ -0,0 +1,22 @@
1
+ module G5Updatable
2
+ class Fetcher
3
+ extend ::G5AuthenticationClient::AuthTokenHelper
4
+
5
+ def self.get_with_token(url)
6
+ response = do_with_username_pw_access_token do |access_token|
7
+ ::HTTParty.get(url, { query: { access_token: access_token },
8
+ headers: { 'Content-Type' => 'application/json',
9
+ 'Accept' => 'application/json' } })
10
+ end
11
+
12
+ case response.code.to_i
13
+ when 200
14
+ JSON.parse(response.body)
15
+ when 404
16
+ raise "Couldn't find record at URL '#{url}'"
17
+ else
18
+ raise "I got an unexpected response code '#{response.code}'"
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,11 @@
1
+ module G5Updatable
2
+ module Indifferentizer
3
+ def indifferentize_array(array)
4
+ array.collect { |item| indifferentize_hash(item) }
5
+ end
6
+
7
+ def indifferentize_hash(hash)
8
+ ActiveSupport::HashWithIndifferentAccess.new hash
9
+ end
10
+ end
11
+ end
@@ -1,10 +1,20 @@
1
1
  class G5Updatable::LocationsUpdater
2
+ include ::G5Updatable::Indifferentizer
3
+ cattr_writer :on_update_callbacks, :on_create_callbacks
2
4
 
3
- cattr_writer :on_update_callbacks
5
+ def initialize(locations_hash, options={})
6
+ @location_hashes = indifferentize_location_hashes(locations_hash)
7
+ @client_urn = options[:client_urn] || @location_hashes.first.try(:[], :client_urn)
8
+ @destroy_orphaned_locations = options.fetch(:destroy_orphaned_locations, false)
9
+ end
10
+
11
+ def self.on_create(&block)
12
+ self.on_create_callbacks ||= []
13
+ self.on_create_callbacks += [block]
14
+ end
4
15
 
5
- def initialize(foundation_client)
6
- @client_uid = foundation_client.uid
7
- @g5_locations = foundation_client.locations
16
+ def self.on_create_callbacks
17
+ @@on_create_callbacks || []
8
18
  end
9
19
 
10
20
  def self.on_update(&block)
@@ -17,31 +27,69 @@ class G5Updatable::LocationsUpdater
17
27
  end
18
28
 
19
29
  def update
20
- @g5_locations.each do |g5_location|
21
- attributes = g5_location.location_hash.dup
22
- location = G5Updatable::Location.
23
- find_or_initialize_by(uid: attributes[:uid])
30
+ @location_hashes.each do |g5_location|
31
+ create_or_update_location(g5_location)
32
+ end
33
+ destroy_orphaned_locations! if @destroy_orphaned_locations
34
+ end
35
+
36
+ def create_or_update_location(g5_location)
37
+ attributes = g5_location.dup
38
+ location = G5Updatable::Location.find_or_initialize_by(urn: attributes[:urn])
39
+ before_update_object = location.dup
40
+ is_new_loc = location.new_record?
24
41
 
25
- location.update_attributes!(
26
- urn: attributes[:urn],
42
+ amenities = attributes.delete(:amenities)
43
+ location.update_attributes!(
44
+ uid: attributes[:uid],
27
45
  name: attributes[:name],
28
46
  client_uid: attributes[:client_uid],
47
+ latitude: attributes[:latitude],
48
+ longitude: attributes[:longitude],
29
49
  properties: attributes,
30
- updated_at: DateTime.now
31
- )
32
- self.class.on_update_callbacks.each { |cb| cb.call(location) }
50
+ updated_at: Time.now
51
+ )
52
+ create_amenities(amenities, location)
53
+ self.class.on_create_callbacks.each { |cb| cb.call(location) } if is_new_loc
54
+ self.class.on_update_callbacks.each { |cb| cb.call(location, before_update_object) }
55
+ end
56
+
57
+ def create_amenities(amenities_hashes, location)
58
+ location.hub_amenities_locations.delete_all
59
+
60
+ amenities_hashes.each do |amenity_hash|
61
+ location.hub_amenities << create_or_update_amenity(amenity_hash)
62
+ end
63
+ location.refresh_flat_amenity_names!
64
+ end
65
+
66
+ def create_or_update_amenity(amenity_hash)
67
+ amenity = G5Updatable::HubAmenity.where(external_id: amenity_hash[:id]).first_or_create
68
+ if amenity.name != amenity_hash[:name] || amenity.icon != amenity_hash[:icon]
69
+ amenity.update_attributes(name: amenity_hash[:name],
70
+ icon: amenity_hash[:icon],
71
+ external_updated_at: amenity_hash[:updated_at],
72
+ external_created_at: amenity_hash[:created_at])
33
73
  end
34
- destroy_orphaned_locations!
74
+ amenity
35
75
  end
36
76
 
37
77
  private
38
78
 
79
+ def indifferentize_location_hashes(hashes)
80
+ [hashes].flatten.compact.collect do |loc_hash|
81
+ indif = indifferentize_hash(loc_hash)
82
+ indif[:amenities] = indifferentize_array(indif[:amenities]) if indif[:amenities].present?
83
+ indif
84
+ end
85
+ end
86
+
39
87
  def destroy_orphaned_locations!
40
- if @g5_locations.empty?
41
- G5Updatable::Location.by_client_uid(@client_uid)
42
- else
43
- G5Updatable::Location.where.not(urn: @g5_locations.map(&:urn))
44
- .where(client_uid: @client_uid)
88
+ if @location_hashes.empty?
89
+ G5Updatable::Location.by_client_urn(@client_urn)
90
+ else
91
+ valid_location_urns = @location_hashes.collect { |lh| lh[:urn] }
92
+ G5Updatable::Location.where.not(urn: valid_location_urns).by_client_urn(@client_urn)
45
93
  end.destroy_all
46
- end
94
+ end
47
95
  end
@@ -4,13 +4,64 @@ FactoryGirl.define do
4
4
  urn "g5-cl-1234-location"
5
5
  client_uid "http://example.com/clients/g5-c-1234-client"
6
6
  name 'test location'
7
- properties { { domain: "http://myloc.com" } }
7
+ properties { {domain: "http://myloc.com"} }
8
8
  end
9
9
 
10
10
  factory :client, class: G5Updatable::Client do
11
11
  uid "http://example.com/clients/g5-c-1234-client"
12
12
  urn "g5-c-1234-client"
13
13
  name 'test client'
14
- properties { { city: "Test Client" } }
14
+ properties { {city: "Test Client"} }
15
+ end
16
+
17
+ factory :incrementing_location, parent: :location do
18
+ association :client, factory: :incrementing_client
19
+ sequence(:urn) { |n| "g5-cl-#{n}-location" }
20
+ uid { "http://example.com/clients/#{client.urn}/locations/#{urn}" }
21
+ client_uid { client.uid }
22
+ end
23
+
24
+ factory :incrementing_client, parent: :client do
25
+ sequence(:urn) { |n| "g5-c-#{n}-client" }
26
+ uid { "http://example.com/clients/#{urn}" }
27
+ end
28
+
29
+ factory :g5mf_client, parent: :client do
30
+ uid 'https://g5-hub.herokuapp.com/clients/g5-c-1soj8z7v-g5-mf'
31
+ urn 'g5-c-1soj8z7v-g5-mf'
32
+ end
33
+
34
+ factory :g5mf_location, parent: :location do
35
+ uid 'https://g5-hub.herokuapp.com/clients/g5-c-1soj8z7v-g5-selfstorage/locations/g5-cl-loc'
36
+ urn 'g5-cl-loc'
37
+ properties { {status: 'Live'} }
38
+ client { G5Updatable::Client.find_by_urn('g5-c-1soj8z7v-g5-mf') || create(:g5mf_client) }
39
+ name { 'g5 multi family' }
40
+ trait :all_properties do
41
+ latitude { 20.915166 }
42
+ longitude { -156.379291 }
43
+ properties { {street_address_1: '71 Baldwin Ave',
44
+ city: 'paia',
45
+ state: 'HI',
46
+ state_name: 'Hawaii',
47
+ postal_code: '96779',
48
+ country: 'US',
49
+ phone_number: '8884443332',
50
+ email: 'email@example.com',
51
+ home_page_url: 'homey.com',
52
+ internal_branded_name: 'zss1',
53
+ status: 'Live',
54
+ corporate: 'false',
55
+ neighborhood: 'Red Light',
56
+ neighborhood_2: 'Green Light',
57
+ domain: 'adomain'} }
58
+ end
59
+ end
60
+
61
+
62
+ factory :hub_amenity, class: G5Updatable::HubAmenity do
63
+ sequence(:name) { |n| "amenity-#{n}" }
64
+ sequence(:external_id) { |n| n }
65
+ icon 'icon'
15
66
  end
16
67
  end
@@ -1,3 +1,3 @@
1
1
  module G5Updatable
2
- VERSION = "0.10.3"
2
+ VERSION = '0.20.3-1'.freeze
3
3
  end
@@ -1,12 +1,19 @@
1
1
  namespace :g5_updatable do
2
- DEFAULT_G5_HUB_CLIENTS_URL = 'https://g5-hub.herokuapp.com/clients.json'
3
2
 
4
3
  desc 'loads all of g5-hub into local DB. Note: the ENV variables for G5-Auth need to be set!'
4
+
5
5
  task load_all: :environment do
6
- clients_url = ENV['G5_HUB_CLIENTS_URL'] || DEFAULT_G5_HUB_CLIENTS_URL
7
- puts "loading clients from #{clients_url}...."
6
+ puts "loading urns from #{G5Updatable::AllClientUrnsFetcher::url}...."
7
+
8
+ G5Updatable::ClientFeedProcessor.load_all_clients
8
9
 
9
- G5Updatable::ClientFeedProcessor.load_all_clients(clients_url)
10
10
  puts 'Success!!'
11
11
  end
12
+
13
+ desc 'convert locations belongs_to :client to client_urn FK'
14
+ task location_client_urn_conversion: :environment do
15
+ G5Updatable::Location.find_each do |location|
16
+ location.save #location has a before_validation #set_client_urn
17
+ end
18
+ end
12
19
  end
@@ -1,9 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe G5Updatable::BelongsToClient do
4
-
5
- include_examples "belongs to client" do
4
+ include_examples 'belongs to client' do
6
5
  subject { Restaurant.new }
7
6
  end
8
-
9
7
  end
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ describe G5Updatable::FeedController, type: :controller do
4
+ routes { G5Updatable::Engine.routes }
5
+
6
+ context "#update" do
7
+ let(:params) { {foo: "bar"} }
8
+ let(:processor) { double(:processor) }
9
+
10
+ subject do
11
+ post :update, params
12
+ end
13
+
14
+ before do
15
+ expect(G5Updatable::ClientFeedProcessor).to receive(:new).with(hash_including(params)).and_return processor
16
+ expect(processor).to receive :work
17
+ end
18
+
19
+ it { should be_successful }
20
+ end
21
+ end
@@ -6,8 +6,8 @@ describe G5Updatable::SyncsController, type: :controller do
6
6
  describe 'GET index' do
7
7
  let(:client){ create(:client) }
8
8
  let!(:location) { create(:location, client: client) }
9
- let!(:location2) { create(:location, client: client) }
10
- let!(:location3) { create(:location, client: create(:client)) }
9
+ let!(:location2) { create(:location, client: client, urn: 'dif-urn', uid: 'http://hub.com/clients/dd/locations/dif-urn') }
10
+ let!(:location3) { create(:location, client: client, urn: 'dif-urn2', uid: 'http://hub.com/clients/dd/locations/dif-urn2') }
11
11
  let(:expected_result) { location2.updated_at.in_time_zone.strftime("%I:%M%P on %B %e, %Y") }
12
12
  let(:params) { {urn: client.urn } }
13
13
 
@@ -16,7 +16,7 @@ describe G5Updatable::SyncsController, type: :controller do
16
16
  JSON.parse response.body
17
17
  end
18
18
 
19
- its(['updated_at']){ should eq(expected_result) }
19
+ its(['updated_at']){ is_expected.to eq(expected_result) }
20
20
 
21
21
  describe "no client" do
22
22
  let(:params) { {urn: "xxx" } }
@@ -1,11 +1,11 @@
1
1
  development:
2
2
  adapter: postgresql
3
3
  database: g5_updatable_dummy_development
4
- username: g5
4
+ user: g5
5
5
  password: rocks!
6
6
 
7
7
  test:
8
8
  adapter: postgresql
9
9
  database: g5_updatable_dummy_test
10
- username: g5
10
+ user: g5
11
11
  password: rocks!
@@ -11,7 +11,7 @@
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: 20141222072623) do
14
+ ActiveRecord::Schema.define(version: 20161209070749) do
15
15
 
16
16
  # These are extensions that must be enabled in order to support this database
17
17
  enable_extension "plpgsql"
@@ -36,6 +36,26 @@ ActiveRecord::Schema.define(version: 20141222072623) do
36
36
  add_index "g5_updatable_clients", ["uid"], name: "index_g5_updatable_clients_on_uid", using: :btree
37
37
  add_index "g5_updatable_clients", ["urn"], name: "index_g5_updatable_clients_on_urn", using: :btree
38
38
 
39
+ create_table "g5_updatable_hub_amenities", force: :cascade do |t|
40
+ t.integer "external_id"
41
+ t.string "name"
42
+ t.string "icon"
43
+ t.datetime "external_updated_at"
44
+ t.datetime "external_created_at"
45
+ t.datetime "created_at"
46
+ t.datetime "updated_at"
47
+ end
48
+
49
+ add_index "g5_updatable_hub_amenities", ["external_id"], name: "index_g5_updatable_hub_amenities_on_external_id", unique: true, using: :btree
50
+
51
+ create_table "g5_updatable_hub_amenities_locations", force: :cascade do |t|
52
+ t.integer "g5_updatable_hub_amenity_id"
53
+ t.integer "g5_updatable_location_id"
54
+ end
55
+
56
+ add_index "g5_updatable_hub_amenities_locations", ["g5_updatable_hub_amenity_id"], name: "updatable_amenities_loc_amen_id", using: :btree
57
+ add_index "g5_updatable_hub_amenities_locations", ["g5_updatable_location_id"], name: "updatable_amenities_loc_loc_id", using: :btree
58
+
39
59
  create_table "g5_updatable_locations", force: :cascade do |t|
40
60
  t.string "uid"
41
61
  t.string "urn"
@@ -44,8 +64,15 @@ ActiveRecord::Schema.define(version: 20141222072623) do
44
64
  t.datetime "created_at"
45
65
  t.datetime "updated_at"
46
66
  t.string "name"
67
+ t.float "latitude"
68
+ t.float "longitude"
69
+ t.string "flat_amenity_names"
70
+ t.string "client_urn"
47
71
  end
48
72
 
73
+ add_index "g5_updatable_locations", ["client_urn"], name: "index_g5_updatable_locations_on_client_urn", using: :btree
74
+ add_index "g5_updatable_locations", ["latitude"], name: "index_g5_updatable_locations_on_latitude", using: :btree
75
+ add_index "g5_updatable_locations", ["longitude"], name: "index_g5_updatable_locations_on_longitude", using: :btree
49
76
  add_index "g5_updatable_locations", ["name"], name: "index_g5_updatable_locations_on_name", using: :btree
50
77
  add_index "g5_updatable_locations", ["uid"], name: "index_g5_updatable_locations_on_uid", using: :btree
51
78
  add_index "g5_updatable_locations", ["urn"], name: "index_g5_updatable_locations_on_urn", using: :btree
@@ -1,147 +1,6 @@
1
-  (7.4ms) CREATE TABLE "schema_migrations" ("version" character varying(255) NOT NULL) 
2
-  (12.9ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
3
- ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
4
- Migrating to CreateLocations (20140630175259)
5
-  (0.1ms) BEGIN
6
-  (14.8ms) CREATE TABLE "locations" ("id" serial primary key, "uid" character varying(255), "name" character varying(255), "corporate" boolean, "urn" character varying(255), "state" character varying(255), "city" character varying(255), "street_address" character varying(255), "postal_code" character varying(255), "domain" character varying(255), "city_slug" character varying(255), "phone_number" character varying(255), "neighborhood" character varying(255), "primary_amenity" character varying(255), "primary_landmark" character varying(255), "qualifier" character varying(255), "floor_plans" character varying(255), "created_at" timestamp, "updated_at" timestamp) 
7
- SQL (0.3ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20140630175259"]]
8
-  (6.3ms) COMMIT
9
- Migrating to CreateClients (20140630175330)
10
-  (5.6ms) BEGIN
11
-  (12.3ms) CREATE TABLE "clients" ("id" serial primary key, "uid" character varying(255), "name" character varying(255), "vertical" character varying(255), "type" character varying(255), "domain" character varying(255), "created_at" timestamp, "updated_at" timestamp) 
12
- SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20140630175330"]]
13
-  (0.3ms) COMMIT
14
- Migrating to DropClientsAndLocations (20140709220627)
15
-  (0.1ms) BEGIN
16
-  (0.6ms) DROP TABLE "clients"
17
-  (0.4ms) DROP TABLE "locations"
18
- SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20140709220627"]]
19
-  (1.0ms) COMMIT
20
- Migrating to CreateG5UpdatableClientsAndLocations (20140709222005)
21
-  (0.1ms) BEGIN
22
-  (1.7ms) CREATE TABLE "g5_updatable_clients" ("id" serial primary key, "uid" character varying(255), "urn" character varying(255), "properties" json, "created_at" timestamp, "updated_at" timestamp)
23
-  (0.4ms) CREATE INDEX "index_g5_updatable_clients_on_uid" ON "g5_updatable_clients" ("uid")
24
-  (0.5ms) CREATE INDEX "index_g5_updatable_clients_on_urn" ON "g5_updatable_clients" ("urn")
25
-  (1.8ms) CREATE TABLE "g5_updatable_locations" ("id" serial primary key, "uid" character varying(255), "urn" character varying(255), "client_uid" character varying(255), "properties" json, "created_at" timestamp, "updated_at" timestamp) 
26
-  (0.4ms) CREATE INDEX "index_g5_updatable_locations_on_uid" ON "g5_updatable_locations" ("uid")
27
-  (0.4ms) CREATE INDEX "index_g5_updatable_locations_on_urn" ON "g5_updatable_locations" ("urn")
28
- SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20140709222005"]]
29
-  (0.3ms) COMMIT
30
- Migrating to CreateFavoriteFoods (20140714225203)
31
-  (0.3ms) BEGIN
32
-  (2.0ms) CREATE TABLE "favorite_foods" ("id" serial primary key, "name" character varying(255), "location_uid" character varying(255), "created_at" timestamp, "updated_at" timestamp) 
33
- SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20140714225203"]]
34
-  (0.2ms) COMMIT
35
- Migrating to CreateIntegrationSetting (20141030211945)
36
-  (0.2ms) BEGIN
37
-  (2.7ms) CREATE TABLE "g5_updatable_integration_settings" ("id" serial primary key, "uid" character varying(255), "urn" character varying(255), "location_uid" character varying(255), "vendor_action" character varying(255), "job_frequency_in_minutes" integer, "properties" json, "created_at" timestamp, "updated_at" timestamp) 
38
-  (0.8ms) CREATE INDEX "index_g5_updatable_integration_settings_on_urn" ON "g5_updatable_integration_settings" ("urn")
39
-  (0.9ms) CREATE INDEX "index_g5_updatable_integration_settings_on_uid" ON "g5_updatable_integration_settings" ("uid")
40
-  (0.8ms) CREATE INDEX "index_g5_updatable_integration_settings_on_vendor_action" ON "g5_updatable_integration_settings" ("vendor_action")
41
-  (0.6ms) CREATE INDEX "g5_u_is_loc_action" ON "g5_updatable_integration_settings" ("location_uid", "vendor_action")
42
- SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20141030211945"]]
43
-  (0.2ms) COMMIT
44
- Migrating to RemoveIntegrationSetting (20141122211945)
45
-  (0.1ms) BEGIN
46
-  (0.6ms) DROP TABLE "g5_updatable_integration_settings"
47
- SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20141122211945"]]
48
-  (0.8ms) COMMIT
49
- Migrating to AddNameToClientsAndLocations (20141211211945)
50
-  (0.1ms) BEGIN
51
-  (0.3ms) ALTER TABLE "g5_updatable_clients" ADD COLUMN "name" character varying(255)
52
-  (0.8ms) CREATE INDEX "index_g5_updatable_clients_on_name" ON "g5_updatable_clients" ("name")
53
-  (0.2ms) ALTER TABLE "g5_updatable_locations" ADD COLUMN "name" character varying(255)
54
-  (0.8ms) CREATE INDEX "index_g5_updatable_locations_on_name" ON "g5_updatable_locations" ("name")
55
- SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20141211211945"]]
56
-  (0.3ms) COMMIT
57
- Migrating to UpdateNames (20141211711945)
58
-  (0.1ms) BEGIN
59
- G5Updatable::Client Load (0.6ms) SELECT "g5_updatable_clients".* FROM "g5_updatable_clients"
60
- G5Updatable::Location Load (0.4ms) SELECT "g5_updatable_locations".* FROM "g5_updatable_locations"
61
- SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20141211711945"]]
62
-  (0.3ms) COMMIT
63
- Migrating to CreateRestaurants (20141222072623)
64
-  (0.1ms) BEGIN
65
-  (2.0ms) CREATE TABLE "restaurants" ("id" serial primary key, "name" character varying(255), "client_uid" character varying(255), "created_at" timestamp, "updated_at" timestamp) 
66
- SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20141222072623"]]
67
-  (0.2ms) COMMIT
68
- ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
69
-  (7.5ms) CREATE TABLE "schema_migrations" ("version" character varying NOT NULL) 
70
-  (1.3ms) CREATE UNIQUE INDEX "unique_schema_migrations" ON "schema_migrations" ("version")
71
- ActiveRecord::SchemaMigration Load (0.3ms) SELECT "schema_migrations".* FROM "schema_migrations"
72
- Migrating to CreateLocations (20140630175259)
73
-  (0.1ms) BEGIN
74
- DEPRECATION WARNING: `#timestamps` 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 /Users/phertler/Software/g5/g5_updatable/spec/dummy/db/migrate/20140630175259_create_locations.rb:21)
75
-  (5.1ms) CREATE TABLE "locations" ("id" serial primary key, "uid" character varying, "name" character varying, "corporate" boolean, "urn" character varying, "state" character varying, "city" character varying, "street_address" character varying, "postal_code" character varying, "domain" character varying, "city_slug" character varying, "phone_number" character varying, "neighborhood" character varying, "primary_amenity" character varying, "primary_landmark" character varying, "qualifier" character varying, "floor_plans" character varying, "created_at" timestamp, "updated_at" timestamp) 
76
- SQL (0.3ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20140630175259"]]
77
-  (0.3ms) COMMIT
78
- Migrating to CreateClients (20140630175330)
79
-  (0.2ms) BEGIN
80
- DEPRECATION WARNING: `#timestamps` 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 /Users/phertler/Software/g5/g5_updatable/spec/dummy/db/migrate/20140630175330_create_clients.rb:10)
81
-  (3.0ms) CREATE TABLE "clients" ("id" serial primary key, "uid" character varying, "name" character varying, "vertical" character varying, "type" character varying, "domain" character varying, "created_at" timestamp, "updated_at" timestamp) 
82
- SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20140630175330"]]
83
-  (0.3ms) COMMIT
84
- Migrating to DropClientsAndLocations (20140709220627)
85
-  (0.2ms) BEGIN
86
-  (2.2ms) DROP TABLE "clients"
87
-  (1.0ms) DROP TABLE "locations"
88
- SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20140709220627"]]
89
-  (1.6ms) COMMIT
90
- Migrating to CreateG5UpdatableClientsAndLocations (20140709222005)
91
-  (0.2ms) BEGIN
92
- DEPRECATION WARNING: `#timestamps` 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 /Users/phertler/Software/g5/g5_updatable/db/migrate/20140709222005_create_g5_updatable_clients_and_locations.rb:8)
93
-  (2.9ms) CREATE TABLE "g5_updatable_clients" ("id" serial primary key, "uid" character varying, "urn" character varying, "properties" json, "created_at" timestamp, "updated_at" timestamp)
94
-  (0.9ms) CREATE INDEX "index_g5_updatable_clients_on_uid" ON "g5_updatable_clients" ("uid")
95
-  (0.8ms) CREATE INDEX "index_g5_updatable_clients_on_urn" ON "g5_updatable_clients" ("urn")
96
- DEPRECATION WARNING: `#timestamps` 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 /Users/phertler/Software/g5/g5_updatable/db/migrate/20140709222005_create_g5_updatable_clients_and_locations.rb:19)
97
-  (3.0ms) CREATE TABLE "g5_updatable_locations" ("id" serial primary key, "uid" character varying, "urn" character varying, "client_uid" character varying, "properties" json, "created_at" timestamp, "updated_at" timestamp) 
98
-  (0.6ms) CREATE INDEX "index_g5_updatable_locations_on_uid" ON "g5_updatable_locations" ("uid")
99
-  (0.7ms) CREATE INDEX "index_g5_updatable_locations_on_urn" ON "g5_updatable_locations" ("urn")
100
- SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20140709222005"]]
101
-  (0.4ms) COMMIT
102
- Migrating to CreateFavoriteFoods (20140714225203)
103
-  (0.2ms) BEGIN
104
- DEPRECATION WARNING: `#timestamps` 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 /Users/phertler/Software/g5/g5_updatable/spec/dummy/db/migrate/20140714225203_create_favorite_foods.rb:7)
105
-  (4.3ms) CREATE TABLE "favorite_foods" ("id" serial primary key, "name" character varying, "location_uid" character varying, "created_at" timestamp, "updated_at" timestamp) 
106
- SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20140714225203"]]
107
-  (0.3ms) COMMIT
108
- Migrating to CreateIntegrationSetting (20141030211945)
109
-  (0.2ms) BEGIN
110
- DEPRECATION WARNING: `#timestamps` 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 /Users/phertler/Software/g5/g5_updatable/db/migrate/20141030211945_create_integration_setting.rb:10)
111
-  (3.1ms) CREATE TABLE "g5_updatable_integration_settings" ("id" serial primary key, "uid" character varying, "urn" character varying, "location_uid" character varying, "vendor_action" character varying, "job_frequency_in_minutes" integer, "properties" json, "created_at" timestamp, "updated_at" timestamp) 
112
-  (1.1ms) CREATE INDEX "index_g5_updatable_integration_settings_on_urn" ON "g5_updatable_integration_settings" ("urn")
113
-  (0.8ms) CREATE INDEX "index_g5_updatable_integration_settings_on_uid" ON "g5_updatable_integration_settings" ("uid")
114
-  (0.6ms) CREATE INDEX "index_g5_updatable_integration_settings_on_vendor_action" ON "g5_updatable_integration_settings" ("vendor_action")
115
-  (0.8ms) CREATE INDEX "g5_u_is_loc_action" ON "g5_updatable_integration_settings" ("location_uid", "vendor_action")
116
- SQL (0.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20141030211945"]]
117
-  (0.3ms) COMMIT
118
- Migrating to RemoveIntegrationSetting (20141122211945)
119
-  (0.2ms) BEGIN
120
-  (1.4ms) DROP TABLE "g5_updatable_integration_settings"
121
- SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20141122211945"]]
122
-  (0.9ms) COMMIT
123
- Migrating to AddNameToClientsAndLocations (20141211211945)
124
-  (0.1ms) BEGIN
125
-  (0.4ms) ALTER TABLE "g5_updatable_clients" ADD "name" character varying
126
-  (0.9ms) CREATE INDEX "index_g5_updatable_clients_on_name" ON "g5_updatable_clients" ("name")
127
-  (0.3ms) ALTER TABLE "g5_updatable_locations" ADD "name" character varying
128
-  (0.8ms) CREATE INDEX "index_g5_updatable_locations_on_name" ON "g5_updatable_locations" ("name")
129
- SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20141211211945"]]
130
-  (0.2ms) COMMIT
131
- Migrating to UpdateNames (20141211711945)
132
-  (0.1ms) BEGIN
133
- G5Updatable::Client Load (0.5ms) SELECT "g5_updatable_clients".* FROM "g5_updatable_clients"
134
- G5Updatable::Location Load (0.5ms) SELECT "g5_updatable_locations".* FROM "g5_updatable_locations"
135
- SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20141211711945"]]
136
-  (0.3ms) COMMIT
137
- Migrating to CreateRestaurants (20141222072623)
138
-  (0.1ms) BEGIN
139
- DEPRECATION WARNING: `#timestamps` 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 /Users/phertler/Software/g5/g5_updatable/spec/dummy/db/migrate/20141222072623_create_restaurants.rb:6)
140
-  (3.5ms) CREATE TABLE "restaurants" ("id" serial primary key, "name" character varying, "client_uid" character varying, "created_at" timestamp, "updated_at" timestamp) 
141
- SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20141222072623"]]
142
-  (0.2ms) COMMIT
1
+ ActiveRecord::SchemaMigration Load (2.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
143
2
  ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
144
-  (3.2ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
3
+  (2.8ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
145
4
  FROM pg_constraint c
146
5
  JOIN pg_class t1 ON c.conrelid = t1.oid
147
6
  JOIN pg_class t2 ON c.confrelid = t2.oid
@@ -153,7 +12,7 @@ WHERE c.contype = 'f'
153
12
  AND t3.nspname = ANY (current_schemas(false))
154
13
  ORDER BY c.conname
155
14
  
156
-  (2.9ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
15
+  (1.1ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
157
16
  FROM pg_constraint c
158
17
  JOIN pg_class t1 ON c.conrelid = t1.oid
159
18
  JOIN pg_class t2 ON c.confrelid = t2.oid
@@ -165,7 +24,7 @@ WHERE c.contype = 'f'
165
24
  AND t3.nspname = ANY (current_schemas(false))
166
25
  ORDER BY c.conname
167
26
 
168
-  (2.8ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
27
+  (1.1ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
169
28
  FROM pg_constraint c
170
29
  JOIN pg_class t1 ON c.conrelid = t1.oid
171
30
  JOIN pg_class t2 ON c.confrelid = t2.oid
@@ -177,7 +36,92 @@ WHERE c.contype = 'f'
177
36
  AND t3.nspname = ANY (current_schemas(false))
178
37
  ORDER BY c.conname
179
38
  
180
-  (2.8ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
39
+  (1.2ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
40
+ FROM pg_constraint c
41
+ JOIN pg_class t1 ON c.conrelid = t1.oid
42
+ JOIN pg_class t2 ON c.confrelid = t2.oid
43
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
44
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
45
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
46
+ WHERE c.contype = 'f'
47
+ AND t1.relname = 'restaurants'
48
+ AND t3.nspname = ANY (current_schemas(false))
49
+ ORDER BY c.conname
50
+
51
+ ActiveRecord::SchemaMigration Load (7.4ms) SELECT "schema_migrations".* FROM "schema_migrations"
52
+ Migrating to AddAmenities (20161122070749)
53
+  (0.1ms) BEGIN
54
+ DEPRECATION WARNING: `#timestamps` 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 /Users/phertler/Software/g5/g5_updatable/db/migrate/20161122070749_add_amenities.rb:9)
55
+  (99.9ms) CREATE TABLE "g5_updatable_hub_amenities" ("id" serial primary key, "external_id" integer, "name" character varying, "icon" character varying, "external_updated_at" timestamp, "external_created_at" timestamp, "created_at" timestamp, "updated_at" timestamp) 
56
+  (0.7ms) CREATE UNIQUE INDEX "index_g5_updatable_hub_amenities_on_external_id" ON "g5_updatable_hub_amenities" ("external_id")
57
+  (1.2ms) CREATE TABLE "g5_updatable_hub_amenities_locations" ("id" serial primary key, "g5_updatable_hub_amenity_id" integer, "g5_updatable_location_id" integer) 
58
+  (0.6ms) CREATE INDEX "updatable_amenities_loc_amen_id" ON "g5_updatable_hub_amenities_locations" ("g5_updatable_hub_amenity_id")
59
+  (0.5ms) CREATE INDEX "updatable_amenities_loc_loc_id" ON "g5_updatable_hub_amenities_locations" ("g5_updatable_location_id")
60
+  (1.7ms) ALTER TABLE "g5_updatable_locations" ADD "flat_amenity_names" character varying
61
+ SQL (4.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20161122070749"]]
62
+  (12.3ms) COMMIT
63
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
64
+  (3.9ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
65
+ FROM pg_constraint c
66
+ JOIN pg_class t1 ON c.conrelid = t1.oid
67
+ JOIN pg_class t2 ON c.confrelid = t2.oid
68
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
69
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
70
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
71
+ WHERE c.contype = 'f'
72
+ AND t1.relname = 'favorite_foods'
73
+ AND t3.nspname = ANY (current_schemas(false))
74
+ ORDER BY c.conname
75
+
76
+  (1.1ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
77
+ FROM pg_constraint c
78
+ JOIN pg_class t1 ON c.conrelid = t1.oid
79
+ JOIN pg_class t2 ON c.confrelid = t2.oid
80
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
81
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
82
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
83
+ WHERE c.contype = 'f'
84
+ AND t1.relname = 'g5_updatable_clients'
85
+ AND t3.nspname = ANY (current_schemas(false))
86
+ ORDER BY c.conname
87
+ 
88
+  (1.0ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
89
+ FROM pg_constraint c
90
+ JOIN pg_class t1 ON c.conrelid = t1.oid
91
+ JOIN pg_class t2 ON c.confrelid = t2.oid
92
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
93
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
94
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
95
+ WHERE c.contype = 'f'
96
+ AND t1.relname = 'g5_updatable_hub_amenities'
97
+ AND t3.nspname = ANY (current_schemas(false))
98
+ ORDER BY c.conname
99
+
100
+  (1.0ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
101
+ FROM pg_constraint c
102
+ JOIN pg_class t1 ON c.conrelid = t1.oid
103
+ JOIN pg_class t2 ON c.confrelid = t2.oid
104
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
105
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
106
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
107
+ WHERE c.contype = 'f'
108
+ AND t1.relname = 'g5_updatable_hub_amenities_locations'
109
+ AND t3.nspname = ANY (current_schemas(false))
110
+ ORDER BY c.conname
111
+ 
112
+  (1.0ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
113
+ FROM pg_constraint c
114
+ JOIN pg_class t1 ON c.conrelid = t1.oid
115
+ JOIN pg_class t2 ON c.confrelid = t2.oid
116
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
117
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
118
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
119
+ WHERE c.contype = 'f'
120
+ AND t1.relname = 'g5_updatable_locations'
121
+ AND t3.nspname = ANY (current_schemas(false))
122
+ ORDER BY c.conname
123
+
124
+  (1.0ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
181
125
  FROM pg_constraint c
182
126
  JOIN pg_class t1 ON c.conrelid = t1.oid
183
127
  JOIN pg_class t2 ON c.confrelid = t2.oid
@@ -188,4 +132,86 @@ WHERE c.contype = 'f'
188
132
  AND t1.relname = 'restaurants'
189
133
  AND t3.nspname = ANY (current_schemas(false))
190
134
  ORDER BY c.conname
135
+ 
136
+ ActiveRecord::SchemaMigration Load (0.3ms) SELECT "schema_migrations".* FROM "schema_migrations"
137
+ Migrating to AddClientUrnToLocations (20161209070749)
138
+ ActiveRecord::SchemaMigration Load (0.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
139
+ Migrating to AddClientUrnToLocations (20161209070749)
140
+  (0.1ms) BEGIN
141
+  (0.5ms) ALTER TABLE "g5_updatable_locations" ADD "client_urn" character varying
142
+  (16.5ms) CREATE INDEX "index_g5_updatable_locations_on_client_urn" ON "g5_updatable_locations" ("client_urn")
143
+ SQL (0.1ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20161209070749"]]
144
+  (6.2ms) COMMIT
145
+ ActiveRecord::SchemaMigration Load (0.1ms) SELECT "schema_migrations".* FROM "schema_migrations"
146
+  (1.4ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
147
+ FROM pg_constraint c
148
+ JOIN pg_class t1 ON c.conrelid = t1.oid
149
+ JOIN pg_class t2 ON c.confrelid = t2.oid
150
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
151
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
152
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
153
+ WHERE c.contype = 'f'
154
+ AND t1.relname = 'favorite_foods'
155
+ AND t3.nspname = ANY (current_schemas(false))
156
+ ORDER BY c.conname
157
+
158
+  (1.0ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
159
+ FROM pg_constraint c
160
+ JOIN pg_class t1 ON c.conrelid = t1.oid
161
+ JOIN pg_class t2 ON c.confrelid = t2.oid
162
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
163
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
164
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
165
+ WHERE c.contype = 'f'
166
+ AND t1.relname = 'g5_updatable_clients'
167
+ AND t3.nspname = ANY (current_schemas(false))
168
+ ORDER BY c.conname
169
+ 
170
+  (1.0ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
171
+ FROM pg_constraint c
172
+ JOIN pg_class t1 ON c.conrelid = t1.oid
173
+ JOIN pg_class t2 ON c.confrelid = t2.oid
174
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
175
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
176
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
177
+ WHERE c.contype = 'f'
178
+ AND t1.relname = 'g5_updatable_hub_amenities'
179
+ AND t3.nspname = ANY (current_schemas(false))
180
+ ORDER BY c.conname
181
+
182
+  (1.3ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
183
+ FROM pg_constraint c
184
+ JOIN pg_class t1 ON c.conrelid = t1.oid
185
+ JOIN pg_class t2 ON c.confrelid = t2.oid
186
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
187
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
188
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
189
+ WHERE c.contype = 'f'
190
+ AND t1.relname = 'g5_updatable_hub_amenities_locations'
191
+ AND t3.nspname = ANY (current_schemas(false))
192
+ ORDER BY c.conname
193
+ 
194
+  (1.0ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
195
+ FROM pg_constraint c
196
+ JOIN pg_class t1 ON c.conrelid = t1.oid
197
+ JOIN pg_class t2 ON c.confrelid = t2.oid
198
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
199
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
200
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
201
+ WHERE c.contype = 'f'
202
+ AND t1.relname = 'g5_updatable_locations'
203
+ AND t3.nspname = ANY (current_schemas(false))
204
+ ORDER BY c.conname
191
205
 
206
+  (1.0ms) SELECT t2.oid::regclass::text AS to_table, a1.attname AS column, a2.attname AS primary_key, c.conname AS name, c.confupdtype AS on_update, c.confdeltype AS on_delete
207
+ FROM pg_constraint c
208
+ JOIN pg_class t1 ON c.conrelid = t1.oid
209
+ JOIN pg_class t2 ON c.confrelid = t2.oid
210
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
211
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
212
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
213
+ WHERE c.contype = 'f'
214
+ AND t1.relname = 'restaurants'
215
+ AND t3.nspname = ANY (current_schemas(false))
216
+ ORDER BY c.conname
217
+