10 lines
568 B
SQL
10 lines
568 B
SQL
DELETE FROM attachment_variants
|
|
WHERE kind = 'original' OR width < 1 OR height < 1 OR size_bytes < 1;
|
|
|
|
ALTER TABLE attachment_variants DROP CONSTRAINT IF EXISTS attachment_variants_kind_check;
|
|
ALTER TABLE attachment_variants ADD CONSTRAINT attachment_variants_kind_check
|
|
CHECK (kind IN ('thumbnail_256', 'crop_128', 'optimized_webp'));
|
|
|
|
ALTER TABLE attachment_variants DROP CONSTRAINT IF EXISTS attachment_variants_dims_check;
|
|
ALTER TABLE attachment_variants ADD CONSTRAINT attachment_variants_dims_check
|
|
CHECK (width >= 1 AND height >= 1 AND size_bytes >= 1); |