Sha256: 3e3fe25727688f23a3d856512d4c59029a5538f74d1efb6cf5bd1be4e6476145

Contents?: true

Size: 448 Bytes

Versions: 12

Compression:

Stored size: 448 Bytes

Contents

class MoveDateToAttendanceSheet < ActiveRecord::Migration[6.0]
  def up
    dates = Ecom::Core::CrewTime.pluck('DISTINCT date(date)')

    return if dates.count.zero?

    attendances = []
    dates.each do |date|
      attendances << Ecom::Core::AttendanceSheet.new(date: date)
    end

    Ecom::Core::AttendanceSheet.transaction do
      attendances.each(&:save)
    end
  end

  def down
    raise ActiveRecord::IrreversibleMigration
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
ecom_core-1.1.19 db/data/20200401064242_move_date_to_attendance_sheet.rb
ecom_core-1.1.18 db/data/20200401064242_move_date_to_attendance_sheet.rb
ecom_core-1.1.17 db/data/20200401064242_move_date_to_attendance_sheet.rb
ecom_core-1.1.16 db/data/20200401064242_move_date_to_attendance_sheet.rb
ecom_core-1.1.15 db/data/20200401064242_move_date_to_attendance_sheet.rb
ecom_core-1.1.14 db/data/20200401064242_move_date_to_attendance_sheet.rb
ecom_core-1.1.13 db/data/20200401064242_move_date_to_attendance_sheet.rb
ecom_core-1.1.12 db/data/20200401064242_move_date_to_attendance_sheet.rb
ecom_core-1.1.11 db/data/20200401064242_move_date_to_attendance_sheet.rb
ecom_core-1.1.10 db/data/20200401064242_move_date_to_attendance_sheet.rb
ecom_core-1.1.9 db/data/20200401064242_move_date_to_attendance_sheet.rb
ecom_core-1.1.8 db/data/20200401064242_move_date_to_attendance_sheet.rb