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

From 08093fd9c7104da5f63547d9d3350b7049fe66a6 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 63735d7b07..ee8688f616 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 aaf54f287a..1b602c5c91 100644
--- a/src/api/Gemfile.lock
+++ b/src/api/Gemfile.lock
@@ -423,6 +423,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)
@@ -568,6 +570,7 @@ DEPENDENCIES
   simplecov
   single_test
   sprite-factory (>= 1.5.2)
+  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