From ed35f67e063b2961c4c1c8a21a82390fff4355a7 Mon Sep 17 00:00:00 2001 From: ConnorSheremeta Date: Mon, 30 Nov 2020 12:02:11 -0700 Subject: [PATCH] Fixed read only mode feature by adding system account if needed --- CHANGELOG.md | 3 +++ db/migrate/20201130183659_add_system_account_if_needed.rb | 8 ++++++++ db/schema.rb | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20201130183659_add_system_account_if_needed.rb diff --git a/CHANGELOG.md b/CHANGELOG.md index 9cdd049c7..2137f7a9d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ and releases in Jupiter project adheres to [Semantic Versioning](http://semver.o ## [Unreleased] +### Fixed +- Fixed read only mode feature by adding system account if needed + ## [1.2.24] – 2020-10-13 ### Added diff --git a/db/migrate/20201130183659_add_system_account_if_needed.rb b/db/migrate/20201130183659_add_system_account_if_needed.rb new file mode 100644 index 000000000..ed5a5fb1b --- /dev/null +++ b/db/migrate/20201130183659_add_system_account_if_needed.rb @@ -0,0 +1,8 @@ +class AddSystemAccountIfNeeded < ActiveRecord::Migration[5.2] + def change + User.find_or_create_by(email: 'ditech@ualberta.ca') do |user| + user.name ||= 'System user' + user.admin = false + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 718cd8f6b..cec7acace 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2020_08_31_182732) do +ActiveRecord::Schema.define(version: 2020_11_30_183659) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql"