Add basic storage for validation events

This commit is contained in:
Alex Sherman 2021-06-29 13:47:38 +05:00
parent 6675dac63d
commit d4fe961e34
5 changed files with 123 additions and 0 deletions

View file

@ -0,0 +1,28 @@
class CreateValidationEvents < ActiveRecord::Migration[6.1]
def up
execute <<-SQL
CREATE TYPE validation_type AS ENUM ('email_validation', 'manual_force_delete');
SQL
create_table :validation_events do |t|
t.jsonb :event_data
t.boolean :result
t.references :validation_eventable, polymorphic: true
t.timestamps
end
add_column :validation_events, :event_type, :validation_type
add_index :validation_events, :event_type
end
def down
remove_column :validation_events, :event_type
execute <<-SQL
DROP TYPE validation_type;
SQL
drop_table :validation_events
end
end