-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suggest to use hash index, instead of btree index in migration. #94
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class CreateSolidCacheEntries < ActiveRecord::Migration[7.0] | ||
def change | ||
create_table :solid_cache_entries do |t| | ||
t.binary :key, null: false, limit: 1024 | ||
t.binary :value, null: false, limit: 512.megabytes | ||
t.datetime :created_at, null: false | ||
|
||
t.index :key, unique: true | ||
end | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class CreateSolidCacheEntries < ActiveRecord::Migration[7.0] | ||
def change | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same |
||
create_table :solid_cache_entries do |t| | ||
t.binary :key, null: false, limit: 1024 | ||
t.binary :value, null: false, limit: 512.megabytes | ||
t.datetime :created_at, null: false | ||
|
||
t.index :key, unique: true, using: :hash | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Error encountered with message From doc There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Though I attempted to workaround it by removing Edit: And then I read comments above and it's already reported sorry~ |
||
end | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,12 @@ | ||
desc "Copy over the migration, and set cache" | ||
namespace :solid_cache do | ||
task :install do | ||
Rails::Command.invoke :generate, [ "solid_cache:install" ] | ||
task :install, [ :index ] do |_t, args| | ||
args.with_defaults(index: "btree") | ||
|
||
if args[:index] == "btree" || args[:index] == "hash" | ||
Rails::Command.invoke :generate, [ "solid_cache:install", "--index=#{args[:index]}" ] | ||
else | ||
abort "Invalid index type - only 'btree' and 'hash' are supported." | ||
end | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why 4 spaces instead of 2 spaces