Skip to content

Commit 9337b63

Browse files
committed
Add script for importing customers
Can be used to seed the database with all the customers we currently know about: $ rails runner db/data_migrate/20180807095900_import_customers.rb The CSV data was generated using the URNs file we are currently sharing with suppliers. Some of the customers from that file have been excluded: - Customers with "Active" set to "False" as business cannot be reported against these - A handful of "bucket code" URNS that shouldn't be reported against by suppliers (e.g. Education/991100) Note that some customers have been given a postcode of 'XXXX'. I'm assuming this was to get around some limitation in MISO that meant a postcode needs to be set. Rather than carry this over to the new system, the script will ignore these postcodes. Also note that I've updated the rubocop config to exclude the Rails/Output rule for the data migrations, as there is no reason to prevent outputting directly to STDOUT from scripts like this that are expected to be run directly from the terminal.
1 parent 058e8a7 commit 9337b63

5 files changed

Lines changed: 50439 additions & 0 deletions

File tree

.rubocop.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ Rails:
1313
Bundler/OrderedGems:
1414
Enabled: false
1515

16+
Rails/Output:
17+
Exclude:
18+
- 'db/data_migrate/**/*'
19+
1620
Style/Alias:
1721
Enabled: false
1822

Gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ gem 'auth0', require: false
3232

3333
gem 'rubocop'
3434

35+
gem 'progress_bar', require: false
36+
3537
group :development, :test do
3638
gem 'byebug', platforms: %i[mri mingw x64_mingw]
3739
gem 'dotenv-rails'

Gemfile.lock

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ GEM
8989
ffi (1.9.23)
9090
globalid (0.4.1)
9191
activesupport (>= 4.2.0)
92+
highline (1.7.10)
9293
http-cookie (1.0.3)
9394
domain_name (~> 0.5)
9495
i18n (1.0.1)
@@ -134,11 +135,15 @@ GEM
134135
nio4r (2.3.1)
135136
nokogiri (1.8.2)
136137
mini_portile2 (~> 2.3.0)
138+
options (2.3.2)
137139
parallel (1.12.1)
138140
parser (2.5.1.0)
139141
ast (~> 2.4.0)
140142
pg (1.0.0)
141143
powerpack (0.1.1)
144+
progress_bar (1.2.0)
145+
highline (~> 1.6)
146+
options (~> 2.3.0)
142147
pry (0.11.3)
143148
coderay (~> 1.1.0)
144149
method_source (~> 0.9.0)
@@ -274,6 +279,7 @@ DEPENDENCIES
274279
jsonapi-rspec
275280
listen (>= 3.0.5, < 3.2)
276281
pg (>= 0.18, < 2.0)
282+
progress_bar
277283
pry-rails
278284
puma (~> 3.11)
279285
rails (~> 5.2.0)

0 commit comments

Comments
 (0)