Maintenance: Redo column allow signup with reset column information to make the migration work. Removed old migration because of missing column information reset there was a quite crash.

This commit is contained in:
Rolf Schmidt 2020-11-12 11:54:29 +01:00 committed by Thorsten Eckel
parent cf5a5e3960
commit 317c7b7e7f
2 changed files with 7 additions and 3 deletions

View file

@ -1,10 +1,14 @@
class RoleSignupColumn < ActiveRecord::Migration[5.2] class RoleSignupColumnFix < ActiveRecord::Migration[5.2]
def change def change
# return if it's a new setup # return if it's a new setup
return if !Setting.exists?(name: 'system_init_done') return if !Setting.exists?(name: 'system_init_done')
add_column :permissions, :allow_signup, :boolean, null: false, default: false if !column_exists?(:permissions, :allow_signup)
add_column :permissions, :allow_signup, :boolean, null: false, default: false
end
Permission.reset_column_information
signup_permissions = [ signup_permissions = [
'user_preferences', 'user_preferences',

View file

@ -1,6 +1,6 @@
require 'rails_helper' require 'rails_helper'
RSpec.describe RoleSignupColumn, type: :db_migration, db_strategy: :reset do RSpec.describe RoleSignupColumnFix, type: :db_migration, db_strategy: :reset do
context 'when a role contains signup permissions' do context 'when a role contains signup permissions' do
let!(:role) do let!(:role) do
role = create(:role) role = create(:role)