File obs-server-2.10-0101-Add-strong_migrations-to-our-development-environment.patch of Package obs-server

From b94696b5cf6e208c2e4f99574b5f1f4574143fc3 Mon Sep 17 00:00:00 2001
From: Victor Pereira <vpereira@suse.de>
Date: Wed, 25 Mar 2020 18:17:20 +0100
Subject: [PATCH] Add strong_migrations to our development environment

Install https://github.com/ankane/strong_migrations and whitelist all
migrations before 20200318123203
---
 src/api/Gemfile                                  | 2 ++
 src/api/Gemfile.lock                             | 3 +++
 src/api/config/initializers/strong_migrations.rb | 4 ++++
 3 files changed, 9 insertions(+)
 create mode 100644 src/api/config/initializers/strong_migrations.rb

diff --git a/src/api/Gemfile b/src/api/Gemfile
index 3078063276..53f3a1f1f0 100644
--- a/src/api/Gemfile
+++ b/src/api/Gemfile
@@ -183,6 +183,8 @@ group :development, :test do
   gem 'puma', '~> 4.0'
   # to drive headless chrome
   gem 'selenium-webdriver'
+  # Catch unsafe migrations in development
+  gem 'strong_migrations'
   # scan for security vulnerability (circleci only, do not touch)
   # BRAKEMAN
 end
diff --git a/src/api/Gemfile.lock b/src/api/Gemfile.lock
index 60bda06b05..91ea19d174 100644
--- a/src/api/Gemfile.lock
+++ b/src/api/Gemfile.lock
@@ -420,6 +420,8 @@ GEM
       unicode-display_width (~> 1.5)
       unicode_utils (~> 1.4)
     strings-ansi (0.1.0)
+    strong_migrations (0.6.2)
+      activerecord (>= 5)
     sysexits (1.2.0)
     tdigest (0.1.1)
       rbtree (~> 0.4.2)
@@ -565,6 +567,7 @@ DEPENDENCIES
   single_test
   sprite-factory (>= 1.5.2)
   sprockets (~> 3.0)
+  strong_migrations
   test-unit
   thinking-sphinx (> 3.1)
   tilt (>= 1.4.1)
diff --git a/src/api/config/initializers/strong_migrations.rb b/src/api/config/initializers/strong_migrations.rb
new file mode 100644
index 0000000000..1578de6f8b
--- /dev/null
+++ b/src/api/config/initializers/strong_migrations.rb
@@ -0,0 +1,4 @@
+# since its a timestamp and not a regular number, disable the cop
+# rubocop:disable Style/NumericLiterals
+StrongMigrations.start_after = 20200318123203
+# rubocop:enable Style/NumericLiterals
-- 
2.31.1