Skip to content
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

Combine migrations for solid_cache_entries #172

Merged
merged 1 commit into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions db/migrate/20230724121448_create_solid_cache_entries.rb

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

29 changes: 29 additions & 0 deletions db/migrate/20240820123641_create_solid_cache_entries.rb
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
3 changes: 1 addition & 2 deletions test/dummy/db/primary_shard_one_schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.0].define(version: 2024_01_10_111702) do
ActiveRecord::Schema[7.2].define(version: 2024_08_20_123641) do
create_table "solid_cache_entries", force: :cascade do |t|
t.binary "key", limit: 1024, null: false
t.binary "value", limit: 536870912, null: false
Expand All @@ -21,5 +21,4 @@
t.index ["key_hash", "byte_size"], name: "index_solid_cache_entries_on_key_hash_and_byte_size"
t.index ["key_hash"], name: "index_solid_cache_entries_on_key_hash", unique: true
end

end
3 changes: 1 addition & 2 deletions test/dummy/db/primary_shard_two_schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.0].define(version: 2024_01_10_111702) do
ActiveRecord::Schema[7.2].define(version: 2024_08_20_123641) do
create_table "solid_cache_entries", force: :cascade do |t|
t.binary "key", limit: 1024, null: false
t.binary "value", limit: 536870912, null: false
Expand All @@ -21,5 +21,4 @@
t.index ["key_hash", "byte_size"], name: "index_solid_cache_entries_on_key_hash_and_byte_size"
t.index ["key_hash"], name: "index_solid_cache_entries_on_key_hash", unique: true
end

end
3 changes: 1 addition & 2 deletions test/dummy/db/primary_unprepared_statements_schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.0].define(version: 2024_01_10_111702) do
ActiveRecord::Schema[7.2].define(version: 2024_08_20_123641) do
create_table "solid_cache_entries", force: :cascade do |t|
t.binary "key", limit: 1024, null: false
t.binary "value", limit: 536870912, null: false
Expand All @@ -21,5 +21,4 @@
t.index ["key_hash", "byte_size"], name: "index_solid_cache_entries_on_key_hash_and_byte_size"
t.index ["key_hash"], name: "index_solid_cache_entries_on_key_hash", unique: true
end

end
3 changes: 1 addition & 2 deletions test/dummy/db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.0].define(version: 2024_01_10_111702) do
ActiveRecord::Schema[7.2].define(version: 2024_08_20_123641) do
create_table "solid_cache_entries", force: :cascade do |t|
t.binary "key", limit: 1024, null: false
t.binary "value", limit: 536870912, null: false
Expand All @@ -21,5 +21,4 @@
t.index ["key_hash", "byte_size"], name: "index_solid_cache_entries_on_key_hash_and_byte_size"
t.index ["key_hash"], name: "index_solid_cache_entries_on_key_hash", unique: true
end

end
3 changes: 1 addition & 2 deletions test/dummy/db/secondary_shard_one_schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.0].define(version: 2024_01_10_111702) do
ActiveRecord::Schema[7.2].define(version: 2024_08_20_123641) do
create_table "solid_cache_entries", force: :cascade do |t|
t.binary "key", limit: 1024, null: false
t.binary "value", limit: 536870912, null: false
Expand All @@ -21,5 +21,4 @@
t.index ["key_hash", "byte_size"], name: "index_solid_cache_entries_on_key_hash_and_byte_size"
t.index ["key_hash"], name: "index_solid_cache_entries_on_key_hash", unique: true
end

end
3 changes: 1 addition & 2 deletions test/dummy/db/secondary_shard_two_schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.0].define(version: 2024_01_10_111702) do
ActiveRecord::Schema[7.2].define(version: 2024_08_20_123641) do
create_table "solid_cache_entries", force: :cascade do |t|
t.binary "key", limit: 1024, null: false
t.binary "value", limit: 536870912, null: false
Expand All @@ -21,5 +21,4 @@
t.index ["key_hash", "byte_size"], name: "index_solid_cache_entries_on_key_hash_and_byte_size"
t.index ["key_hash"], name: "index_solid_cache_entries_on_key_hash", unique: true
end

end