mas-rad_core 0.0.60 → 0.0.61

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8c848c4e80e9e9c23c009a2c43a24d04704c911f
4
- data.tar.gz: b2d1870a392138be36a21c4aab5640b550b54be4
3
+ metadata.gz: 8ca006299036997a202393ee44a6c6e4c78e232e
4
+ data.tar.gz: abf066c47d2ea4411bcf577bb8eb84189e0e2eba
5
5
  SHA512:
6
- metadata.gz: 481f349b9b1b7f77144b20786ebbfa850984610a41a75ffe77b70e20a36b71980c8a29c0c72457e4dd4fdf012d568a6cd3cb82b6ed66740ac8e402e262bb6dd8
7
- data.tar.gz: 4cc15d8cd56f2097c6c05c3fbcbe80123b5fa49227909f02e898cd5f338cb45efa170e840d95db20fa8f2a9ae8523db579b8d576bbc295787e305a917787112d
6
+ metadata.gz: 2e206effbc6f76e6c0aa7ec2926c96214b535d4ab959039fd81bc671f9a83dd1e1896a4dccc553e468199c10c6d1969f013c2dbdd230e0ed82f1686204271ef3
7
+ data.tar.gz: ebaffaf0789f6615017a39a0e0c6a84228c92d50a6e3b173772b4d78fbcb01c033111acf7e3fb7684c48a138f6764d12f16afbc0b24c3763cc99a2b3db2351c9
data/app/models/firm.rb CHANGED
@@ -1,14 +1,14 @@
1
1
  class Firm < ActiveRecord::Base
2
2
  include Geocodable
3
3
 
4
- PERCENTAGE_ATTRIBUTES = [
5
- :retirement_income_products_percent,
6
- :pension_transfer_percent,
7
- :long_term_care_percent,
8
- :equity_release_percent,
9
- :inheritance_tax_and_estate_planning_percent,
10
- :wills_and_probate_percent,
11
- :other_percent
4
+ BUSINESS_OFFERING_ATTRIBUTES = [
5
+ :retirement_income_products_flag,
6
+ :pension_transfer_flag,
7
+ :long_term_care_flag,
8
+ :equity_release_flag,
9
+ :inheritance_tax_and_estate_planning_flag,
10
+ :wills_and_probate_flag,
11
+ :other_flag
12
12
  ]
13
13
 
14
14
  scope :registered, -> { where.not(email_address: nil) }
@@ -80,11 +80,8 @@ class Firm < ActiveRecord::Base
80
80
  allow_blank: true,
81
81
  numericality: { only_integer: true }
82
82
 
83
- validate :sum_of_percentages_equals_one_hundred
84
-
85
- validates *PERCENTAGE_ATTRIBUTES,
86
- presence: true,
87
- numericality: { only_integer: true }
83
+ validates *BUSINESS_OFFERING_ATTRIBUTES,
84
+ inclusion: { in: [true, false] }
88
85
 
89
86
  validates :investment_sizes,
90
87
  length: { minimum: 1 }
@@ -130,7 +127,7 @@ class Firm < ActiveRecord::Base
130
127
  :allowed_payment_methods,
131
128
  :minimum_fixed_fee,
132
129
  :percent_total,
133
- *PERCENTAGE_ATTRIBUTES,
130
+ *BUSINESS_OFFERING_ATTRIBUTES,
134
131
  :investment_sizes
135
132
  ]
136
133
  end
@@ -149,15 +146,4 @@ class Firm < ActiveRecord::Base
149
146
  def upcase_postcode
150
147
  address_postcode.upcase! if address_postcode.present?
151
148
  end
152
-
153
- def sum_of_percentages_equals_one_hundred
154
- total = PERCENTAGE_ATTRIBUTES.sum { |a| read_attribute(a).to_i }
155
-
156
- unless total == 100
157
- errors.add(
158
- :percent_total,
159
- I18n.t('questionnaire.retirement_advice.percent_total.not_one_hundred')
160
- )
161
- end
162
- end
163
149
  end
@@ -49,27 +49,27 @@ class FirmSerializer < ActiveModel::Serializer
49
49
  end
50
50
 
