Skip to content

Commit

Permalink
[VI-1056] Schema changes for UserActionEvent, change event type add n…
Browse files Browse the repository at this point in the history
…ullable/uniqueness constraints (#20866)

Co-authored-by: John Bramley <20125855+bramleyjl@users.noreply.github.com>
  • Loading branch information
bosawt and bramleyjl authored Feb 21, 2025
1 parent de3368e commit 4474d5d
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
class UpdateEventIdAndEventTypeToUserActionEvent < ActiveRecord::Migration[7.2]
def change
safety_assured do
remove_column :user_action_events, :event_type, :integer
add_column :user_action_events, :event_type, :string, null: false
remove_column :user_action_events, :event_id, :string
add_column :user_action_events, :identifier, :string, null: false

add_index :user_action_events, :identifier, unique: true
end
end
end
7 changes: 4 additions & 3 deletions db/schema.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions spec/factories/user_action_events.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
FactoryBot.define do
factory :user_action_event do
details { Faker::Lorem.sentence }
event_type { Faker::Lorem.word }
identifier { Faker::Lorem.word }
end
end

0 comments on commit 4474d5d

Please sign in to comment.