Skip to content

Commit

Permalink
Bug Fix:Update Remove Draft Articles Scripts to not use Squish (#11445)
Browse files Browse the repository at this point in the history
  • Loading branch information
mstruve authored Nov 16, 2020
1 parent ad33d73 commit 048fbe3
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,9 @@ Rails/SkipsModelValidations:
Reference: 'https://guides.rubyonrails.org/active_record_validations.html#skipping-validations'
Enabled: false

Rails/SquishedSQLHeredocs:
Enabled: false

Rails/WhereExists:
Description: 'Prefer `exists?(...)` over `where(...).exists?`.'
Enabled: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def run
# This statement deletes all draft articles in excess found to be duplicate over canonical_url,
# excluding those whose body_markdown is different from the other duplicate occurrences
result = ActiveRecord::Base.connection.execute(
<<~SQL.squish,
<<-SQL,
WITH duplicates_draft_articles AS
(SELECT id
FROM
Expand Down Expand Up @@ -42,7 +42,7 @@ def run
# with different bodies.
# We thus select the oldest for removal preserving the most recent one
result = ActiveRecord::Base.connection.execute(
<<~SQL.squish,
<<-SQL,
WITH duplicates_draft_articles AS
(SELECT id
FROM
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def run
# This statement deletes all draft articles in excess found to be duplicate over feed_source_url,
# excluding those whose body_markdown is different from the other duplicate occurrences
result_same_body = ActiveRecord::Base.connection.execute(
<<~SQL.squish,
<<-SQL,
WITH duplicates_draft_articles AS
(SELECT id
FROM
Expand All @@ -33,7 +33,7 @@ def run
# with different bodies.
# We thus select the oldest for removal preserving the most recent one
result_different_bodies = ActiveRecord::Base.connection.execute(
<<~SQL.squish,
<<-SQL,
WITH duplicates_draft_articles AS
(SELECT id
FROM
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def run

# This statement deletes all draft articles in excess found to be duplicate over those three columns
ActiveRecord::Base.connection.execute(
<<~SQL.squish,
<<-SQL,
WITH duplicates_draft_articles AS
(SELECT id
FROM
Expand Down

0 comments on commit 048fbe3

Please sign in to comment.