From 98506a3a4f674782dee6ee8e84a22710668bf5fd Mon Sep 17 00:00:00 2001 From: Eugene Burmakin Date: Fri, 6 Sep 2024 22:54:53 +0200 Subject: [PATCH] Don't update user if it doesn't exist --- .app_version | 2 +- CHANGELOG.md | 7 +++++++ db/data/20240713103122_make_first_user_admin.rb | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.app_version b/.app_version index 288adf53..dffa40ec 100644 --- a/.app_version +++ b/.app_version @@ -1 +1 @@ -0.13.3 +0.13.4 diff --git a/CHANGELOG.md b/CHANGELOG.md index 78635129..14f95761 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [0.13.4] — 2024-09-06 + +### Fixed + +- Fixed a bug preventing the application from starting, when there is no users in the database but a data migration tries to update one. + + ## [0.13.3] — 2024-09-06 ### Added diff --git a/db/data/20240713103122_make_first_user_admin.rb b/db/data/20240713103122_make_first_user_admin.rb index a039b676..2328011d 100644 --- a/db/data/20240713103122_make_first_user_admin.rb +++ b/db/data/20240713103122_make_first_user_admin.rb @@ -3,11 +3,11 @@ class MakeFirstUserAdmin < ActiveRecord::Migration[7.1] def up user = User.first - user.update!(admin: true) + user&.update!(admin: true) end def down user = User.first - user.update!(admin: false) + user&.update!(admin: false) end end