Skip to content

Commit 1991bb8

Browse files
committed
Apply Rubocop corrections
1 parent 1734223 commit 1991bb8

13 files changed

Lines changed: 43 additions & 43 deletions

db/migrations/20130329165619_add_unique_id_to_service_plans.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
end
99

1010
if self.class.name.match?(/mysql/i)
11-
run <<-SQL.squish
11+
run <<~SQL.squish
1212
UPDATE service_plans
1313
SET unique_id =
1414
(SELECT CONCAT(services.provider, '_', services.label, '_', service_plans.name)
1515
FROM services
1616
WHERE services.id = service_plans.service_id)
1717
SQL
1818
else
19-
run <<-SQL.squish
19+
run <<~SQL.squish
2020
UPDATE service_plans
2121
SET unique_id =
2222
(SELECT (services.provider || '_' || services.label || '_' || service_plans.name)

db/migrations/20131119225844_move_organization_managers_into_organization.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
Sequel.migration do
22
up do
3-
run <<-SQL.squish
3+
run <<~SQL.squish
44
INSERT INTO organizations_users SELECT * FROM organizations_managers m
55
WHERE NOT EXISTS (SELECT * FROM organizations_users u WHERE u.user_id = m.user_id AND u.organization_id = m.organization_id)
66
SQL
77

8-
run <<-SQL.squish
8+
run <<~SQL.squish
99
INSERT INTO organizations_users SELECT * FROM organizations_billing_managers m
1010
WHERE NOT EXISTS (SELECT * FROM organizations_users u WHERE u.user_id = m.user_id AND u.organization_id = m.organization_id)
1111
SQL
1212

13-
run <<-SQL.squish
13+
run <<~SQL.squish
1414
INSERT INTO organizations_users SELECT * FROM organizations_auditors m
1515
WHERE NOT EXISTS (SELECT * FROM organizations_users u WHERE u.user_id = m.user_id AND u.organization_id = m.organization_id)
1616
SQL

db/migrations/20140306000008_remove_sso_client_id_from_services.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Sequel.migration do
22
up do
3-
run <<-SQL.squish
3+
run <<~SQL.squish
44
INSERT INTO service_dashboard_clients (uaa_id, service_id_on_broker)
55
SELECT sso_client_id, unique_id
66
FROM services
@@ -15,7 +15,7 @@
1515
alter_table :services do
1616
add_column :sso_client_id, String, unique: true
1717
end
18-
run <<-SQL.squish
18+
run <<~SQL.squish
1919
UPDATE services
2020
SET sso_client_id = (
2121
SELECT service_dashboard_clients.uaa_id

db/migrations/20140307201639_replace_service_id_on_broker_with_service_broker_id.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
alter_table :service_dashboard_clients do
44
add_column :service_broker_id, Integer
55
end
6-
run <<-SQL.squish
6+
run <<~SQL.squish
77
UPDATE service_dashboard_clients
88
SET service_broker_id = (
99
SELECT services.service_broker_id

db/migrations/20140325171355_add_service_broker_id_index_to_service_dashboard_clients.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
end
88

99
down do
10-
run <<-SQL.squish
10+
run <<~SQL.squish
1111
DELETE FROM service_dashboard_clients WHERE service_broker_id IS NULL
1212
SQL
1313

db/migrations/20141216183550_add_health_check_type_to_apps.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
up do
33
add_column :apps, :health_check_type, String, default: 'port'
44

5-
run <<-SQL.squish
5+
run <<~SQL.squish
66
UPDATE apps a1
77
SET health_check_type = 'none'
88
WHERE id NOT IN (

db/migrations/20150113201824_fix_created_at_column.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434
up do
3535
if self.class.name.match?(/mysql/i)
3636
table_names.each do |table|
37-
run <<-SQL.squish
38-
ALTER TABLE #{table} MODIFY created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;
37+
run <<~SQL.squish
38+
ALTER TABLE #{table} MODIFY created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP;
3939
SQL
4040
end
4141
end
@@ -44,8 +44,8 @@
4444
down do
4545
if self.class.name.match?(/mysql/i)
4646
table_names.each do |table|
47-
run <<-SQL.squish
48-
ALTER TABLE #{table} MODIFY created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
47+
run <<~SQL.squish
48+
ALTER TABLE #{table} MODIFY created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;
4949
SQL
5050
end
5151
end

db/migrations/20160322184040_update_app_port.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
Sequel.migration do
22
up do
3-
run <<-SQL.squish
3+
run <<~SQL.squish
44
UPDATE apps
55
SET ports = null
66
WHERE docker_image is not null
77
and diego = true
88
and ports = '[8080]'
99
SQL
1010

11-
run <<-SQL.squish
11+
run <<~SQL.squish
1212
UPDATE apps_routes
1313
SET app_port = null
1414
WHERE app_port = '8080'
@@ -19,7 +19,7 @@
1919
end
2020

2121
down do
22-
run <<-SQL.squish
22+
run <<~SQL.squish
2323
UPDATE apps
2424
SET ports = '8080'
2525
WHERE ports is null and diego = true and docker_image is null

db/migrations/20160621182906_remove_space_id_from_events.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Sequel.migration do
22
up do
33
if database_type == :postgres
4-
run <<-SQL.squish
4+
run <<~SQL.squish
55
ALTER TABLE events DROP COLUMN IF EXISTS space_id;
66
SQL
77
elsif dataset.db['select * from information_schema.columns where table_name = \'events\' and column_name = \'space_id\''].any?

db/migrations/20160914165525_migrate_v2_app_data_to_v3.rb

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
####
1616

1717
transaction do
18-
generate_stop_events_query = <<-SQL.squish
18+
generate_stop_events_query = <<~SQL.squish
1919
INSERT INTO app_usage_events
2020
(guid, created_at, instance_count, memory_in_mb_per_instance, state, app_guid, app_name, space_guid, space_name, org_guid, buildpack_guid, buildpack_name, package_state, parent_app_name, parent_app_guid, process_type, task_guid, task_name, package_guid, previous_state, previous_package_state, previous_memory_in_mb_per_instance, previous_instance_count)
2121
SELECT %s, now(), p.instances, p.memory, 'STOPPED', p.guid, p.name, s.guid, s.name, o.guid, d.buildpack_receipt_buildpack_guid, d.buildpack_receipt_buildpack, p.package_state, a.name, a.guid, p.type, NULL, NULL, pkg.guid, 'STARTED', p.package_state, p.memory, p.instances
@@ -174,30 +174,30 @@
174174
####
175175
## Fill in v3 apps table data
176176
###
177-
run <<-SQL.squish
177+
run <<~SQL.squish
178178
INSERT INTO apps (guid, name, salt, encrypted_environment_variables, created_at, updated_at, space_guid, desired_state)
179179
SELECT p.guid, p.name, p.salt, p.encrypted_environment_json, p.created_at, p.updated_at, s.guid, p.state
180180
FROM processes as p, spaces as s
181181
WHERE p.space_id = s.id
182182
ORDER BY p.id
183183
SQL
184184

185-
run <<-SQL.squish
185+
run <<~SQL.squish
186186
UPDATE processes SET app_guid=guid
187187
SQL
188188

189189
#####
190190
## Create lifecycle data for buildpack apps
191191
####
192192

193-
run <<-SQL.squish
193+
run <<~SQL.squish
194194
INSERT INTO buildpack_lifecycle_data (app_guid, stack)
195195
SELECT processes.guid, stacks.name
196196
FROM processes, stacks
197197
WHERE docker_image is NULL AND stacks.id = processes.stack_id
198198
SQL
199199

200-
run <<-SQL.squish
200+
run <<~SQL.squish
201201
UPDATE buildpack_lifecycle_data
202202
SET
203203
admin_buildpack_name=(
@@ -222,14 +222,14 @@
222222
## Fill in packages data
223223
####
224224

225-
run <<-SQL.squish
225+
run <<~SQL.squish
226226
INSERT INTO packages (guid, type, package_hash, state, error, app_guid)
227227
SELECT guid, 'bits', package_hash, 'READY', NULL, guid
228228
FROM processes
229229
WHERE package_hash IS NOT NULL AND docker_image IS NULL
230230
SQL
231231

232-
run <<-SQL.squish
232+
run <<~SQL.squish
233233
INSERT INTO packages (guid, type, state, error, app_guid, docker_image)
234234
SELECT guid, 'docker', 'READY', NULL, guid, docker_image
235235
FROM processes
@@ -242,7 +242,7 @@
242242

243243
# backfill any v2 droplets that do not exist due to lazy backfilling in v2 droplets. it is unlikely there are
244244
# any of these, but possible in very old CF deployments
245-
run <<-SQL.squish
245+
run <<~SQL.squish
246246
INSERT INTO droplets (guid, app_id, droplet_hash, detected_start_command)
247247
SELECT processes.guid, processes.id, processes.droplet_hash, '' AS detected_start_command
248248
FROM processes
@@ -253,19 +253,19 @@
253253
# pruning will not delete from the blobstore
254254

255255
# prune orphaned droplets
256-
run <<-SQL.squish
256+
run <<~SQL.squish
257257
DELETE FROM droplets WHERE NOT EXISTS (SELECT 1 FROM processes WHERE droplets.app_id = processes.id)
258258
SQL
259259

260260
# prune additional droplets, each app will have only one droplet
261-
postgres_prune_droplets_query = <<-SQL.squish
261+
postgres_prune_droplets_query = <<~SQL.squish
262262
DELETE FROM droplets
263263
USING droplets as d
264264
JOIN processes ON processes.id = d.app_id
265265
WHERE droplets.id = d.id AND (processes.droplet_hash <> d.droplet_hash OR processes.droplet_hash IS NULL)
266266
SQL
267267

268-
mysql_prune_droplets_query = <<-SQL.squish
268+
mysql_prune_droplets_query = <<~SQL.squish
269269
DELETE droplets FROM droplets
270270
JOIN processes ON processes.id = droplets.app_id
271271
WHERE processes.droplet_hash <> droplets.droplet_hash OR processes.droplet_hash IS NULL
@@ -274,21 +274,21 @@
274274
if dbtype == 'mysql'
275275
run mysql_prune_droplets_query
276276

277-
run <<-SQL.squish
277+
run <<~SQL.squish
278278
DELETE a FROM droplets a, droplets b
279279
WHERE a.app_id=b.app_id AND a.id < b.id
280280
SQL
281281
elsif dbtype == 'postgres'
282282
run postgres_prune_droplets_query
283283

284-
run <<-SQL.squish
284+
run <<~SQL.squish
285285
DELETE FROM droplets a USING droplets b
286286
WHERE a.app_id = b.app_id AND a.id < b.id
287287
SQL
288288
end
289289

290290
# convert to v3 droplets
291-
postgres_convert_to_v3_droplets_query = <<-SQL.squish
291+
postgres_convert_to_v3_droplets_query = <<~SQL.squish
292292
UPDATE droplets
293293
SET
294294
guid = v2_app.guid,
@@ -304,7 +304,7 @@
304304
WHERE v2_app.id = droplets.app_id
305305
SQL
306306

307-
mysql_convert_to_v3_droplets_query = <<-SQL.squish
307+
mysql_convert_to_v3_droplets_query = <<~SQL.squish
308308
UPDATE droplets
309309
JOIN processes as v2_app
310310
ON v2_app.id = droplets.app_id
@@ -327,22 +327,22 @@
327327
end
328328

329329
# add lifecycle data to buildpack droplets
330-
run <<-SQL.squish
330+
run <<~SQL.squish
331331
INSERT INTO buildpack_lifecycle_data (droplet_guid)
332332
SELECT droplets.guid
333333
FROM processes, droplets
334334
WHERE processes.docker_image is NULL AND droplets.app_guid = processes.guid
335335
SQL
336336

337337
# set current droplet on v3 app
338-
postgres_set_current_droplet_query = <<-SQL.squish
338+
postgres_set_current_droplet_query = <<~SQL.squish
339339
UPDATE apps
340340
SET droplet_guid = droplets.guid
341341
FROM droplets
342342
WHERE droplets.app_guid = apps.guid
343343
SQL
344344

345-
mysql_set_current_droplet_query = <<-SQL.squish
345+
mysql_set_current_droplet_query = <<~SQL.squish
346346
UPDATE apps
347347
JOIN droplets as current_droplet
348348
ON apps.guid = current_droplet.app_guid
@@ -372,14 +372,14 @@
372372
## Migrate route mappings
373373
####
374374

375-
run <<-SQL.squish
375+
run <<~SQL.squish
376376
UPDATE apps_routes SET
377377
app_guid = (SELECT processes.guid FROM processes WHERE processes.id=apps_routes.app_id),
378378
route_guid = (SELECT routes.guid FROM routes WHERE routes.id=apps_routes.route_id),
379379
process_type = 'web'
380380
SQL
381381

382-
run <<-SQL.squish
382+
run <<~SQL.squish
383383
UPDATE apps_routes SET app_port=8080 WHERE app_port IS NULL AND EXISTS (SELECT 1 FROM processes WHERE processes.docker_image IS NULL AND processes.id = apps_routes.app_id)
384384
SQL
385385

@@ -411,7 +411,7 @@
411411
self[:apps_routes].where(id: ids_to_remove).delete
412412
end
413413

414-
run <<-SQL.squish
414+
run <<~SQL.squish
415415
UPDATE service_bindings SET
416416
app_guid = (SELECT processes.guid FROM processes WHERE processes.id=service_bindings.app_id),
417417
service_instance_guid = (SELECT service_instances.guid FROM service_instances WHERE service_instances.id=service_bindings.service_instance_id),

0 commit comments

Comments
 (0)