Module: ActiveRecord::IdRegions::Migration
- Defined in:
- lib/active_record/id_regions/migration.rb
Constant Summary collapse
- ALLOWED_ID_VALUES =
[false, :uuid, "uuid"].freeze
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.anonymous_class_with_id_regions ⇒ Object
18 19 20 |
# File 'lib/active_record/id_regions/migration.rb', line 18 def self.anonymous_class_with_id_regions @class_with_id_regions ||= Class.new(ActiveRecord::Base).include(ActiveRecord::IdRegions) end |
Instance Method Details
#anonymous_class_with_id_regions ⇒ Object
14 15 16 |
# File 'lib/active_record/id_regions/migration.rb', line 14 def anonymous_class_with_id_regions ActiveRecord::IdRegions::Migration.anonymous_class_with_id_regions end |
#create_table(table_name, **options) ⇒ Object
5 6 7 8 9 10 11 12 |
# File 'lib/active_record/id_regions/migration.rb', line 5 def create_table(table_name, **) [:id] = :bigserial unless ALLOWED_ID_VALUES.include?([:id]) value = anonymous_class_with_id_regions.rails_sequence_start super return if ALLOWED_ID_VALUES.include?([:id]) set_pk_sequence!(table_name, value) unless value == 0 end |