Browse Source
* Add location_deactivations table and remove deactivation_date from locations * Add location location_deactivations relationship * Update logs status determination for location * Update affected logs with deactivated location. * lint * Update scheme * Extract location_deactivation factory * Update location availability * lint * Rename deactivations table * fix schema * rebase fixes * fixes * refactorpull/1000/head
kosiakkatrina
2 years ago
committed by
GitHub
15 changed files with 166 additions and 49 deletions
@ -0,0 +1,3 @@
|
||||
class LocationDeactivationPeriod < ApplicationRecord |
||||
scope :deactivations_without_reactivation, -> { where(reactivation_date: nil) } |
||||
end |
@ -0,0 +1,10 @@
|
||||
class AddDeactivationsTable < ActiveRecord::Migration[7.0] |
||||
def change |
||||
create_table :location_deactivation_periods do |t| |
||||
t.datetime :deactivation_date |
||||
t.datetime :reactivation_date |
||||
t.belongs_to :location |
||||
t.timestamps |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,13 @@
|
||||
class RemoveDeactivatioDate < ActiveRecord::Migration[7.0] |
||||
def up |
||||
change_table :locations, bulk: true do |t| |
||||
t.remove :deactivation_date |
||||
end |
||||
end |
||||
|
||||
def down |
||||
change_table :locations, bulk: true do |t| |
||||
t.column :deactivation_date, :datetime |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,5 @@
|
||||
FactoryBot.define do |
||||
factory :location_deactivation_period do |
||||
reactivation_date { nil } |
||||
end |
||||
end |
Loading…
Reference in new issue