Skip to content
Snippets Groups Projects
Commit 7593bd73 authored by Marllon's avatar Marllon
Browse files

Merge branch 'password_reset_fix' into 'master'

Fixed> db:drop task, old migration, password recovery

See merge request !549
parents cf19cc5e a69364b7
No related branches found
No related tags found
No related merge requests found
...@@ -20,10 +20,18 @@ ...@@ -20,10 +20,18 @@
module ActiveRecord module ActiveRecord
module Tasks module Tasks
class PostgreSQLDatabaseTasks class PostgreSQLDatabaseTasks
def initialize(db_config)
@db_config = db_config
@configuration_hash = db_config.configuration_hash
end
def drop def drop
establish_master_connection establish_master_connection
connection.select_all "select pg_terminate_backend(pg_stat_activity.pid) from pg_stat_activity where datname='#{configuration['database']}' AND state='idle';" connection.drop_database(db_config.database)
connection.drop_database configuration['database'] # establish_master_connection
# connection.select_all "select pg_terminate_backend(pg_stat_activity.pid) from pg_stat_activity where datname='#{configuration_hash['database']}' AND state='idle';"
# connection.drop_database configuration_hash['database']
end end
end end
end end
......
...@@ -35,7 +35,8 @@ class CreateVersions < ActiveRecord::Migration[4.2] ...@@ -35,7 +35,8 @@ class CreateVersions < ActiveRecord::Migration[4.2]
TEXT_BYTES = 1_073_741_823 TEXT_BYTES = 1_073_741_823
def change def change
create_table :versions, versions_table_options do |t| # create_table :versions, versions_table_options do |t|
create_table :versions do |t|
t.string :item_type, null: false t.string :item_type, null: false
t.integer :item_id, null: false t.integer :item_id, null: false
t.string :event, null: false t.string :event, null: false
...@@ -81,7 +82,7 @@ class CreateVersions < ActiveRecord::Migration[4.2] ...@@ -81,7 +82,7 @@ class CreateVersions < ActiveRecord::Migration[4.2]
if MYSQL_ADAPTERS.include?(connection.class.name) if MYSQL_ADAPTERS.include?(connection.class.name)
{ options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci" } { options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci" }
else else
{} nil
end end
end end
end end
# Copyright (C) 2015 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana
#
# This file is part of portalmec.
#
# portalmec is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# portalmec is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with portalmec. If not, see <http://www.gnu.org/licenses/>.
class AddUserPasswordChange < ActiveRecord::Migration[6.1]
def change
add_column :users, :allow_password_change, :boolean, default: false
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment