Sha256: 5be19ab0ce3f1b8fe4e3ba46699e5d7d9b8d2813f75cc931f668d8ca0c8cc513
Contents?: true
Size: 1.28 KB
Versions: 2
Compression:
Stored size: 1.28 KB
Contents
# frozen_string_literal: true module ChronoModel class Adapter module MigrationsModules module Stable # If adding an index to a temporal table, add it to the one in the # temporal schema and to the history one. If the `:unique` option is # present, it is removed from the index created in the history table. # def add_index(table_name, column_name, **options) return super unless is_chrono?(table_name) transaction do on_temporal_schema { super } # Uniqueness constraints do not make sense in the history table options = options.dup.tap { |o| o.delete(:unique) } if options[:unique].present? on_history_schema { super(table_name, column_name, **options) } end end # If removing an index from a temporal table, remove it both from the # temporal and the history schemas. # def remove_index(table_name, column_name = nil, **options) return super unless is_chrono?(table_name) transaction do on_temporal_schema { super } on_history_schema { super } end end end end end end ChronoModel::Adapter::Migrations.include ChronoModel::Adapter::MigrationsModules::Stable
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
chrono_model-3.0.1 | lib/chrono_model/adapter/migrations_modules/stable.rb |
chrono_model-2.0.0 | lib/chrono_model/adapter/migrations_modules/stable.rb |