51
51
  def retirement_income_products
52
- object.retirement_income_products_percent
52
+ boolean_to_percentage object.retirement_income_products_flag
53
53
  end
54
54
 
55
55
  def pension_transfer
56
- object.pension_transfer_percent
56
+ boolean_to_percentage object.pension_transfer_flag
57
57
  end
58
58
 
59
59
  def options_when_paying_for_care
60
- object.long_term_care_percent
60
+ boolean_to_percentage object.long_term_care_flag
61
61
  end
62
62
 
63
63
  def equity_release
64
- object.equity_release_percent
64
+ boolean_to_percentage object.equity_release_flag
65
65
  end
66
66
 
67
67
  def inheritance_tax_planning
68
- object.inheritance_tax_and_estate_planning_percent
68
+ boolean_to_percentage object.inheritance_tax_and_estate_planning_flag
69
69
  end
70
70
 
71
71
  def wills_and_probate
72
- object.wills_and_probate_percent
72
+ boolean_to_percentage object.wills_and_probate_flag
73
73
  end
74
74
 
75
75
  def _id
@@ -87,4 +87,10 @@ class FirmSerializer < ActiveModel::Serializer
87
87
  def investment_sizes
88
88
  object.investment_size_ids
89
89
  end
90
+
91
+ private
92
+
93
+ def boolean_to_percentage(boolean)
94
+ boolean ? 100 : 0
95
+ end
90
96
  end
@@ -0,0 +1,35 @@
1
+ class ChangePercentageFieldsToBooleanFieldsOnFirm < ActiveRecord::Migration
2
+ BUSINESS_OFFERING_ATTRIBUTE = [
3
+ :retirement_income_products,
4
+ :pension_transfer,
5
+ :long_term_care,
6
+ :equity_release,
7
+ :inheritance_tax_and_estate_planning,
8
+ :wills_and_probate,
9
+ :other]
10
+
11
+ def up
12
+ BUSINESS_OFFERING_ATTRIBUTE.each do |field|
13
+ # We add the boolean column
14
+ add_column :firms, "#{field}_flag".to_sym, :boolean, null: false, default: false
15
+ # Translate the old percentage values to the new boolean column
16
+ Firm.where("#{field}_percent > ?", 0).update_all("#{field}_flag" => true)
17
+ # And finally, remove the percentage column
18
+ remove_column :firms, "#{field}_percent".to_sym, :integer
19
+ end
20
+ end
21
+
22
+ def down
23
+ BUSINESS_OFFERING_ATTRIBUTE.each do |field|
24
+ # As above, but in reverse.
25
+ # Since we've lost information, we can only migrate back by figuring
26
+ # true => 100%
27
+ # false => 0%
28
+ # Which won't validate since the fields won't add up to 100%, but it
29
+ # will work in a pinch.
30
+ add_column :firms, "#{field}_percent".to_sym, :integer
31
+ Firm.where("#{field}_flag" => true).update_all("#{field}_percent" => 100)
32
+ remove_column :firms, "#{field}_flag".to_sym, :boolean, null: false, default: false
33
+ end
34
+ end
35
+ end
@@ -1,5 +1,5 @@
1
1
  module MAS
2
2
  module RadCore
3
- VERSION = '0.0.60'
3
+ VERSION = '0.0.61'
4
4
  end
5
5
  end
@@ -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: 20150423154732) do
14
+ ActiveRecord::Schema.define(version: 20150630143001) do
15
15
 
16
16
  # These are extensions that must be enabled in order to support this database
17
17
  enable_extension "plpgsql"
@@ -79,12 +79,12 @@ ActiveRecord::Schema.define(version: 20150423154732) do
79
79
  add_index "allowed_payment_methods_firms", ["firm_id", "allowed_payment_method_id"], name: "firms_allowed_payment_methods_index", unique: true, using: :btree
80
80
 
81
81
  create_table "firms", force: :cascade do |t|
82
- t.integer "fca_number", null: false
83
- t.string "registered_name", null: false
82
+ t.integer "fca_number", null: false
83
+ t.string "registered_name", null: false
84
84
  t.string "email_address"
85
85
  t.string "telephone_number"
