Skip to content

Commit

Permalink
Change versions table layout for performance
Browse files Browse the repository at this point in the history
  • Loading branch information
fatkodima authored and jaredbeck committed May 28, 2024
1 parent 5d7c816 commit 67a1ec2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ recommendations of [keepachangelog.com](http://keepachangelog.com/).

### Added

- None
- Change `versions` table layout for performance

### Fixed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,7 @@ class CreateVersions < ActiveRecord::Migration<%= migration_version %>

def change
create_table :versions<%= versions_table_options %><%= version_table_primary_key_type %> do |t|
t.string :item_type<%= item_type_options %>
t.<%= item_id_type_options %> :item_id, null: false
t.string :event, null: false
t.string :whodunnit
t.text :object, limit: TEXT_BYTES

# Known issue in MySQL: fractional second precision
# -------------------------------------------------
Expand All @@ -32,6 +28,11 @@ class CreateVersions < ActiveRecord::Migration<%= migration_version %>
# MySQL users should use the following line for `created_at`
# t.datetime :created_at, limit: 6
t.datetime :created_at

t.<%= item_id_type_options %> :item_id, null: false
t.string :item_type<%= item_type_options %>
t.string :event, null: false
t.text :object, limit: TEXT_BYTES
end
add_index :versions, %i[item_type item_id]
end
Expand Down

0 comments on commit 67a1ec2

Please sign in to comment.