Add active attribute to administrateur model

This commit is contained in:
Paul Chavard 2018-01-08 16:04:31 +01:00
parent d6f9736e36
commit 8688d62a24
3 changed files with 16 additions and 3 deletions

View file

@ -0,0 +1,5 @@
class AddActiveToAdministrateurs < ActiveRecord::Migration[5.0]
def change
add_column :administrateurs, :active, :boolean, default: false
end
end

View file

@ -17,12 +17,12 @@ ActiveRecord::Schema.define(version: 20180111153308) do
enable_extension "unaccent"
create_table "administrateurs", force: :cascade do |t|
t.string "email", default: "", null: false
t.string "encrypted_password", default: "", null: false
t.string "email", default: "", null: false
t.string "encrypted_password", default: "", null: false
t.string "reset_password_token"
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
t.integer "sign_in_count", default: 0, null: false
t.integer "sign_in_count", default: 0, null: false
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.string "current_sign_in_ip"
@ -30,6 +30,7 @@ ActiveRecord::Schema.define(version: 20180111153308) do
t.datetime "created_at"
t.datetime "updated_at"
t.string "api_token"
t.boolean "active", default: false
t.index ["email"], name: "index_administrateurs_on_email", unique: true, using: :btree
t.index ["reset_password_token"], name: "index_administrateurs_on_reset_password_token", unique: true, using: :btree
end

View file

@ -0,0 +1,7 @@
namespace :'2018_01_11_add_active_state_to_administrators' do
task set: :environment do
Administrateur.find_each do |administrateur|
administrateur.update_column(:active, true)
end
end
end