mirror of
https://github.com/SrIzan10/hc-harbor.git
synced 2026-05-01 10:45:21 +00:00
26 lines
657 B
Ruby
26 lines
657 B
Ruby
# frozen_string_literal: true
|
|
|
|
# Migration responsible for creating a table with activities
|
|
class CreateActivities < ActiveRecord::Migration[6.1]
|
|
def self.up
|
|
create_table :activities do |t|
|
|
t.belongs_to :trackable, polymorphic: true
|
|
t.belongs_to :owner, polymorphic: true
|
|
t.string :key
|
|
t.text :parameters
|
|
t.belongs_to :recipient, polymorphic: true
|
|
|
|
t.timestamps
|
|
end
|
|
|
|
add_index :activities, %i[trackable_id trackable_type]
|
|
add_index :activities, %i[owner_id owner_type]
|
|
add_index :activities, %i[recipient_id recipient_type]
|
|
end
|
|
|
|
# Drop table
|
|
def self.down
|
|
drop_table :activities
|
|
end
|
|
end
|