Skip to content
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
28 changes: 14 additions & 14 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ GEM
aes_key_wrap (1.1.0)
ast (2.4.2)
aws-eventstream (1.3.1)
aws-partitions (1.1052.0)
aws-partitions (1.1056.0)
aws-record (2.13.2)
aws-sdk-dynamodb (~> 1, >= 1.85.0)
aws-sdk-core (3.219.0)
Expand All @@ -115,7 +115,7 @@ GEM
aws-sdk-dynamodb (1.129.0)
aws-sdk-core (~> 3, >= 3.210.0)
aws-sigv4 (~> 1.5)
aws-sdk-kms (1.98.0)
aws-sdk-kms (1.99.0)
aws-sdk-core (~> 3, >= 3.216.0)
aws-sigv4 (~> 1.5)
aws-sdk-rails (4.1.0)
Expand All @@ -129,7 +129,7 @@ GEM
aws-sessionstore-dynamodb (~> 2)
concurrent-ruby (~> 1.3, >= 1.3.1)
railties (>= 7.0.0)
aws-sdk-s3 (1.181.0)
aws-sdk-s3 (1.182.0)
aws-sdk-core (~> 3, >= 3.216.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.5)
Expand Down Expand Up @@ -228,7 +228,7 @@ GEM
drb (2.2.1)
dumb_delegator (1.1.0)
erubi (1.13.1)
excon (1.2.3)
excon (1.2.4)
factory_bot (6.5.1)
activesupport (>= 6.1.0)
factory_bot_rails (6.4.4)
Expand Down Expand Up @@ -344,8 +344,8 @@ GEM
mime-types (3.6.0)
logger
mime-types-data (~> 3.2015)
mime-types-data (3.2025.0204)
mini_magick (5.1.2)
mime-types-data (3.2025.0220)
mini_magick (5.2.0)
benchmark
logger
mini_mime (1.1.5)
Expand Down Expand Up @@ -491,7 +491,7 @@ GEM
ffi (~> 1.0)
rdoc (6.12.0)
psych (>= 4.0.0)
redis (5.3.0)
redis (5.4.0)
redis-client (>= 0.22.0)
redis-client (0.23.2)
connection_pool
Expand Down Expand Up @@ -526,7 +526,7 @@ GEM
rspec-support (3.13.2)
rspec_junit_formatter (0.6.0)
rspec-core (>= 2, < 4, != 2.12.0)
rubocop (1.72.2)
rubocop (1.73.0)
json (~> 2.3)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0)
Expand All @@ -537,9 +537,9 @@ GEM
rubocop-ast (>= 1.38.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.38.0)
rubocop-ast (1.38.1)
parser (>= 3.3.1.0)
rubocop-rails (2.30.1)
rubocop-rails (2.30.2)
activesupport (>= 4.2.0)
lint_roller (~> 1.1)
rack (>= 1.1)
Expand All @@ -564,7 +564,7 @@ GEM
sprockets-rails
tilt
securerandom (0.4.1)
selenium-webdriver (4.28.0)
selenium-webdriver (4.29.1)
base64 (~> 0.2)
logger (~> 1.4)
rexml (~> 3.2, >= 3.2.5)
Expand Down Expand Up @@ -595,7 +595,7 @@ GEM
ssrf_filter (1.2.0)
stimulus-rails (1.3.4)
railties (>= 6.0.0)
stringio (3.1.3)
stringio (3.1.5)
thor (1.3.2)
thread_safe (0.3.6)
tilt (2.6.0)
Expand All @@ -609,9 +609,9 @@ GEM
unicode-emoji (~> 4.0, >= 4.0.4)
unicode-emoji (4.0.4)
uniform_notifier (1.16.0)
uri (1.0.2)
uri (1.0.3)
useragent (0.16.11)
version_gem (1.1.4)
version_gem (1.1.6)
virtus (2.0.0)
axiom-types (~> 0.1)
coercible (~> 1.0)
Expand Down
36 changes: 36 additions & 0 deletions db/migrate/20250226221548_versions_json.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
class SafeYAML
def self.load(string)
return {} if string.nil?

YAML.safe_load(
string,
permitted_classes: [
Time,
Date,
ActiveSupport::TimeWithZone,
ActiveSupport::TimeZone
],
aliases: true
)
end
end

class VersionsJson < ActiveRecord::Migration[8.0]
def change
rename_column :versions, :object, :old_object
rename_column :versions, :object_changes, :old_object_changes
add_column :versions, :object, :jsonb
add_column :versions, :object_changes, :jsonb

PaperTrail::Version.where.not(old_object: nil).in_batches(of: 500, start: 1) do |batch|
batch.each do |version|
version.update_columns(
object: SafeYAML.load(version.old_object),
old_object: nil,
object_changes: SafeYAML.load(version.old_object_changes),
old_object_changes: nil,
)
end
end
end
end
10 changes: 6 additions & 4 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.2].define(version: 2025_02_21_194420) do
ActiveRecord::Schema[8.0].define(version: 2025_02_26_221548) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
enable_extension "pg_catalog.plpgsql"

create_table "active_storage_attachments", force: :cascade do |t|
t.string "name", null: false
Expand Down Expand Up @@ -720,9 +720,11 @@
t.bigint "item_id", null: false
t.string "event", null: false
t.string "whodunnit"
t.text "object"
t.text "old_object"
t.datetime "created_at", precision: nil
t.text "object_changes"
t.text "old_object_changes"
t.jsonb "object"
t.jsonb "object_changes"
t.index ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id"
end

Expand Down
8 changes: 8 additions & 0 deletions spec/features/admin/websites_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@
website.reload
expect(website.versions.size).to eq(1)
expect(website.versions.last.event).to eq('create')

visit versions_admin_website_path(website)
expect(page).to have_content("Website #{website.domain} versions")
expect(page).to have_content("production_status")
expect(page).to have_content("in_development")
expect(page).to have_content("production_status")
expect(page).to have_content("site_owner_email")
expect(page).to have_content(website.site_owner_email)
end
end

Expand Down
Loading