mirror of
https://github.com/internetee/registry.git
synced 2025-07-24 03:30:33 +02:00
Add basic storage for validation events
This commit is contained in:
parent
6675dac63d
commit
d4fe961e34
5 changed files with 123 additions and 0 deletions
28
db/migrate/20210629074044_create_validation_events.rb
Normal file
28
db/migrate/20210629074044_create_validation_events.rb
Normal 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
|
Loading…
Add table
Add a link
Reference in a new issue