Merge branch 'develop' into add_dossier_workflow_dates

This commit is contained in:
Mathieu Magnin 2017-03-02 11:46:17 +01:00 committed by GitHub
commit 6fcd35fd4c
45 changed files with 303 additions and 210 deletions

View file

@ -16,8 +16,8 @@ class DeviseCreateUsers < ActiveRecord::Migration
t.integer :sign_in_count, default: 0, null: false
t.datetime :current_sign_in_at
t.datetime :last_sign_in_at
t.inet :current_sign_in_ip
t.inet :last_sign_in_ip
t.string :current_sign_in_ip
t.string :last_sign_in_ip
## Confirmable
# t.string :confirmation_token

View file

@ -16,8 +16,8 @@ class DeviseCreatePros < ActiveRecord::Migration
t.integer :sign_in_count, default: 0, null: false
t.datetime :current_sign_in_at
t.datetime :last_sign_in_at
t.inet :current_sign_in_ip
t.inet :last_sign_in_ip
t.string :current_sign_in_ip
t.string :last_sign_in_ip
## Confirmable
# t.string :confirmation_token

View file

@ -16,8 +16,8 @@ class DeviseCreateGestionnaires < ActiveRecord::Migration
t.integer :sign_in_count, default: 0, null: false
t.datetime :current_sign_in_at
t.datetime :last_sign_in_at
t.inet :current_sign_in_ip
t.inet :last_sign_in_ip
t.string :current_sign_in_ip
t.string :last_sign_in_ip
## Confirmable
# t.string :confirmation_token

View file

@ -16,8 +16,8 @@ class CreateUsers < ActiveRecord::Migration
t.integer :sign_in_count, default: 0, null: false
t.datetime :current_sign_in_at
t.datetime :last_sign_in_at
t.inet :current_sign_in_ip
t.inet :last_sign_in_ip
t.string :current_sign_in_ip
t.string :last_sign_in_ip
## Confirmable
# t.string :confirmation_token

View file

@ -16,8 +16,8 @@ class DeviseCreateAdministrateurs < ActiveRecord::Migration
t.integer :sign_in_count, default: 0, null: false
t.datetime :current_sign_in_at
t.datetime :last_sign_in_at
t.inet :current_sign_in_ip
t.inet :last_sign_in_ip
t.string :current_sign_in_ip
t.string :last_sign_in_ip
## Confirmable
# t.string :confirmation_token

View file

@ -1,6 +1,10 @@
class ChangeDateCreationTypeToEntreprise < ActiveRecord::Migration
def up
change_column :entreprises, :date_creation, "timestamp USING to_timestamp(date_creation) at time zone 'UTC-2'"
if Rails.env.test?
change_column :entreprises, :date_creation, "timestamp"
else
change_column :entreprises, :date_creation, "timestamp USING to_timestamp(date_creation) at time zone 'UTC-2'"
end
end
def down

View file

@ -16,8 +16,8 @@ class DeviseCreateAdministrations < ActiveRecord::Migration
t.integer :sign_in_count, default: 0, null: false
t.datetime :current_sign_in_at
t.datetime :last_sign_in_at
t.inet :current_sign_in_ip
t.inet :last_sign_in_ip
t.string :current_sign_in_ip
t.string :last_sign_in_ip
## Confirmable
# t.string :confirmation_token

View file

@ -4,14 +4,14 @@ class FixDefaultTypeOnTypeDeChampTable < ActiveRecord::Migration
end
def up
TypeDeChamp.where("private = false").update_all("type = 'TypeDeChampPublic'")
TypeDeChamp.where("private = true").update_all("type = 'TypeDeChampPrivate'")
TypeDeChamp.where(private: false).update_all("type = 'TypeDeChampPublic'")
TypeDeChamp.where(private: true).update_all("type = 'TypeDeChampPrivate'")
remove_column :types_de_champ, :private
end
def down
add_column :types_de_champ, :private, :boolean, default: true
TypeDeChamp.where("type = 'TypeDeChampPublic'").update_all("private = false")
TypeDeChamp.where("type = 'TypeDeChampPrivate'").update_all("private = true")
TypeDeChamp.where("type = 'TypeDeChampPublic'").update_all(private: false)
TypeDeChamp.where("type = 'TypeDeChampPrivate'").update_all(private: true)
end
end

