From 6bfc8b1a79f31025aa65363ae9d967fa3f48a682 Mon Sep 17 00:00:00 2001 From: Rocket Date: Wed, 12 Jun 2024 17:09:11 -0700 Subject: [PATCH 1/2] Add database migration to enable pgcrypto --- .../migrate/20240613000011_enable_extension_for_uuid.rb | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 app-rails/db/migrate/20240613000011_enable_extension_for_uuid.rb diff --git a/app-rails/db/migrate/20240613000011_enable_extension_for_uuid.rb b/app-rails/db/migrate/20240613000011_enable_extension_for_uuid.rb new file mode 100644 index 0000000..000e013 --- /dev/null +++ b/app-rails/db/migrate/20240613000011_enable_extension_for_uuid.rb @@ -0,0 +1,9 @@ +class EnableExtensionForUuid < ActiveRecord::Migration[7.1] + def up + enable_extension 'pgcrypto' unless extension_enabled?('pgcrypto') + end + + def down + disable_extension 'pgcrypto' if extension_enabled?('pgcrypto') + end +end From ff16a7873255c6de79355c67249af69fd91d3c51 Mon Sep 17 00:00:00 2001 From: Rocket Date: Wed, 12 Jun 2024 17:15:04 -0700 Subject: [PATCH 2/2] Add updated db schema --- app-rails/db/schema.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app-rails/db/schema.rb b/app-rails/db/schema.rb index 709bdc0..1bc0073 100644 --- a/app-rails/db/schema.rb +++ b/app-rails/db/schema.rb @@ -10,8 +10,9 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.1].define(version: 2024_04_10_213056) do +ActiveRecord::Schema[7.1].define(version: 2024_06_13_000011) do # These are extensions that must be enabled in order to support this database + enable_extension "pgcrypto" enable_extension "plpgsql" create_table "active_storage_attachments", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|