1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-01 12:24:28 +01:00
fab-manager/db/migrate/20230112151631_add_places_cache_to_slot.rb

14 lines
614 B
Ruby
Raw Normal View History

2023-01-12 17:48:52 +01:00
# frozen_string_literal: true
# From this migration, we will save the number of reserved places for each slots, for each reservable
# This will improved performance because of computing the number of reserved seats on each request in very resource demanding
#
# The places field is a jsonb object, with the following structure:
# {reservable_type: string, reservable_id: number, reserved_places: number, user_ids: number[]}
class AddPlacesCacheToSlot < ActiveRecord::Migration[5.2]
def change
add_column :slots, :places, :jsonb, null: false, default: []
add_index :slots, :places, using: :gin
end
end