-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Combine migrations for solid_cache_entries
Combine the migrations for solid_cache_entries into a single file. Spot if someone is migrating directly from v0.3 or earlier and raise an error.
- Loading branch information
Showing
11 changed files
with
35 additions
and
49 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
db/migrate/20240108155507_add_key_hash_and_byte_size_to_solid_cache_entries.rb
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
...0111600_add_key_hash_and_byte_size_indexes_and_null_constraints_to_solid_cache_entries.rb
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
db/migrate/20240110111702_remove_key_index_from_solid_cache_entries.rb
This file was deleted.
Oops, something went wrong.
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,29 @@ | ||
class CreateSolidCacheEntries < ActiveRecord::Migration[7.2] | ||
def up | ||
create_table :solid_cache_entries, if_not_exists: true do |t| | ||
t.binary :key, null: false, limit: 1024 | ||
t.binary :value, null: false, limit: 512.megabytes | ||
t.datetime :created_at, null: false | ||
t.integer :key_hash, null: false, limit: 8 | ||
t.integer :byte_size, null: false, limit: 4 | ||
|
||
t.index :key_hash, unique: true | ||
t.index [:key_hash, :byte_size] | ||
t.index :byte_size | ||
end | ||
|
||
raise "column \"key_hash\" does not exist" unless column_exists? :solid_cache_entries, :key_hash | ||
rescue => e | ||
if e.message =~ /(column "key_hash" does not exist|no such column: key_hash)/ | ||
raise \ | ||
"Could not find key_hash column on solid_cache_entries, if upgrading from v0.3 or earlier, have you followed " \ | ||
"the steps in https://github.com/rails/solid_cache/blob/main/upgrading_to_version_0.4.x.md?" | ||
else | ||
raise | ||
end | ||
end | ||
|
||
def down | ||
drop_table :solid_cache_entries | ||
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
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