DEV: Enforce dominant_color length in validation (#18309)

The `add_column` `limit` parameter has no effect on a postgres `text` column. Instead we can perform the check in ActiveRecord.

We never expect this condition to be hit - users cannot control this value. It's just a safety net.
This commit is contained in:
David Taylor
2022-09-21 11:01:21 +01:00
committed by GitHub
parent c73ca74585
commit 0f5a8cc526
3 changed files with 19 additions and 1 deletions
@@ -2,7 +2,7 @@
class AddDominantColorToUploads < ActiveRecord::Migration[7.0]
def change
add_column :uploads, :dominant_color, :text, limit: 6, null: true
add_column :uploads, :dominant_color, :text, null: true
add_index :uploads, :id, where: "dominant_color IS NULL"
end
end