-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
68 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,5 +15,5 @@ class Budget < ApplicationRecord | |
|
||
validates :name, :amount, :currency, presence: true | ||
|
||
auditable | ||
audited | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,5 +12,5 @@ class Request < ApplicationRecord | |
|
||
validates :event, presence: true | ||
|
||
auditable | ||
audited | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# frozen_string_literal: true | ||
|
||
class UpdateColumnsInAudits < ActiveRecord::Migration[5.1] | ||
def change | ||
add_column :audits, :remote_address, :string | ||
add_column :audits, :username, :string | ||
add_column :audits, :request_uuid, :string | ||
add_column :audits, :associated_id, :integer | ||
add_column :audits, :associated_type, :string | ||
|
||
change_column_null :audits, :auditable_id, true | ||
change_column_null :audits, :auditable_type, true | ||
change_column_null :audits, :action, true | ||
change_column_null :audits, :created_at, true | ||
|
||
remove_index :audits, name: :auditable_index | ||
|
||
add_index :audits, :request_uuid | ||
add_index :audits, %i[auditable_type auditable_id version], name: :auditable_index | ||
add_index :audits, %i[associated_type associated_id], name: :associated_index | ||
|
||
remove_column :audits, :owner_id, :integer | ||
remove_column :audits, :owner_type, :string | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# frozen_string_literal: true | ||
|
||
class MergeAuditTables < ActiveRecord::Migration[5.1] | ||
def self.up | ||
execute 'INSERT INTO audits(auditable_id, auditable_type, user_id, user_type, action, audited_changes, version, comment, remote_address, created_at) ' \ | ||
'SELECT auditable_id, auditable_type, user_id, user_type, action, audited_changes, version, comment, remote_address, created_at FROM espinita_audits;' | ||
drop_table :espinita_audits | ||
end | ||
|
||
def self.down | ||
raise IrreversibleMigration | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters