Skip to content

Commit

Permalink
Merge pull request #346 from chumaltd/retry-0.9
Browse files Browse the repository at this point in the history
Use Enumerator#size for ADD CONSTRAINT example.
  • Loading branch information
winebarrel committed Jan 31, 2021
2 parents 05130d5 + 037e1f5 commit 6c937e5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ add_index "books", ["author_id"], name: "idx_author_id", using: :btree

execute("ALTER TABLE books ADD CONSTRAINT fk_author FOREIGN KEY (author_id) REFERENCES authors (id)") do |c|
# Execute SQL only if there is no foreign key
c.raw_connection.query(<<-SQL).each.length.zero?
c.raw_connection.query(<<-SQL).each.size.zero?
SELECT 1 FROM information_schema.key_column_usage
WHERE TABLE_SCHEMA = 'bookshelf'
AND CONSTRAINT_NAME = 'fk_author' LIMIT 1
Expand Down

0 comments on commit 6c937e5

Please sign in to comment.