diff --git a/config/initializers/postgresql_database_tasks.rb b/config/initializers/postgresql_database_tasks.rb index 192d73e0928bf7ae17e95b216d8f9392158559dd..83e3b543d040b0ecf4d9f0aaa8fef981594c0c41 100644 --- a/config/initializers/postgresql_database_tasks.rb +++ b/config/initializers/postgresql_database_tasks.rb @@ -20,10 +20,18 @@ module ActiveRecord module Tasks class PostgreSQLDatabaseTasks + + def initialize(db_config) + @db_config = db_config + @configuration_hash = db_config.configuration_hash + end + def drop 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 configuration['database'] + connection.drop_database(db_config.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 diff --git a/db/migrate/20160512143532_create_versions.rb b/db/migrate/20160512143532_create_versions.rb index d23847bde4dc4def1a98a35908b600e925dd7d92..27548ff6b3565bdce7b1266f2844721503e2c3f1 100644 --- a/db/migrate/20160512143532_create_versions.rb +++ b/db/migrate/20160512143532_create_versions.rb @@ -35,7 +35,8 @@ class CreateVersions < ActiveRecord::Migration[4.2] TEXT_BYTES = 1_073_741_823 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.integer :item_id, null: false t.string :event, null: false @@ -81,7 +82,7 @@ class CreateVersions < ActiveRecord::Migration[4.2] if MYSQL_ADAPTERS.include?(connection.class.name) { options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci" } else - {} + nil end end end diff --git a/db/migrate/20210902130554_add_user_password_change.rb b/db/migrate/20210902130554_add_user_password_change.rb new file mode 100644 index 0000000000000000000000000000000000000000..81cbc7de671860b582957cbad67b54fd85aa6776 --- /dev/null +++ b/db/migrate/20210902130554_add_user_password_change.rb @@ -0,0 +1,23 @@ +# 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