86
- t.datetime "created_at", null: false
87
- t.datetime "updated_at", null: false
86
+ t.datetime "created_at", null: false
87
+ t.datetime "updated_at", null: false
88
88
  t.string "address_line_one"
89
89
  t.string "address_line_two"
90
90
  t.string "address_town"
@@ -93,16 +93,16 @@ ActiveRecord::Schema.define(version: 20150423154732) do
93
93
  t.boolean "free_initial_meeting"
94
94
  t.integer "initial_meeting_duration_id"
95
95
  t.integer "minimum_fixed_fee"
96
- t.integer "retirement_income_products_percent"
97
- t.integer "pension_transfer_percent"
98
- t.integer "long_term_care_percent"
99
- t.integer "equity_release_percent"
100
- t.integer "inheritance_tax_and_estate_planning_percent"
101
- t.integer "wills_and_probate_percent"
102
- t.integer "other_percent"
103
96
  t.integer "parent_id"
104
97
  t.float "latitude"
105
98
  t.float "longitude"
99
+ t.boolean "retirement_income_products_flag", default: false, null: false
100
+ t.boolean "pension_transfer_flag", default: false, null: false
101
+ t.boolean "long_term_care_flag", default: false, null: false
102
+ t.boolean "equity_release_flag", default: false, null: false
103
+ t.boolean "inheritance_tax_and_estate_planning_flag", default: false, null: false
104
+ t.boolean "wills_and_probate_flag", default: false, null: false
105
+ t.boolean "other_flag", default: false, null: false
106
106
  end
107
107
 
108
108
  add_index "firms", ["initial_meeting_duration_id"], name: "index_firms_on_initial_meeting_duration_id", using: :btree
@@ -75068,3 +75068,378 @@ ORDER BY c.conname
75068
75068
  Firm Load (2.1ms) SELECT "firms".* FROM "firms" WHERE "firms"."parent_id" = $1 [["parent_id", 153]]
75069
75069
  Principal Load (1.7ms) SELECT "principals".* FROM "principals" WHERE "principals"."fca_number" = $1 LIMIT 1 [["fca_number", 186419]]
75070
75070
  Lookup::Firm Load (0.4ms) SELECT "lookup_firms".* FROM "lookup_firms" WHERE "lookup_firms"."fca_number" = $1 LIMIT 1 [["fca_number", 186419]]
75071
+ ActiveRecord::SchemaMigration Load (2.2ms) SELECT "schema_migrations".* FROM "schema_migrations"
75072
+ Migrating to ChangePercentageFieldsToBooleanFieldsOnFirm (20150630143001)
75073
+  (0.2ms) BEGIN
75074
+  (46.2ms) ALTER TABLE "firms" ADD "retirement_income_products_flag" boolean DEFAULT 'f' NOT NULL
75075
+ SQL (45.8ms) UPDATE "firms" SET "retirement_income_products_flag" = 't' WHERE (retirement_income_products_percent > 0)
75076
+  (1.5ms) ALTER TABLE "firms" DROP "retirement_income_products_percent"
75077
+  (21.5ms) ALTER TABLE "firms" ADD "pension_transfer_flag" boolean DEFAULT 'f' NOT NULL
75078
+ SQL (29.2ms) UPDATE "firms" SET "pension_transfer_flag" = 't' WHERE (pension_transfer_percent > 0)
75079
+  (0.5ms) ALTER TABLE "firms" DROP "pension_transfer_percent"
75080
+  (22.7ms) ALTER TABLE "firms" ADD "long_term_care_flag" boolean DEFAULT 'f' NOT NULL
75081
+ SQL (29.0ms) UPDATE "firms" SET "long_term_care_flag" = 't' WHERE (long_term_care_percent > 0)
75082
+  (0.5ms) ALTER TABLE "firms" DROP "long_term_care_percent"
75083
+  (23.5ms) ALTER TABLE "firms" ADD "equity_release_flag" boolean DEFAULT 'f' NOT NULL
75084
+ SQL (39.1ms) UPDATE "firms" SET "equity_release_flag" = 't' WHERE (equity_release_percent > 0)
75085
+  (0.5ms) ALTER TABLE "firms" DROP "equity_release_percent"
75086
+  (21.5ms) ALTER TABLE "firms" ADD "inheritance_tax_and_estate_planning_flag" boolean DEFAULT 'f' NOT NULL
75087
+ SQL (67.4ms) UPDATE "firms" SET "inheritance_tax_and_estate_planning_flag" = 't' WHERE (inheritance_tax_and_estate_planning_percent > 0)
75088
+  (0.6ms) ALTER TABLE "firms" DROP "inheritance_tax_and_estate_planning_percent"
75089
+  (24.7ms) ALTER TABLE "firms" ADD "wills_and_probate_flag" boolean DEFAULT 'f' NOT NULL
75090
+ SQL (37.8ms) UPDATE "firms" SET "wills_and_probate_flag" = 't' WHERE (wills_and_probate_percent > 0)
75091
+  (0.7ms) ALTER TABLE "firms" DROP "wills_and_probate_percent"
75092
+  (24.9ms) ALTER TABLE "firms" ADD "other_flag" boolean DEFAULT 'f' NOT NULL
75093
+ SQL (62.5ms) UPDATE "firms" SET "other_flag" = 't' WHERE (other_percent > 0)
75094
+  (0.9ms) ALTER TABLE "firms" DROP "other_percent"
75095
+ SQL (1.2ms) INSERT INTO "schema_migrations" ("version") VALUES ($1) [["version", "20150630143001"]]
75096
+  (12.9ms) COMMIT
75097
+ ActiveRecord::SchemaMigration Load (0.3ms) SELECT "schema_migrations".* FROM "schema_migrations"
75098
+  (5.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
75099
+ FROM pg_constraint c
75100
+ JOIN pg_class t1 ON c.conrelid = t1.oid
75101
+ JOIN pg_class t2 ON c.confrelid = t2.oid
75102
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
75103
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
75104
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
75105
+ WHERE c.contype = 'f'
75106
+ AND t1.relname = 'accreditations'
75107
+ AND t3.nspname = ANY (current_schemas(false))
75108
+ ORDER BY c.conname
75109
+ 
75110
+  (4.5ms) 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
75111
+ FROM pg_constraint c
75112
+ JOIN pg_class t1 ON c.conrelid = t1.oid
75113
+ JOIN pg_class t2 ON c.confrelid = t2.oid
75114
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
75115
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
75116
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
75117
+ WHERE c.contype = 'f'
75118
+ AND t1.relname = 'accreditations_advisers'
75119
+ AND t3.nspname = ANY (current_schemas(false))
75120
+ ORDER BY c.conname
75121
+
75122
+  (3.5ms) 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
75123
+ FROM pg_constraint c
75124
+ JOIN pg_class t1 ON c.conrelid = t1.oid
75125
+ JOIN pg_class t2 ON c.confrelid = t2.oid
75126
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
75127
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
75128
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
75129
+ WHERE c.contype = 'f'
75130
+ AND t1.relname = 'advisers'
75131
+ AND t3.nspname = ANY (current_schemas(false))
75132
+ ORDER BY c.conname
75133
+ 
75134
+  (3.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
75135
+ FROM pg_constraint c
75136
+ JOIN pg_class t1 ON c.conrelid = t1.oid
75137
+ JOIN pg_class t2 ON c.confrelid = t2.oid
75138
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
75139
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
75140
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
75141
+ WHERE c.contype = 'f'
75142
+ AND t1.relname = 'advisers_professional_bodies'
75143
+ AND t3.nspname = ANY (current_schemas(false))
75144
+ ORDER BY c.conname
75145
+
75146
+  (4.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
75147
+ FROM pg_constraint c
75148
+ JOIN pg_class t1 ON c.conrelid = t1.oid
75149
+ JOIN pg_class t2 ON c.confrelid = t2.oid
75150
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
75151
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
75152
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
75153
+ WHERE c.contype = 'f'
75154
+ AND t1.relname = 'advisers_professional_standings'
75155
+ AND t3.nspname = ANY (current_schemas(false))
75156
+ ORDER BY c.conname
75157
+ 
75158
+  (3.5ms) 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
75159
+ FROM pg_constraint c
75160
+ JOIN pg_class t1 ON c.conrelid = t1.oid
75161
+ JOIN pg_class t2 ON c.confrelid = t2.oid
75162
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
75163
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
75164
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
75165
+ WHERE c.contype = 'f'
75166
+ AND t1.relname = 'advisers_qualifications'
75167
+ AND t3.nspname = ANY (current_schemas(false))
75168
+ ORDER BY c.conname
75169
+
75170
+  (5.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
75171
+ FROM pg_constraint c
75172
+ JOIN pg_class t1 ON c.conrelid = t1.oid
75173
+ JOIN pg_class t2 ON c.confrelid = t2.oid
75174
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
75175
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
75176
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
75177
+ WHERE c.contype = 'f'
75178
+ AND t1.relname = 'allowed_payment_methods'
75179
+ AND t3.nspname = ANY (current_schemas(false))
75180
+ ORDER BY c.conname
75181
+ 
75182
+  (3.5ms) 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
75183
+ FROM pg_constraint c
75184
+ JOIN pg_class t1 ON c.conrelid = t1.oid
75185
+ JOIN pg_class t2 ON c.confrelid = t2.oid
75186
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
75187
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
75188
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
75189
+ WHERE c.contype = 'f'
75190
+ AND t1.relname = 'allowed_payment_methods_firms'
75191
+ AND t3.nspname = ANY (current_schemas(false))
75192
+ ORDER BY c.conname
75193
+
75194
+  (3.5ms) 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
75195
+ FROM pg_constraint c
75196
+ JOIN pg_class t1 ON c.conrelid = t1.oid
75197
+ JOIN pg_class t2 ON c.confrelid = t2.oid
75198
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
75199
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
75200
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
75201
+ WHERE c.contype = 'f'
75202
+ AND t1.relname = 'firms'
75203
+ AND t3.nspname = ANY (current_schemas(false))
75204
+ ORDER BY c.conname
75205
+ 
75206
+  (3.5ms) 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
75207
+ FROM pg_constraint c
75208
+ JOIN pg_class t1 ON c.conrelid = t1.oid
75209
+ JOIN pg_class t2 ON c.confrelid = t2.oid
75210
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
75211
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
75212
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
75213
+ WHERE c.contype = 'f'
75214
+ AND t1.relname = 'firms_in_person_advice_methods'
75215
+ AND t3.nspname = ANY (current_schemas(false))
75216
+ ORDER BY c.conname
75217
+
75218
+  (3.5ms) 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
75219
+ FROM pg_constraint c
75220
+ JOIN pg_class t1 ON c.conrelid = t1.oid
75221
+ JOIN pg_class t2 ON c.confrelid = t2.oid
75222
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
75223
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
75224
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
75225
+ WHERE c.contype = 'f'
75226
+ AND t1.relname = 'firms_initial_advice_fee_structures'
75227
+ AND t3.nspname = ANY (current_schemas(false))
75228
+ ORDER BY c.conname
75229
+ 
75230
+  (3.5ms) 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
75231
+ FROM pg_constraint c
75232
+ JOIN pg_class t1 ON c.conrelid = t1.oid
75233
+ JOIN pg_class t2 ON c.confrelid = t2.oid
75234
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
75235
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
75236
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
75237
+ WHERE c.contype = 'f'
75238
+ AND t1.relname = 'firms_investment_sizes'
75239
+ AND t3.nspname = ANY (current_schemas(false))
75240
+ ORDER BY c.conname
75241
+
75242
+  (3.6ms) 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
75243
+ FROM pg_constraint c
75244
+ JOIN pg_class t1 ON c.conrelid = t1.oid
75245
+ JOIN pg_class t2 ON c.confrelid = t2.oid
75246
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
75247
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
75248
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
75249
+ WHERE c.contype = 'f'
75250
+ AND t1.relname = 'firms_ongoing_advice_fee_structures'
75251
+ AND t3.nspname = ANY (current_schemas(false))
75252
+ ORDER BY c.conname
75253
+ 
75254
+  (3.5ms) 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
75255
+ FROM pg_constraint c
75256
+ JOIN pg_class t1 ON c.conrelid = t1.oid
75257
+ JOIN pg_class t2 ON c.confrelid = t2.oid
75258
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
75259
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
75260
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
75261
+ WHERE c.contype = 'f'
75262
+ AND t1.relname = 'firms_other_advice_methods'
75263
+ AND t3.nspname = ANY (current_schemas(false))
75264
+ ORDER BY c.conname
75265
+
75266
+  (3.5ms) 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
75267
+ FROM pg_constraint c
75268
+ JOIN pg_class t1 ON c.conrelid = t1.oid
75269
+ JOIN pg_class t2 ON c.confrelid = t2.oid
75270
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
75271
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
75272
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
75273
+ WHERE c.contype = 'f'
75274
+ AND t1.relname = 'in_person_advice_methods'
75275
+ AND t3.nspname = ANY (current_schemas(false))
75276
+ ORDER BY c.conname
75277
+ 
75278
+  (3.5ms) 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
75279
+ FROM pg_constraint c
75280
+ JOIN pg_class t1 ON c.conrelid = t1.oid
75281
+ JOIN pg_class t2 ON c.confrelid = t2.oid
75282
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
75283
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
75284
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
75285
+ WHERE c.contype = 'f'
75286
+ AND t1.relname = 'initial_advice_fee_structures'
75287
+ AND t3.nspname = ANY (current_schemas(false))
75288
+ ORDER BY c.conname
75289
+
75290
+  (3.5ms) 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
75291
+ FROM pg_constraint c
75292
+ JOIN pg_class t1 ON c.conrelid = t1.oid
75293
+ JOIN pg_class t2 ON c.confrelid = t2.oid
75294
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
75295
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
75296
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
75297
+ WHERE c.contype = 'f'
75298
+ AND t1.relname = 'initial_meeting_durations'
75299
+ AND t3.nspname = ANY (current_schemas(false))
75300
+ ORDER BY c.conname
75301
+ 
75302
+  (3.5ms) 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
75303
+ FROM pg_constraint c
75304
+ JOIN pg_class t1 ON c.conrelid = t1.oid
75305
+ JOIN pg_class t2 ON c.confrelid = t2.oid
75306
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
75307
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
75308
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
75309
+ WHERE c.contype = 'f'
75310
+ AND t1.relname = 'investment_sizes'
75311
+ AND t3.nspname = ANY (current_schemas(false))
75312
+ ORDER BY c.conname
75313
+
75314
+  (3.5ms) 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
75315
+ FROM pg_constraint c
75316
+ JOIN pg_class t1 ON c.conrelid = t1.oid
75317
+ JOIN pg_class t2 ON c.confrelid = t2.oid
75318
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
75319
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
75320
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
75321
+ WHERE c.contype = 'f'
75322
+ AND t1.relname = 'lookup_advisers'
75323
+ AND t3.nspname = ANY (current_schemas(false))
75324
+ ORDER BY c.conname
75325
+ 
75326
+  (3.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
75327
+ FROM pg_constraint c
75328
+ JOIN pg_class t1 ON c.conrelid = t1.oid
75329
+ JOIN pg_class t2 ON c.confrelid = t2.oid
75330
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
75331
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
75332
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
75333
+ WHERE c.contype = 'f'
75334
+ AND t1.relname = 'lookup_firms'
75335
+ AND t3.nspname = ANY (current_schemas(false))
75336
+ ORDER BY c.conname
75337
+
75338
+  (3.6ms) 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
75339
+ FROM pg_constraint c
75340
+ JOIN pg_class t1 ON c.conrelid = t1.oid
75341
+ JOIN pg_class t2 ON c.confrelid = t2.oid
75342
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
75343
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
75344
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
75345
+ WHERE c.contype = 'f'
75346
+ AND t1.relname = 'lookup_subsidiaries'
75347
+ AND t3.nspname = ANY (current_schemas(false))
75348
+ ORDER BY c.conname
75349
+ 
75350
+  (3.5ms) 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
75351
+ FROM pg_constraint c
75352
+ JOIN pg_class t1 ON c.conrelid = t1.oid
75353
+ JOIN pg_class t2 ON c.confrelid = t2.oid
75354
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
75355
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
75356
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
75357
+ WHERE c.contype = 'f'
75358
+ AND t1.relname = 'old_passwords'
75359
+ AND t3.nspname = ANY (current_schemas(false))
75360
+ ORDER BY c.conname
75361
+
75362
+  (3.6ms) 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
75363
+ FROM pg_constraint c
75364
+ JOIN pg_class t1 ON c.conrelid = t1.oid
75365
+ JOIN pg_class t2 ON c.confrelid = t2.oid
75366
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
75367
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
75368
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
75369
+ WHERE c.contype = 'f'
75370
+ AND t1.relname = 'ongoing_advice_fee_structures'
75371
+ AND t3.nspname = ANY (current_schemas(false))
75372
+ ORDER BY c.conname
75373
+ 
75374
+  (3.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
75375
+ FROM pg_constraint c
75376
+ JOIN pg_class t1 ON c.conrelid = t1.oid
75377
+ JOIN pg_class t2 ON c.confrelid = t2.oid
75378
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
75379
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
75380
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
75381
+ WHERE c.contype = 'f'
75382
+ AND t1.relname = 'other_advice_methods'
75383
+ AND t3.nspname = ANY (current_schemas(false))
75384
+ ORDER BY c.conname
75385
+
75386
+  (3.7ms) 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
75387
+ FROM pg_constraint c
75388
+ JOIN pg_class t1 ON c.conrelid = t1.oid
75389
+ JOIN pg_class t2 ON c.confrelid = t2.oid
75390
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
75391
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
75392
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
75393
+ WHERE c.contype = 'f'
75394
+ AND t1.relname = 'principals'
75395
+ AND t3.nspname = ANY (current_schemas(false))
75396
+ ORDER BY c.conname
75397
+ 
75398
+  (3.5ms) 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
75399
+ FROM pg_constraint c
75400
+ JOIN pg_class t1 ON c.conrelid = t1.oid
75401
+ JOIN pg_class t2 ON c.confrelid = t2.oid
75402
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
75403
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
75404
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
75405
+ WHERE c.contype = 'f'
75406
+ AND t1.relname = 'professional_bodies'
75407
+ AND t3.nspname = ANY (current_schemas(false))
75408
+ ORDER BY c.conname
75409
+
75410
+  (3.5ms) 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
75411
+ FROM pg_constraint c
75412
+ JOIN pg_class t1 ON c.conrelid = t1.oid
75413
+ JOIN pg_class t2 ON c.confrelid = t2.oid
75414
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
75415
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
75416
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
75417
+ WHERE c.contype = 'f'
75418
+ AND t1.relname = 'professional_standings'
75419
+ AND t3.nspname = ANY (current_schemas(false))
75420
+ ORDER BY c.conname
75421
+ 
75422
+  (3.6ms) 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
75423
+ FROM pg_constraint c
75424
+ JOIN pg_class t1 ON c.conrelid = t1.oid
75425
+ JOIN pg_class t2 ON c.confrelid = t2.oid
75426
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
75427
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
75428
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
75429
+ WHERE c.contype = 'f'
75430
+ AND t1.relname = 'qualifications'
75431
+ AND t3.nspname = ANY (current_schemas(false))
75432
+ ORDER BY c.conname
75433
+
75434
+  (3.6ms) 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
75435
+ FROM pg_constraint c
75436
+ JOIN pg_class t1 ON c.conrelid = t1.oid
75437
+ JOIN pg_class t2 ON c.confrelid = t2.oid
75438
+ JOIN pg_attribute a1 ON a1.attnum = c.conkey[1] AND a1.attrelid = t1.oid
75439
+ JOIN pg_attribute a2 ON a2.attnum = c.confkey[1] AND a2.attrelid = t2.oid
75440
+ JOIN pg_namespace t3 ON c.connamespace = t3.oid
75441
+ WHERE c.contype = 'f'
75442
+ AND t1.relname = 'users'
75443
+ AND t3.nspname = ANY (current_schemas(false))
75444
+ ORDER BY c.conname
75445
+