2
0
mirror of https://github.com/moebooru/moebooru synced 2025-08-22 01:47:48 +00:00
moebooru/db/migrate/20250329151230_add_ratio_to_posts.rb
2025-03-30 01:04:00 +09:00

6 lines
193 B
Ruby

class AddRatioToPosts < ActiveRecord::Migration[7.2]
def change
add_column :posts, :ratio, 'numeric GENERATED ALWAYS AS (ROUND(width::numeric / GREATEST(1, height), 3)) STORED'
end
end