View file

@ -9,7 +9,7 @@ class CreateSearches < ActiveRecord::Migration
add_index :individuals, :dossier_id
add_index :pieces_justificatives, :dossier_id
add_index :rna_informations, :entreprise_id
create_view :searches #, materialized: true
create_view :searches unless Rails.env.test? #, materialized: true
end
def down
@ -22,6 +22,6 @@ class CreateSearches < ActiveRecord::Migration
remove_index :individuals, :dossier_id
remove_index :pieces_justificatives, :dossier_id
remove_index :rna_informations, :entreprise_id
drop_view :searches #, materialized: true
drop_view :searches unless Rails.env.test? #, materialized: true
end
end

View file

@ -1,9 +1,9 @@
class UpdateSearchesToVersion2 < ActiveRecord::Migration
def up
replace_view :searches, version: 2
replace_view :searches, version: 2 unless Rails.env.test?
end
def down
replace_view :searches, version: 1
replace_view :searches, version: 1 unless Rails.env.test?
end
end

View file

@ -0,0 +1,29 @@
class MoveInetColumnToString < ActiveRecord::Migration[5.0]
def up
change_column :users, :last_sign_in_ip, 'string'
change_column :users, :current_sign_in_ip, 'string'
change_column :gestionnaires, :last_sign_in_ip, 'string'
change_column :gestionnaires, :current_sign_in_ip, 'string'
change_column :administrateurs, :last_sign_in_ip, 'string'
change_column :administrateurs, :current_sign_in_ip, 'string'
change_column :administrations, :last_sign_in_ip, 'string'
change_column :administrations, :current_sign_in_ip, 'string'
end
def down
change_column :users, :last_sign_in_ip, 'inet USING last_sign_in_ip::inet'
change_column :users, :current_sign_in_ip, 'inet USING last_sign_in_ip::inet'
change_column :gestionnaires, :last_sign_in_ip, 'inet USING last_sign_in_ip::inet'
change_column :gestionnaires, :current_sign_in_ip, 'inet USING last_sign_in_ip::inet'
change_column :administrateurs, :last_sign_in_ip, 'inet USING last_sign_in_ip::inet'
change_column :administrateurs, :current_sign_in_ip, 'inet USING last_sign_in_ip::inet'
change_column :administrations, :last_sign_in_ip, 'inet USING last_sign_in_ip::inet'
change_column :administrations, :current_sign_in_ip, 'inet USING last_sign_in_ip::inet'
end
end

View file

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20170228144909) do
ActiveRecord::Schema.define(version: 20170228150522) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@ -24,8 +24,8 @@ ActiveRecord::Schema.define(version: 20170228144909) do
t.integer "sign_in_count", default: 0, null: false
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.inet "current_sign_in_ip"
t.inet "last_sign_in_ip"
t.string "current_sign_in_ip"
t.string "last_sign_in_ip"
t.datetime "created_at"
t.datetime "updated_at"
t.string "api_token"
@ -50,8 +50,8 @@ ActiveRecord::Schema.define(version: 20170228144909) do
t.integer "sign_in_count", default: 0, null: false
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.inet "current_sign_in_ip"
t.inet "last_sign_in_ip"
t.string "current_sign_in_ip"
t.string "last_sign_in_ip"
t.datetime "created_at"
t.datetime "updated_at"
t.index ["email"], name: "index_administrations_on_email", unique: true, using: :btree
@ -210,8 +210,8 @@ ActiveRecord::Schema.define(version: 20170228144909) do
t.integer "sign_in_count", default: 0, null: false
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.inet "current_sign_in_ip"
t.inet "last_sign_in_ip"
t.string "current_sign_in_ip"
t.string "last_sign_in_ip"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "procedure_filter"
@ -378,8 +378,8 @@ ActiveRecord::Schema.define(version: 20170228144909) do
t.integer "sign_in_count", default: 0, null: false
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.inet "current_sign_in_ip"
t.inet "last_sign_in_ip"
t.string "current_sign_in_ip"
t.string "last_sign_in_ip"
t.datetime "created_at"
t.datetime "updated_at"
t.string "siret"