diff --git a/.rubocop.yml b/.rubocop.yml index 445c3400a..7d5623304 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -4,6 +4,7 @@ require: AllCops: Exclude: - "db/schema.rb" + - "db/migrate/20190730153555_recreate_structure.rb" - "bin/*" - "node_modules/**/*" @@ -866,7 +867,14 @@ Style/ClassVars: Enabled: false Style/CollectionMethods: - Enabled: false + PreferredMethods: + collect: map + collect!: map! + inject: reduce + detect: find + select: filter + find_all: filter + Enabled: true Style/ColonMethodCall: Enabled: true diff --git a/Gemfile.lock b/Gemfile.lock index 6ee007053..4692f4edf 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -189,10 +189,10 @@ GEM delayed_job (> 2.0.3) rack-protection (>= 1.5.5) sinatra (>= 1.4.4) - devise (4.6.1) + devise (4.7.1) bcrypt (~> 3.0) orm_adapter (~> 0.1) - railties (>= 4.1.0, < 6.0) + railties (>= 4.1.0) responders warden (~> 1.2.3) devise-async (1.0.0) @@ -440,7 +440,7 @@ GEM puma (3.12.0) pundit (2.0.1) activesupport (>= 3.0.0) - rack (2.0.6) + rack (2.0.7) rack-attack (6.0.0) rack (>= 1.0, < 3) rack-mini-profiler (1.0.1) @@ -477,7 +477,7 @@ GEM rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) - rails-html-sanitizer (1.0.4) + rails-html-sanitizer (1.2.0) loofah (~> 2.2, >= 2.2.2) rails-i18n (5.1.2) i18n (>= 0.7, < 2) @@ -489,7 +489,7 @@ GEM rake (>= 0.8.7) thor (>= 0.19.0, < 2.0) rainbow (3.0.0) - rake (12.3.2) + rake (12.3.3) rake-progressbar (0.0.5) rb-fsevent (0.10.3) rb-inotify (0.10.0) @@ -503,9 +503,9 @@ GEM regexp_parser (1.3.0) request_store (1.4.1) rack (>= 1.4) - responders (2.4.1) - actionpack (>= 4.2.0, < 6.0) - railties (>= 4.2.0, < 6.0) + responders (3.0.0) + actionpack (>= 5.0) + railties (>= 5.0) rest-client (2.0.2) http-cookie (>= 1.0.2, < 2.0) mime-types (>= 1.16, < 4.0) diff --git a/app/controllers/concerns/create_avis_concern.rb b/app/controllers/concerns/create_avis_concern.rb index 6f583c552..e7c34495c 100644 --- a/app/controllers/concerns/create_avis_concern.rb +++ b/app/controllers/concerns/create_avis_concern.rb @@ -36,7 +36,7 @@ module CreateAvisConcern if failed.any? flash.now.alert = failed - .select { |avis| avis.errors.present? } + .filter { |avis| avis.errors.present? } .map { |avis| "#{avis.email} : #{avis.errors.full_messages.join(', ')}" } # When an error occurs, return the avis back to the controller diff --git a/app/controllers/instructeurs/procedures_controller.rb b/app/controllers/instructeurs/procedures_controller.rb index 3a826e5af..6b04eb4ed 100644 --- a/app/controllers/instructeurs/procedures_controller.rb +++ b/app/controllers/instructeurs/procedures_controller.rb @@ -76,7 +76,7 @@ module Instructeurs if @current_filters.count > 0 filtered_ids = procedure_presentation.filtered_ids(@dossiers, statut) - filtered_sorted_ids = sorted_ids.select { |id| filtered_ids.include?(id) } + filtered_sorted_ids = sorted_ids.filter { |id| filtered_ids.include?(id) } else filtered_sorted_ids = sorted_ids end diff --git a/app/controllers/root_controller.rb b/app/controllers/root_controller.rb index 78661a349..253e439e1 100644 --- a/app/controllers/root_controller.rb +++ b/app/controllers/root_controller.rb @@ -24,11 +24,11 @@ class RootController < ApplicationController .map.with_index { |type_de_champ, i| type_de_champ.champ.build(id: i) } all_champs - .select { |champ| champ.type_champ == TypeDeChamp.type_champs.fetch(:header_section) } + .filter { |champ| champ.type_champ == TypeDeChamp.type_champs.fetch(:header_section) } .each { |champ| champ.type_de_champ.libelle = 'un super titre de section' } all_champs - .select { |champ| [TypeDeChamp.type_champs.fetch(:drop_down_list), TypeDeChamp.type_champs.fetch(:multiple_drop_down_list)].include?(champ.type_champ) } + .filter { |champ| [TypeDeChamp.type_champs.fetch(:drop_down_list), TypeDeChamp.type_champs.fetch(:multiple_drop_down_list)].include?(champ.type_champ) } .each do |champ| champ.type_de_champ.drop_down_list = DropDownList.new(type_de_champ: champ.type_de_champ) champ.drop_down_list.value = @@ -47,7 +47,7 @@ class RootController < ApplicationController type_champ_values.each do |(type_champ, value)| all_champs - .select { |champ| champ.type_champ == type_champ } + .filter { |champ| champ.type_champ == type_champ } .each { |champ| champ.value = value } end diff --git a/app/controllers/stats_controller.rb b/app/controllers/stats_controller.rb index f5563e8a5..89f3e211f 100644 --- a/app/controllers/stats_controller.rb +++ b/app/controllers/stats_controller.rb @@ -356,7 +356,7 @@ class StatsController < ApplicationController if weekly_dossiers_count == 0 result = 0 else - weekly_dossier_with_avis_count = weekly_dossiers.select { |dossier| dossier.avis.present? }.count + weekly_dossier_with_avis_count = weekly_dossiers.filter { |dossier| dossier.avis.present? }.count result = percentage(weekly_dossier_with_avis_count, weekly_dossiers_count) end diff --git a/app/controllers/users/demarches_controller.rb b/app/controllers/users/demarches_controller.rb index 45f0fd7f4..02df95a8a 100644 --- a/app/controllers/users/demarches_controller.rb +++ b/app/controllers/users/demarches_controller.rb @@ -6,7 +6,7 @@ module Users .includes(:procedure) .map(&:procedure) .uniq - .select(&:publiee?) + .filter(&:publiee?) @popular_demarches = Procedure .includes(:service) diff --git a/app/models/champ.rb b/app/models/champ.rb index 4c091e04f..b67164328 100644 --- a/app/models/champ.rb +++ b/app/models/champ.rb @@ -54,6 +54,10 @@ class Champ < ApplicationRecord value end + def for_tag + value.present? ? value.to_s : '' + end + def main_value_name :value end diff --git a/app/models/champs/carte_champ.rb b/app/models/champs/carte_champ.rb index cb11520e6..a12792cc6 100644 --- a/app/models/champs/carte_champ.rb +++ b/app/models/champs/carte_champ.rb @@ -2,19 +2,19 @@ class Champs::CarteChamp < Champ # We are not using scopes here as we want to access # the following collections on unsaved records. def cadastres - geo_areas.select do |area| + geo_areas.filter do |area| area.source == GeoArea.sources.fetch(:cadastre) end end def quartiers_prioritaires - geo_areas.select do |area| + geo_areas.filter do |area| area.source == GeoArea.sources.fetch(:quartier_prioritaire) end end def parcelles_agricoles - geo_areas.select do |area| + geo_areas.filter do |area| area.source == GeoArea.sources.fetch(:parcelle_agricole) end end diff --git a/app/models/champs/date_champ.rb b/app/models/champs/date_champ.rb index 0fd0a2499..309091603 100644 --- a/app/models/champs/date_champ.rb +++ b/app/models/champs/date_champ.rb @@ -9,6 +9,10 @@ class Champs::DateChamp < Champ value.present? ? I18n.l(Date.parse(value)) : "" end + def for_tag + value.present? ? I18n.l(Date.parse(value)) : "" + end + private def format_before_save diff --git a/app/models/champs/datetime_champ.rb b/app/models/champs/datetime_champ.rb index c98377d15..84008894b 100644 --- a/app/models/champs/datetime_champ.rb +++ b/app/models/champs/datetime_champ.rb @@ -9,6 +9,10 @@ class Champs::DatetimeChamp < Champ value.present? ? I18n.l(Time.zone.parse(value)) : "" end + def for_tag + value.present? ? I18n.l(Time.zone.parse(value)) : "" + end + private def format_before_save diff --git a/app/models/champs/linked_drop_down_list_champ.rb b/app/models/champs/linked_drop_down_list_champ.rb index d28b3004f..46011439c 100644 --- a/app/models/champs/linked_drop_down_list_champ.rb +++ b/app/models/champs/linked_drop_down_list_champ.rb @@ -30,7 +30,11 @@ class Champs::LinkedDropDownListChamp < Champ end def to_s - value.present? ? [primary_value, secondary_value].select(&:present?).join(' / ') : "" + value.present? ? [primary_value, secondary_value].filter(&:present?).join(' / ') : "" + end + + def for_tag + value.present? ? [primary_value, secondary_value].filter(&:present?).join(' / ') : "" end def for_export diff --git a/app/models/champs/multiple_drop_down_list_champ.rb b/app/models/champs/multiple_drop_down_list_champ.rb index ef72e07b4..ff120ac23 100644 --- a/app/models/champs/multiple_drop_down_list_champ.rb +++ b/app/models/champs/multiple_drop_down_list_champ.rb @@ -13,6 +13,10 @@ class Champs::MultipleDropDownListChamp < Champ selected_options.join(', ') end + def for_tag + selected_options.join(', ') + end + def for_export value.present? ? selected_options.join(', ') : nil end diff --git a/app/models/champs/pays_champ.rb b/app/models/champs/pays_champ.rb index 78de3277f..6f916dbce 100644 --- a/app/models/champs/pays_champ.rb +++ b/app/models/champs/pays_champ.rb @@ -4,6 +4,6 @@ class Champs::PaysChamp < Champs::TextChamp end def self.disabled_options - pays.select { |v| (v =~ /^--.*--$/).present? } + pays.filter { |v| (v =~ /^--.*--$/).present? } end end diff --git a/app/models/champs/repetition_champ.rb b/app/models/champs/repetition_champ.rb index 4d95e574d..9296dbdca 100644 --- a/app/models/champs/repetition_champ.rb +++ b/app/models/champs/repetition_champ.rb @@ -19,6 +19,14 @@ class Champs::RepetitionChamp < Champ # The user cannot enter any information here so it doesn’t make much sense to search end + def for_tag + ([libelle] + rows.map do |champs| + champs.map do |champ| + "#{champ.libelle} : #{champ}" + end.join("\n") + end).join("\n\n") + end + def rows_for_export rows.each.with_index(1).map do |champs, index| Champs::RepetitionChamp::Row.new(index: index, dossier_id: dossier_id.to_s, champs: champs) diff --git a/app/models/champs/yes_no_champ.rb b/app/models/champs/yes_no_champ.rb index 4f82a406b..6ba7534b7 100644 --- a/app/models/champs/yes_no_champ.rb +++ b/app/models/champs/yes_no_champ.rb @@ -9,6 +9,10 @@ class Champs::YesNoChamp < Champ processed_value end + def for_tag + processed_value + end + def for_export processed_value end diff --git a/app/models/concerns/tags_substitution_concern.rb b/app/models/concerns/tags_substitution_concern.rb index 537cd46ba..1410f4479 100644 --- a/app/models/concerns/tags_substitution_concern.rb +++ b/app/models/concerns/tags_substitution_concern.rb @@ -179,7 +179,7 @@ module TagsSubstitutionConcern raise NameError.new("The class #{self.class.name} includes TagsSubstitutionConcern, it should define the DOSSIER_STATE constant but it does not", :DOSSIER_STATE) end - tags.select { |tag| tag[:available_for_states].include?(self.class::DOSSIER_STATE) } + tags.filter { |tag| tag[:available_for_states].include?(self.class::DOSSIER_STATE) } end def champ_public_tags @@ -213,12 +213,12 @@ module TagsSubstitutionConcern tags_and_datas .map { |(tags, data)| [filter_tags(tags), data] } - .inject(text) { |acc, (tags, data)| replace_tags_with_values_from_data(acc, tags, data) } + .reduce(text) { |acc, (tags, data)| replace_tags_with_values_from_data(acc, tags, data) } end def replace_tags_with_values_from_data(text, tags, data) if data.present? - tags.inject(text) do |acc, tag| + tags.reduce(text) do |acc, tag| replace_tag(acc, tag, data) end else diff --git a/app/models/dossier.rb b/app/models/dossier.rb index c4768edf1..c1e11a3a3 100644 --- a/app/models/dossier.rb +++ b/app/models/dossier.rb @@ -426,15 +426,15 @@ class Dossier < ApplicationRecord end def check_mandatory_champs - (champs + champs.select(&:repetition?).flat_map(&:champs)) - .select(&:mandatory_and_blank?) + (champs + champs.filter(&:repetition?).flat_map(&:champs)) + .filter(&:mandatory_and_blank?) .map do |champ| "Le champ #{champ.libelle.truncate(200)} doit être rempli." end end def modifier_annotations!(instructeur) - champs_private.select(&:value_previously_changed?).each do |champ| + champs_private.filter(&:value_previously_changed?).each do |champ| log_dossier_operation(instructeur, :modifier_annotation, champ) end end diff --git a/app/models/drop_down_list.rb b/app/models/drop_down_list.rb index fc9451ecf..993bf0e04 100644 --- a/app/models/drop_down_list.rb +++ b/app/models/drop_down_list.rb @@ -9,7 +9,7 @@ class DropDownList < ApplicationRecord end def disabled_options - options.select { |v| (v =~ /^--.*--$/).present? } + options.filter { |v| (v =~ /^--.*--$/).present? } end def multiple diff --git a/app/models/instructeur.rb b/app/models/instructeur.rb index d9fd18dc9..baa45513d 100644 --- a/app/models/instructeur.rb +++ b/app/models/instructeur.rb @@ -74,7 +74,7 @@ class Instructeur < ApplicationRecord active_procedure_overviews = procedures .publiees .map { |procedure| procedure.procedure_overview(start_date) } - .select(&:had_some_activities?) + .filter(&:had_some_activities?) if active_procedure_overviews.count == 0 nil diff --git a/app/models/types_de_champ/linked_drop_down_list_type_de_champ.rb b/app/models/types_de_champ/linked_drop_down_list_type_de_champ.rb index 3b6e32ad8..71f0784b1 100644 --- a/app/models/types_de_champ/linked_drop_down_list_type_de_champ.rb +++ b/app/models/types_de_champ/linked_drop_down_list_type_de_champ.rb @@ -30,7 +30,7 @@ class TypesDeChamp::LinkedDropDownListTypeDeChamp < TypesDeChamp::TypeDeChampBas description: "#{description} (menu primaire)", lambda: -> (champs) { champs - .detect { |champ| champ.type_de_champ == tdc } + .find { |champ| champ.type_de_champ == tdc } &.primary_value } } @@ -41,7 +41,7 @@ class TypesDeChamp::LinkedDropDownListTypeDeChamp < TypesDeChamp::TypeDeChampBas description: "#{description} (menu secondaire)", lambda: -> (champs) { champs - .detect { |champ| champ.type_de_champ == tdc } + .find { |champ| champ.type_de_champ == tdc } &.secondary_value } } diff --git a/app/models/types_de_champ/type_de_champ_base.rb b/app/models/types_de_champ/type_de_champ_base.rb index 8d808df2a..7c25fc5bf 100644 --- a/app/models/types_de_champ/type_de_champ_base.rb +++ b/app/models/types_de_champ/type_de_champ_base.rb @@ -14,7 +14,7 @@ class TypesDeChamp::TypeDeChampBase libelle: libelle, description: description, lambda: -> (champs) { - champs.detect { |champ| champ.type_de_champ == tdc } + champs.find { |champ| champ.type_de_champ == tdc }&.for_tag } } ] diff --git a/app/services/administrateur_usage_statistics_service.rb b/app/services/administrateur_usage_statistics_service.rb index d7351e859..47a76c249 100644 --- a/app/services/administrateur_usage_statistics_service.rb +++ b/app/services/administrateur_usage_statistics_service.rb @@ -39,7 +39,7 @@ class AdministrateurUsageStatisticsService ds_nb_demarches_brouillons: nb_demarches_by_administrateur_id_and_state[[administrateur.id, "brouillon"]], nb_demarches_test: nb_dossiers_by_procedure_id - .select { |procedure_id, count| count > 0 && is_brouillon(procedure_id) } + .filter { |procedure_id, count| count > 0 && is_brouillon(procedure_id) } .count, nb_demarches_prod: nb_dossiers_by_procedure_id .reject { |procedure_id, count| count == 0 || is_brouillon(procedure_id) } diff --git a/app/services/pieces_justificatives_service.rb b/app/services/pieces_justificatives_service.rb index ea7475d17..cf834fe92 100644 --- a/app/services/pieces_justificatives_service.rb +++ b/app/services/pieces_justificatives_service.rb @@ -1,7 +1,7 @@ class PiecesJustificativesService def self.liste_pieces_justificatives(dossier) champs_blocs_repetables = dossier.champs - .select { |c| c.type_champ == TypeDeChamp.type_champs.fetch(:repetition) } + .filter { |c| c.type_champ == TypeDeChamp.type_champs.fetch(:repetition) } .flat_map(&:champs) champs_pieces_justificatives_with_attachments( @@ -15,7 +15,7 @@ class PiecesJustificativesService end def self.serialize_types_de_champ_as_type_pj(procedure) - tdcs = procedure.types_de_champ.select { |type_champ| type_champ.old_pj.present? } + tdcs = procedure.types_de_champ.filter { |type_champ| type_champ.old_pj.present? } tdcs.map.with_index do |type_champ, order_place| description = type_champ.description if /^(?.*?)(?:[\r\n]+)Récupérer le formulaire vierge pour mon dossier : (?http.*)$/m =~ description @@ -32,7 +32,7 @@ class PiecesJustificativesService end def self.serialize_champs_as_pjs(dossier) - dossier.champs.select { |champ| champ.type_de_champ.old_pj }.map do |champ| + dossier.champs.filter { |champ| champ.type_de_champ.old_pj }.map do |champ| { created_at: champ.created_at&.in_time_zone('UTC'), type_de_piece_justificative_id: champ.type_de_champ.old_pj[:stable_id], @@ -46,7 +46,7 @@ class PiecesJustificativesService def self.champs_pieces_justificatives_with_attachments(champs) champs - .select { |c| c.type_champ == TypeDeChamp.type_champs.fetch(:piece_justificative) } + .filter { |c| c.type_champ == TypeDeChamp.type_champs.fetch(:piece_justificative) } .filter { |pj| pj.piece_justificative_file.attached? } end end diff --git a/app/services/procedure_export_service.rb b/app/services/procedure_export_service.rb index e308a5f69..e4bf53727 100644 --- a/app/services/procedure_export_service.rb +++ b/app/services/procedure_export_service.rb @@ -122,7 +122,7 @@ class ProcedureExportService @etablissements = @dossiers.flat_map do |dossier| [dossier.champs, dossier.champs_private] .flatten - .select { |champ| champ.is_a?(Champs::SiretChamp) } + .filter { |champ| champ.is_a?(Champs::SiretChamp) } end.map(&:etablissement).compact if @etablissements.any? diff --git a/app/services/procedure_export_v2_service.rb b/app/services/procedure_export_v2_service.rb index f29a5b1d2..0d7d3b74c 100644 --- a/app/services/procedure_export_v2_service.rb +++ b/app/services/procedure_export_v2_service.rb @@ -40,7 +40,7 @@ class ProcedureExportV2Service @etablissements ||= dossiers.flat_map do |dossier| [dossier.champs, dossier.champs_private] .flatten - .select { |champ| champ.is_a?(Champs::SiretChamp) } + .filter { |champ| champ.is_a?(Champs::SiretChamp) } end.map(&:etablissement).compact + dossiers.map(&:etablissement).compact end @@ -52,7 +52,7 @@ class ProcedureExportV2Service @champs_repetables ||= dossiers.flat_map do |dossier| [dossier.champs, dossier.champs_private] .flatten - .select { |champ| champ.is_a?(Champs::RepetitionChamp) } + .filter { |champ| champ.is_a?(Champs::RepetitionChamp) } end.group_by(&:libelle) end diff --git a/app/services/zxcvbn_service.rb b/app/services/zxcvbn_service.rb index 5b0caa762..0b11d4135 100644 --- a/app/services/zxcvbn_service.rb +++ b/app/services/zxcvbn_service.rb @@ -7,7 +7,7 @@ class ZxcvbnService wxcvbn = compute_zxcvbn score = wxcvbn.score length = @password.blank? ? 0 : @password.length - vulnerabilities = wxcvbn.match_sequence.map { |m| m.matched_word.nil? ? m.token : m.matched_word }.select { |s| s.length > 2 }.join(', ') + vulnerabilities = wxcvbn.match_sequence.map { |m| m.matched_word.nil? ? m.token : m.matched_word }.filter { |s| s.length > 2 }.join(', ') [score, vulnerabilities, length] end diff --git a/config/initializers/flipper.rb b/config/initializers/flipper.rb index f50fb3a8f..dee6e022e 100644 --- a/config/initializers/flipper.rb +++ b/config/initializers/flipper.rb @@ -16,12 +16,10 @@ end # this will immediately migrate the default features to be controlled. def setup_features(features) features.each do |feature| - if Flipper.exist?(feature) - return + if !Flipper.exist?(feature) + # Disable feature by default + Flipper.disable(feature) end - - # Disable feature by default - Flipper.disable(feature) end end @@ -39,8 +37,15 @@ features = [ :xray ] +def database_exists? + ActiveRecord::Base.connection + true +rescue ActiveRecord::NoDatabaseError + false +end + ActiveSupport.on_load(:active_record) do - if ActiveRecord::Base.connection.data_source_exists? 'flipper_features' + if database_exists? && ActiveRecord::Base.connection.data_source_exists?('flipper_features') setup_features(features) end end diff --git a/db/migrate/20150623121437_create_dossiers.rb b/db/migrate/20150623121437_create_dossiers.rb deleted file mode 100644 index a6fb336c6..000000000 --- a/db/migrate/20150623121437_create_dossiers.rb +++ /dev/null @@ -1,7 +0,0 @@ -class CreateDossiers < ActiveRecord::Migration - def change - create_table :dossiers do |t| - t.string :description - end - end -end diff --git a/db/migrate/20150623122513_create_entreprise.rb b/db/migrate/20150623122513_create_entreprise.rb deleted file mode 100644 index fff62fd73..000000000 --- a/db/migrate/20150623122513_create_entreprise.rb +++ /dev/null @@ -1,19 +0,0 @@ -class CreateEntreprise < ActiveRecord::Migration - def change - create_table :entreprises do |t| - t.string :siren - t.integer :capital_social - t.string :numero_tva_intracommunautaire - t.string :forme_juridique - t.string :forme_juridique_code - t.string :nom_commercial - t.string :raison_sociale - t.string :siret_siege_social - t.string :code_effectif_entreprise - t.integer :date_creation - t.string :nom - t.string :prenom - end - add_reference :entreprises, :dossier, references: :dossiers - end -end diff --git a/db/migrate/20150623123033_create_etablissements.rb b/db/migrate/20150623123033_create_etablissements.rb deleted file mode 100644 index 639867e02..000000000 --- a/db/migrate/20150623123033_create_etablissements.rb +++ /dev/null @@ -1,20 +0,0 @@ -class CreateEtablissements < ActiveRecord::Migration - def change - create_table :etablissements do |t| - t.string :siret - t.boolean :siege_social - t.string :naf - t.string :libelle_naf - t.string :adresse - t.string :numero_voie - t.string :type_voie - t.string :nom_voie - t.string :complement_adresse - t.string :code_postal - t.string :localite - t.string :code_insee_localite - end - add_reference :etablissements, :dossier, references: :dossiers - add_reference :etablissements, :entreprise, references: :entreprises - end -end diff --git a/db/migrate/20150624134202_add_autorisation_donnees_to_dossiers.rb b/db/migrate/20150624134202_add_autorisation_donnees_to_dossiers.rb deleted file mode 100644 index 7034f4f6d..000000000 --- a/db/migrate/20150624134202_add_autorisation_donnees_to_dossiers.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddAutorisationDonneesToDossiers < ActiveRecord::Migration - def change - add_column :dossiers, :autorisation_donnees, :boolean - end -end diff --git a/db/migrate/20150624145400_add_position_to_dossiers.rb b/db/migrate/20150624145400_add_position_to_dossiers.rb deleted file mode 100644 index 1df94330a..000000000 --- a/db/migrate/20150624145400_add_position_to_dossiers.rb +++ /dev/null @@ -1,6 +0,0 @@ -class AddPositionToDossiers < ActiveRecord::Migration - def change - add_column :dossiers, :position_lat, :string - add_column :dossiers, :position_lon, :string - end -end diff --git a/db/migrate/20150625130851_add_ref_dossier_to_dossiers.rb b/db/migrate/20150625130851_add_ref_dossier_to_dossiers.rb deleted file mode 100644 index a20e1e344..000000000 --- a/db/migrate/20150625130851_add_ref_dossier_to_dossiers.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddRefDossierToDossiers < ActiveRecord::Migration - def change - add_column :dossiers, :ref_dossier, :string - end -end diff --git a/db/migrate/20150626081655_create_dossier_pdfs.rb b/db/migrate/20150626081655_create_dossier_pdfs.rb deleted file mode 100644 index ca256c842..000000000 --- a/db/migrate/20150626081655_create_dossier_pdfs.rb +++ /dev/null @@ -1,8 +0,0 @@ -class CreateDossierPdfs < ActiveRecord::Migration - def change - create_table :dossier_pdfs do |t| - t.string :ref_dossier_pdf - end - add_reference :dossier_pdfs, :dossier, references: :dossiers - end -end diff --git a/db/migrate/20150630123827_add_details_projet_to_dossiers.rb b/db/migrate/20150630123827_add_details_projet_to_dossiers.rb deleted file mode 100644 index 89404c95d..000000000 --- a/db/migrate/20150630123827_add_details_projet_to_dossiers.rb +++ /dev/null @@ -1,10 +0,0 @@ -class AddDetailsProjetToDossiers < ActiveRecord::Migration - def change - add_column :dossiers, :nom_projet, :string - add_column :dossiers, :montant_projet, :string - add_column :dossiers, :montant_aide_demande, :string - add_column :dossiers, :date_previsionnelle, :string - add_column :dossiers, :lien_plus_infos, :string - add_column :dossiers, :mail_contact, :string - end -end diff --git a/db/migrate/20150728140340_devise_create_users.rb b/db/migrate/20150728140340_devise_create_users.rb deleted file mode 100644 index 7fd2ccc33..000000000 --- a/db/migrate/20150728140340_devise_create_users.rb +++ /dev/null @@ -1,41 +0,0 @@ -class DeviseCreateUsers < ActiveRecord::Migration - def change - create_table(:users) do |t| - ## Database authenticatable - t.string :email, null: false, default: "" - t.string :encrypted_password, null: false, default: "" - - ## Recoverable - t.string :reset_password_token - t.datetime :reset_password_sent_at - - ## Rememberable - t.datetime :remember_created_at - - ## Trackable - 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 - t.string :last_sign_in_ip - - ## Confirmable - # t.string :confirmation_token - # t.datetime :confirmed_at - # t.datetime :confirmation_sent_at - # t.string :unconfirmed_email # Only if using reconfirmable - - ## Lockable - # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts - # t.string :unlock_token # Only if unlock strategy is :email or :both - # t.datetime :locked_at - - t.timestamps - end - - add_index :users, :email, unique: true - add_index :users, :reset_password_token, unique: true - # add_index :users, :confirmation_token, unique: true - # add_index :users, :unlock_token, unique: true - end -end diff --git a/db/migrate/20150731121101_devise_create_pros.rb b/db/migrate/20150731121101_devise_create_pros.rb deleted file mode 100644 index ff1dca742..000000000 --- a/db/migrate/20150731121101_devise_create_pros.rb +++ /dev/null @@ -1,41 +0,0 @@ -class DeviseCreatePros < ActiveRecord::Migration - def change - create_table(:pros) do |t| - ## Database authenticatable - t.string :email, null: false, default: "" - t.string :encrypted_password, null: false, default: "" - - ## Recoverable - t.string :reset_password_token - t.datetime :reset_password_sent_at - - ## Rememberable - t.datetime :remember_created_at - - ## Trackable - 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 - t.string :last_sign_in_ip - - ## Confirmable - # t.string :confirmation_token - # t.datetime :confirmed_at - # t.datetime :confirmation_sent_at - # t.string :unconfirmed_email # Only if using reconfirmable - - ## Lockable - # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts - # t.string :unlock_token # Only if unlock strategy is :email or :both - # t.datetime :locked_at - - t.timestamps - end - - add_index :pros, :email, unique: true - add_index :pros, :reset_password_token, unique: true - # add_index :pros, :confirmation_token, unique: true - # add_index :pros, :unlock_token, unique: true - end -end diff --git a/db/migrate/20150804131511_create_commentaires.rb b/db/migrate/20150804131511_create_commentaires.rb deleted file mode 100644 index 61583e53d..000000000 --- a/db/migrate/20150804131511_create_commentaires.rb +++ /dev/null @@ -1,13 +0,0 @@ -class CreateCommentaires < ActiveRecord::Migration - def change - create_table :commentaires do |t| - t.string :email - t.date :created_at - t.string :body - t.references :dossier, index: true - - t.timestamps null: false - end - add_foreign_key :commentaires, :dossiers - end -end diff --git a/db/migrate/20150805081131_add_dossier_termine_to_dossiers.rb b/db/migrate/20150805081131_add_dossier_termine_to_dossiers.rb deleted file mode 100644 index 3953e3050..000000000 --- a/db/migrate/20150805081131_add_dossier_termine_to_dossiers.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddDossierTermineToDossiers < ActiveRecord::Migration - def change - add_column :dossiers, :dossier_termine, :boolean - end -end diff --git a/db/migrate/20150806071130_create_evenement_vies.rb b/db/migrate/20150806071130_create_evenement_vies.rb deleted file mode 100644 index 08d95d2db..000000000 --- a/db/migrate/20150806071130_create_evenement_vies.rb +++ /dev/null @@ -1,9 +0,0 @@ -class CreateEvenementVies < ActiveRecord::Migration - def change - create_table :evenement_vies do |t| - t.string :nom - - t.timestamps null: false - end - end -end diff --git a/db/migrate/20150806072031_add_use_admi_facile_to_evenement_vie.rb b/db/migrate/20150806072031_add_use_admi_facile_to_evenement_vie.rb deleted file mode 100644 index 926a9b8ab..000000000 --- a/db/migrate/20150806072031_add_use_admi_facile_to_evenement_vie.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddUseAdmiFacileToEvenementVie < ActiveRecord::Migration - def change - add_column :evenement_vies, :use_admi_facile, :boolean - end -end diff --git a/db/migrate/20150806075144_create_ref_pieces_jointes.rb b/db/migrate/20150806075144_create_ref_pieces_jointes.rb deleted file mode 100644 index 789bc08b3..000000000 --- a/db/migrate/20150806075144_create_ref_pieces_jointes.rb +++ /dev/null @@ -1,17 +0,0 @@ -class CreateRefPiecesJointes < ActiveRecord::Migration - def change - create_table :ref_pieces_jointes do |t| - t.string :CERFA - t.string :nature - t.string :libelle_complet - t.string :etablissement - t.string :libelle - t.string :description - t.string :demarche - t.string :administration_emetrice - t.boolean :api_entreprise - - t.timestamps null: false - end - end -end diff --git a/db/migrate/20150806132417_create_ref_formulaires.rb b/db/migrate/20150806132417_create_ref_formulaires.rb deleted file mode 100644 index 2a27ab49e..000000000 --- a/db/migrate/20150806132417_create_ref_formulaires.rb +++ /dev/null @@ -1,21 +0,0 @@ -class CreateRefFormulaires < ActiveRecord::Migration - def change - create_table :ref_formulaires do |t| - t.string :ref_demarche - t.string :nom - t.string :objet - t.string :ministere - t.string :cigle_ministere - t.string :direction - t.string :evenement_vie - t.string :publics - t.string :lien_demarche - t.string :lien_fiche_signaletique - t.string :lien_notice - t.string :categorie - t.boolean :mail_pj - - t.timestamps null: false - end - end -end diff --git a/db/migrate/20150806155734_add_use_admi_facile_to_ref_formulaire.rb b/db/migrate/20150806155734_add_use_admi_facile_to_ref_formulaire.rb deleted file mode 100644 index af70d7110..000000000 --- a/db/migrate/20150806155734_add_use_admi_facile_to_ref_formulaire.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddUseAdmiFacileToRefFormulaire < ActiveRecord::Migration - def change - add_column :ref_formulaires, :use_admi_facile, :boolean - end -end diff --git a/db/migrate/20150806162353_add_ref_formulaire_to_dossier.rb b/db/migrate/20150806162353_add_ref_formulaire_to_dossier.rb deleted file mode 100644 index 6aba2a62d..000000000 --- a/db/migrate/20150806162353_add_ref_formulaire_to_dossier.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddRefFormulaireToDossier < ActiveRecord::Migration - def change - add_column :dossiers, :ref_formulaire, :string - end -end diff --git a/db/migrate/20150810130957_add_ref_pieces_jointes_ref_to_dossier_pdf.rb b/db/migrate/20150810130957_add_ref_pieces_jointes_ref_to_dossier_pdf.rb deleted file mode 100644 index c7c739315..000000000 --- a/db/migrate/20150810130957_add_ref_pieces_jointes_ref_to_dossier_pdf.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddRefPiecesJointesRefToDossierPdf < ActiveRecord::Migration - def change - add_reference :dossier_pdfs, :ref_pieces_jointes, index: true - end -end diff --git a/db/migrate/20150812091703_fix_ref_formulaire_to_dossier.rb b/db/migrate/20150812091703_fix_ref_formulaire_to_dossier.rb deleted file mode 100644 index fa9b7ef54..000000000 --- a/db/migrate/20150812091703_fix_ref_formulaire_to_dossier.rb +++ /dev/null @@ -1,6 +0,0 @@ -class FixRefFormulaireToDossier < ActiveRecord::Migration - def change - remove_column :dossiers, :ref_formulaire, :integer - add_reference :dossiers, :ref_formulaire, index: true - end -end diff --git a/db/migrate/20150813095218_rename_ref_dossier_pdf_into_content.rb b/db/migrate/20150813095218_rename_ref_dossier_pdf_into_content.rb deleted file mode 100644 index a1566f4f8..000000000 --- a/db/migrate/20150813095218_rename_ref_dossier_pdf_into_content.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RenameRefDossierPdfIntoContent < ActiveRecord::Migration - def change - rename_column :dossier_pdfs, :ref_dossier_pdf, :content - end -end diff --git a/db/migrate/20150813095939_rename_dossier_pdfintof_piece_jointe.rb b/db/migrate/20150813095939_rename_dossier_pdfintof_piece_jointe.rb deleted file mode 100644 index 17f80be02..000000000 --- a/db/migrate/20150813095939_rename_dossier_pdfintof_piece_jointe.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RenameDossierPdfintofPieceJointe < ActiveRecord::Migration - def change - rename_table :dossier_pdfs, :pieces_jointes - end -end diff --git a/db/migrate/20150814090717_rename_ref_piece_joint_to_type_piece_jointe.rb b/db/migrate/20150814090717_rename_ref_piece_joint_to_type_piece_jointe.rb deleted file mode 100644 index 57de19646..000000000 --- a/db/migrate/20150814090717_rename_ref_piece_joint_to_type_piece_jointe.rb +++ /dev/null @@ -1,6 +0,0 @@ -class RenameRefPieceJointToTypePieceJointe < ActiveRecord::Migration - def change - rename_table :ref_pieces_jointes, :types_piece_jointe - rename_column :pieces_jointes, :ref_pieces_jointes_id, :type_piece_jointe_id - end -end diff --git a/db/migrate/20150814101012_rename_ref_formulaire_into_formulaire.rb b/db/migrate/20150814101012_rename_ref_formulaire_into_formulaire.rb deleted file mode 100644 index 96060f894..000000000 --- a/db/migrate/20150814101012_rename_ref_formulaire_into_formulaire.rb +++ /dev/null @@ -1,6 +0,0 @@ -class RenameRefFormulaireIntoFormulaire < ActiveRecord::Migration - def change - rename_table :ref_formulaires, :formulaires - rename_column :dossiers, :ref_formulaire_id, :formulaire_id - end -end diff --git a/db/migrate/20150814120635_add_formulaire_id_to_type_piece_jointe.rb b/db/migrate/20150814120635_add_formulaire_id_to_type_piece_jointe.rb deleted file mode 100644 index 0dc4c95bf..000000000 --- a/db/migrate/20150814120635_add_formulaire_id_to_type_piece_jointe.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddFormulaireIdToTypePieceJointe < ActiveRecord::Migration - def change - add_column :types_piece_jointe, :formulaire_id, :integer - end -end diff --git a/db/migrate/20150814121848_rename_ref_demarche_into_demarche_id.rb b/db/migrate/20150814121848_rename_ref_demarche_into_demarche_id.rb deleted file mode 100644 index b7de359ac..000000000 --- a/db/migrate/20150814121848_rename_ref_demarche_into_demarche_id.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RenameRefDemarcheIntoDemarcheId < ActiveRecord::Migration - def change - rename_column :formulaires, :ref_demarche, :demarche_id - end -end diff --git a/db/migrate/20150814122208_link_type_piece_jointe_to_formulaire.rb b/db/migrate/20150814122208_link_type_piece_jointe_to_formulaire.rb deleted file mode 100644 index e1392c812..000000000 --- a/db/migrate/20150814122208_link_type_piece_jointe_to_formulaire.rb +++ /dev/null @@ -1,8 +0,0 @@ -class LinkTypePieceJointeToFormulaire < ActiveRecord::Migration - # def up - # TypePieceJointe.find_each do |type_piece_jointe| - # forms = Formulaire.find_by_demarche_id(type_piece_jointe.CERFA) - # type_piece_jointe.update(formulaire_id: forms.id) if forms.present? - # end - # end -end diff --git a/db/migrate/20150814124735_rename_evenement_vie_from_demarche_into_evenement_vie_id.rb b/db/migrate/20150814124735_rename_evenement_vie_from_demarche_into_evenement_vie_id.rb deleted file mode 100644 index d36541b3b..000000000 --- a/db/migrate/20150814124735_rename_evenement_vie_from_demarche_into_evenement_vie_id.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RenameEvenementVieFromDemarcheIntoEvenementVieId < ActiveRecord::Migration - def change - rename_column :formulaires, :evenement_vie, :evenement_vie_id - end -end diff --git a/db/migrate/20150818113123_create_cerfas.rb b/db/migrate/20150818113123_create_cerfas.rb deleted file mode 100644 index 301204947..000000000 --- a/db/migrate/20150818113123_create_cerfas.rb +++ /dev/null @@ -1,9 +0,0 @@ -class CreateCerfas < ActiveRecord::Migration - def change - create_table :cerfas do |t| - t.string :content - t.references :dossier, index: true - end - add_foreign_key :cerfas, :dossiers - end -end diff --git a/db/migrate/20150824134012_change_date_previsionnel_data_type.rb b/db/migrate/20150824134012_change_date_previsionnel_data_type.rb deleted file mode 100644 index 6f568787f..000000000 --- a/db/migrate/20150824134012_change_date_previsionnel_data_type.rb +++ /dev/null @@ -1,6 +0,0 @@ -class ChangeDatePrevisionnelDataType < ActiveRecord::Migration - def change - remove_column :dossiers, :date_previsionnelle - add_column :dossiers, :date_previsionnelle, :date - end -end diff --git a/db/migrate/20150825083550_add_email_contact_to_formulaire.rb b/db/migrate/20150825083550_add_email_contact_to_formulaire.rb deleted file mode 100644 index d98a5ef23..000000000 --- a/db/migrate/20150825083550_add_email_contact_to_formulaire.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddEmailContactToFormulaire < ActiveRecord::Migration - def change - add_column :formulaires, :email_contact, :string - end -end diff --git a/db/migrate/20150918163159_devise_create_gestionnaires.rb b/db/migrate/20150918163159_devise_create_gestionnaires.rb deleted file mode 100644 index 218e5084a..000000000 --- a/db/migrate/20150918163159_devise_create_gestionnaires.rb +++ /dev/null @@ -1,41 +0,0 @@ -class DeviseCreateGestionnaires < ActiveRecord::Migration - def change - create_table(:gestionnaires) do |t| - ## Database authenticatable - t.string :email, null: false, default: "" - t.string :encrypted_password, null: false, default: "" - - ## Recoverable - t.string :reset_password_token - t.datetime :reset_password_sent_at - - ## Rememberable - t.datetime :remember_created_at - - ## Trackable - 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 - t.string :last_sign_in_ip - - ## Confirmable - # t.string :confirmation_token - # t.datetime :confirmed_at - # t.datetime :confirmation_sent_at - # t.string :unconfirmed_email # Only if using reconfirmable - - ## Lockable - # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts - # t.string :unlock_token # Only if unlock strategy is :email or :both - # t.datetime :locked_at - - t.timestamps - end - - add_index :gestionnaires, :email, unique: true - add_index :gestionnaires, :reset_password_token, unique: true - # add_index :gestionnaires, :confirmation_token, unique: true - # add_index :gestionnaires, :unlock_token, unique: true - end -end diff --git a/db/migrate/20150921085540_drop_evenement_vies_table.rb b/db/migrate/20150921085540_drop_evenement_vies_table.rb deleted file mode 100644 index 5a9325cdb..000000000 --- a/db/migrate/20150921085540_drop_evenement_vies_table.rb +++ /dev/null @@ -1,5 +0,0 @@ -class DropEvenementViesTable < ActiveRecord::Migration - def change - drop_table :evenement_vies - end -end diff --git a/db/migrate/20150921085754_rename_table_formulaire_to_procedure.rb b/db/migrate/20150921085754_rename_table_formulaire_to_procedure.rb deleted file mode 100644 index 808f4facd..000000000 --- a/db/migrate/20150921085754_rename_table_formulaire_to_procedure.rb +++ /dev/null @@ -1,20 +0,0 @@ -class RenameTableFormulaireToProcedure < ActiveRecord::Migration - def change - remove_column :formulaires, :demarche_id - remove_column :formulaires, :cigle_ministere - remove_column :formulaires, :evenement_vie_id - remove_column :formulaires, :publics - remove_column :formulaires, :lien_fiche_signaletique - remove_column :formulaires, :lien_notice - remove_column :formulaires, :categorie - remove_column :formulaires, :mail_pj - remove_column :formulaires, :email_contact - - rename_column :formulaires, :nom, :libelle - rename_column :formulaires, :objet, :description - rename_column :formulaires, :ministere, :organisation - rename_column :formulaires, :use_admi_facile, :test - - rename_table :formulaires, :procedures - end -end diff --git a/db/migrate/20150921092320_rename_piece_jointe_to_piece_justificatives.rb b/db/migrate/20150921092320_rename_piece_jointe_to_piece_justificatives.rb deleted file mode 100644 index 361b434eb..000000000 --- a/db/migrate/20150921092320_rename_piece_jointe_to_piece_justificatives.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RenamePieceJointeToPieceJustificatives < ActiveRecord::Migration - def change - rename_table :pieces_jointes, :pieces_justificatives - end -end diff --git a/db/migrate/20150921092536_rename_types_piece_jointe_to_types_de_piece_justificative.rb b/db/migrate/20150921092536_rename_types_piece_jointe_to_types_de_piece_justificative.rb deleted file mode 100644 index 8ecba9027..000000000 --- a/db/migrate/20150921092536_rename_types_piece_jointe_to_types_de_piece_justificative.rb +++ /dev/null @@ -1,16 +0,0 @@ -class RenameTypesPieceJointeToTypesDePieceJustificative < ActiveRecord::Migration - def change - remove_column :types_piece_jointe, :CERFA - remove_column :types_piece_jointe, :nature - remove_column :types_piece_jointe, :libelle_complet - remove_column :types_piece_jointe, :etablissement - remove_column :types_piece_jointe, :demarche - remove_column :types_piece_jointe, :administration_emetrice - - rename_column :types_piece_jointe, :formulaire_id, :procedure_id - - rename_table :types_piece_jointe, :types_de_piece_justificative - - rename_column :pieces_justificatives, :type_piece_jointe_id, :type_de_piece_justificative_id - end -end diff --git a/db/migrate/20150921101240_rename_formulaire_id_to_procedure_id.rb b/db/migrate/20150921101240_rename_formulaire_id_to_procedure_id.rb deleted file mode 100644 index 0ee42d860..000000000 --- a/db/migrate/20150921101240_rename_formulaire_id_to_procedure_id.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RenameFormulaireIdToProcedureId < ActiveRecord::Migration - def change - rename_column :dossiers, :formulaire_id, :procedure_id - end -end diff --git a/db/migrate/20150922082053_delete_table_users.rb b/db/migrate/20150922082053_delete_table_users.rb deleted file mode 100644 index 812229c4a..000000000 --- a/db/migrate/20150922082053_delete_table_users.rb +++ /dev/null @@ -1,5 +0,0 @@ -class DeleteTableUsers < ActiveRecord::Migration - def change - drop_table :users - end -end diff --git a/db/migrate/20150922082416_drop_table_pros.rb b/db/migrate/20150922082416_drop_table_pros.rb deleted file mode 100644 index edf6e6cd6..000000000 --- a/db/migrate/20150922082416_drop_table_pros.rb +++ /dev/null @@ -1,5 +0,0 @@ -class DropTablePros < ActiveRecord::Migration - def change - drop_table :pros - end -end diff --git a/db/migrate/20150922085811_add_time_stamp_to_dossier.rb b/db/migrate/20150922085811_add_time_stamp_to_dossier.rb deleted file mode 100644 index 6b7612dc7..000000000 --- a/db/migrate/20150922085811_add_time_stamp_to_dossier.rb +++ /dev/null @@ -1,6 +0,0 @@ -class AddTimeStampToDossier < ActiveRecord::Migration - def change - add_column :dossiers, :created_at, :datetime, default: Time.zone.now - add_column :dossiers, :updated_at, :datetime, default: Time.zone.now - end -end diff --git a/db/migrate/20150922110719_default_api_entreprise_at_false_to_type_de_piece_justificative.rb b/db/migrate/20150922110719_default_api_entreprise_at_false_to_type_de_piece_justificative.rb deleted file mode 100644 index 8fca922d2..000000000 --- a/db/migrate/20150922110719_default_api_entreprise_at_false_to_type_de_piece_justificative.rb +++ /dev/null @@ -1,5 +0,0 @@ -class DefaultAPIEntrepriseAtFalseToTypeDePieceJustificative < ActiveRecord::Migration - def change - change_column :types_de_piece_justificative, :api_entreprise, :boolean, :default => false - end -end diff --git a/db/migrate/20150922113504_change_attributs_to_dossier.rb b/db/migrate/20150922113504_change_attributs_to_dossier.rb deleted file mode 100644 index f0db034e6..000000000 --- a/db/migrate/20150922113504_change_attributs_to_dossier.rb +++ /dev/null @@ -1,8 +0,0 @@ -class ChangeAttributsToDossier < ActiveRecord::Migration - def change - remove_column :dossiers, :lien_plus_infos - remove_column :dossiers, :mail_contact - - rename_column :dossiers, :ref_dossier, :ref_dossier_carto - end -end diff --git a/db/migrate/20150922141000_add_state_to_dossier.rb b/db/migrate/20150922141000_add_state_to_dossier.rb deleted file mode 100644 index d5f1e60c0..000000000 --- a/db/migrate/20150922141000_add_state_to_dossier.rb +++ /dev/null @@ -1,6 +0,0 @@ -class AddStateToDossier < ActiveRecord::Migration - def change - remove_column :dossiers, :dossier_termine - add_column :dossiers, :state, :string - end -end diff --git a/db/migrate/20150922141232_create_users.rb b/db/migrate/20150922141232_create_users.rb deleted file mode 100644 index 3fd611f64..000000000 --- a/db/migrate/20150922141232_create_users.rb +++ /dev/null @@ -1,41 +0,0 @@ -class CreateUsers < ActiveRecord::Migration - def change - create_table(:users) do |t| - ## Database authenticatable - t.string :email, null: false, default: "" - t.string :encrypted_password, null: false, default: "" - - ## Recoverable - t.string :reset_password_token - t.datetime :reset_password_sent_at - - ## Rememberable - t.datetime :remember_created_at - - ## Trackable - 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 - t.string :last_sign_in_ip - - ## Confirmable - # t.string :confirmation_token - # t.datetime :confirmed_at - # t.datetime :confirmation_sent_at - # t.string :unconfirmed_email # Only if using reconfirmable - - ## Lockable - # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts - # t.string :unlock_token # Only if unlock strategy is :email or :both - # t.datetime :locked_at - - t.timestamps - end - - add_index :users, :email, unique: true - add_index :users, :reset_password_token, unique: true - # add_index :users, :confirmation_token, unique: true - # add_index :users, :unlock_token, unique: true - end -end diff --git a/db/migrate/20150923101000_add_user_to_dossier.rb b/db/migrate/20150923101000_add_user_to_dossier.rb deleted file mode 100644 index 0bf8685b4..000000000 --- a/db/migrate/20150923101000_add_user_to_dossier.rb +++ /dev/null @@ -1,6 +0,0 @@ -class AddUserToDossier < ActiveRecord::Migration - def change - add_reference :dossiers, :user, index: true - add_foreign_key :dossiers, :users - end -end diff --git a/db/migrate/20150928141512_add_use_api_carto_to_procedure.rb b/db/migrate/20150928141512_add_use_api_carto_to_procedure.rb deleted file mode 100644 index 620d52ed2..000000000 --- a/db/migrate/20150928141512_add_use_api_carto_to_procedure.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddUseAPICartoToProcedure < ActiveRecord::Migration - def change - add_column :procedures, :use_api_carto, :boolean, :default => false - end -end diff --git a/db/migrate/20151006155256_add_siret_to_user.rb b/db/migrate/20151006155256_add_siret_to_user.rb deleted file mode 100644 index 2e55c7a95..000000000 --- a/db/migrate/20151006155256_add_siret_to_user.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddSiretToUser < ActiveRecord::Migration - def change - add_column :users, :siret, :string - end -end diff --git a/db/migrate/20151007085022_add_login_with_france_connect_to_user.rb b/db/migrate/20151007085022_add_login_with_france_connect_to_user.rb deleted file mode 100644 index 77171fc5f..000000000 --- a/db/migrate/20151007085022_add_login_with_france_connect_to_user.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddLoginWithFranceConnectToUser < ActiveRecord::Migration - def change - add_column :users, :login_with_france_connect, :boolean, :default => false - end -end diff --git a/db/migrate/20151008090835_rename_login_with_france_connect_to_loged_in_with_france_connect.rb b/db/migrate/20151008090835_rename_login_with_france_connect_to_loged_in_with_france_connect.rb deleted file mode 100644 index 67cead7eb..000000000 --- a/db/migrate/20151008090835_rename_login_with_france_connect_to_loged_in_with_france_connect.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RenameLoginWithFranceConnectToLogedInWithFranceConnect < ActiveRecord::Migration - def change - rename_column :users, :login_with_france_connect, :loged_in_with_france_connect - end -end diff --git a/db/migrate/20151023132121_devise_create_administrateurs.rb b/db/migrate/20151023132121_devise_create_administrateurs.rb deleted file mode 100644 index 34d627e9a..000000000 --- a/db/migrate/20151023132121_devise_create_administrateurs.rb +++ /dev/null @@ -1,41 +0,0 @@ -class DeviseCreateAdministrateurs < ActiveRecord::Migration - def change - create_table(:administrateurs) do |t| - ## Database authenticatable - t.string :email, null: false, default: "" - t.string :encrypted_password, null: false, default: "" - - ## Recoverable - t.string :reset_password_token - t.datetime :reset_password_sent_at - - ## Rememberable - t.datetime :remember_created_at - - ## Trackable - 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 - t.string :last_sign_in_ip - - ## Confirmable - # t.string :confirmation_token - # t.datetime :confirmed_at - # t.datetime :confirmation_sent_at - # t.string :unconfirmed_email # Only if using reconfirmable - - ## Lockable - # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts - # t.string :unlock_token # Only if unlock strategy is :email or :both - # t.datetime :locked_at - - t.timestamps - end - - add_index :administrateurs, :email, unique: true - add_index :administrateurs, :reset_password_token, unique: true - # add_index :administrateurs, :confirmation_token, unique: true - # add_index :administrateurs, :unlock_token, unique: true - end -end diff --git a/db/migrate/20151026155158_create_types_de_champs.rb b/db/migrate/20151026155158_create_types_de_champs.rb deleted file mode 100644 index a3ca08c1a..000000000 --- a/db/migrate/20151026155158_create_types_de_champs.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateTypesDeChamps < ActiveRecord::Migration - def change - create_table :types_de_champs do |t| - t.string :libelle - t.string :type - t.integer :order_place - - t.belongs_to :procedure - end - end -end diff --git a/db/migrate/20151027150850_change_attributs_to_type_de_champs.rb b/db/migrate/20151027150850_change_attributs_to_type_de_champs.rb deleted file mode 100644 index 23fd252d4..000000000 --- a/db/migrate/20151027150850_change_attributs_to_type_de_champs.rb +++ /dev/null @@ -1,6 +0,0 @@ -class ChangeAttributsToTypeDeChamps < ActiveRecord::Migration - def change - rename_column :types_de_champs, :type, :type_champs - add_column :types_de_champs, :description, :text - end -end diff --git a/db/migrate/20151102101616_change_state_proposed_to_submitted.rb b/db/migrate/20151102101616_change_state_proposed_to_submitted.rb deleted file mode 100644 index 39c9c2ea9..000000000 --- a/db/migrate/20151102101616_change_state_proposed_to_submitted.rb +++ /dev/null @@ -1,5 +0,0 @@ -class ChangeStateProposedToSubmitted < ActiveRecord::Migration - def change - Dossier.where(state: 'proposed').update_all(state: 'submitted') - end -end diff --git a/db/migrate/20151102102747_change_statereply_to_replied.rb b/db/migrate/20151102102747_change_statereply_to_replied.rb deleted file mode 100644 index 95ff57a33..000000000 --- a/db/migrate/20151102102747_change_statereply_to_replied.rb +++ /dev/null @@ -1,5 +0,0 @@ -class ChangeStatereplyToReplied < ActiveRecord::Migration - def change - Dossier.where(state: 'reply').update_all(state: 'replied') - end -end diff --git a/db/migrate/20151102104309_change_state_confirmed_to_validated.rb b/db/migrate/20151102104309_change_state_confirmed_to_validated.rb deleted file mode 100644 index e19e39ed8..000000000 --- a/db/migrate/20151102104309_change_state_confirmed_to_validated.rb +++ /dev/null @@ -1,5 +0,0 @@ -class ChangeStateConfirmedToValidated < ActiveRecord::Migration - def change - Dossier.where(state: 'confirmed').update_all(state: 'validated') - end -end diff --git a/db/migrate/20151102105011_change_state_deposited_to_submit_validate.rb b/db/migrate/20151102105011_change_state_deposited_to_submit_validate.rb deleted file mode 100644 index e701fbf0a..000000000 --- a/db/migrate/20151102105011_change_state_deposited_to_submit_validate.rb +++ /dev/null @@ -1,5 +0,0 @@ -class ChangeStateDepositedToSubmitValidate < ActiveRecord::Migration - def change - Dossier.where(state: 'deposited').update_all(state: 'submit_validated') - end -end diff --git a/db/migrate/20151102135824_change_state_processed_to_closed.rb b/db/migrate/20151102135824_change_state_processed_to_closed.rb deleted file mode 100644 index f45f88c4b..000000000 --- a/db/migrate/20151102135824_change_state_processed_to_closed.rb +++ /dev/null @@ -1,5 +0,0 @@ -class ChangeStateProcessedToClosed < ActiveRecord::Migration - def change - Dossier.where(state: 'processed').update_all(state: 'closed') - end -end diff --git a/db/migrate/20151102142940_change_state_submitted_to_initiated.rb b/db/migrate/20151102142940_change_state_submitted_to_initiated.rb deleted file mode 100644 index cbce3e7d0..000000000 --- a/db/migrate/20151102142940_change_state_submitted_to_initiated.rb +++ /dev/null @@ -1,5 +0,0 @@ -class ChangeStateSubmittedToInitiated < ActiveRecord::Migration - def change - Dossier.where(state: 'submitted').update_all(state: 'initiated') - end -end diff --git a/db/migrate/20151102143908_change_state_submit_validated_to_submitted.rb b/db/migrate/20151102143908_change_state_submit_validated_to_submitted.rb deleted file mode 100644 index 411f5af65..000000000 --- a/db/migrate/20151102143908_change_state_submit_validated_to_submitted.rb +++ /dev/null @@ -1,5 +0,0 @@ -class ChangeStateSubmitValidatedToSubmitted < ActiveRecord::Migration - def change - Dossier.where(state: 'submit_validated').update_all(state: 'submitted') - end -end diff --git a/db/migrate/20151102163051_delete_attributs_to_dossier.rb b/db/migrate/20151102163051_delete_attributs_to_dossier.rb deleted file mode 100644 index 8928f910b..000000000 --- a/db/migrate/20151102163051_delete_attributs_to_dossier.rb +++ /dev/null @@ -1,11 +0,0 @@ -class DeleteAttributsToDossier < ActiveRecord::Migration - def change - remove_column :dossiers, :montant_projet - remove_column :dossiers, :montant_aide_demande - remove_column :dossiers, :date_previsionnelle - remove_column :dossiers, :position_lat - - remove_column :dossiers, :position_lon - remove_column :dossiers, :ref_dossier_carto - end -end diff --git a/db/migrate/20151103091603_create_champs.rb b/db/migrate/20151103091603_create_champs.rb deleted file mode 100644 index 749c76249..000000000 --- a/db/migrate/20151103091603_create_champs.rb +++ /dev/null @@ -1,9 +0,0 @@ -class CreateChamps < ActiveRecord::Migration - def change - create_table :champs do |t| - t.string :value - end - add_reference :champs, :type_de_champs, references: :types_de_champs - add_reference :champs, :dossier, references: :dossiers - end -end diff --git a/db/migrate/20151105093644_rename_type_de_champs_to_type_de_champ.rb b/db/migrate/20151105093644_rename_type_de_champs_to_type_de_champ.rb deleted file mode 100644 index afcc43587..000000000 --- a/db/migrate/20151105093644_rename_type_de_champs_to_type_de_champ.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RenameTypeDeChampsToTypeDeChamp < ActiveRecord::Migration - def change - rename_table :types_de_champs, :types_de_champ - end -end diff --git a/db/migrate/20151105095431_rename_type_de_champs_id_to_type_de_champ_id_on_champ.rb b/db/migrate/20151105095431_rename_type_de_champs_id_to_type_de_champ_id_on_champ.rb deleted file mode 100644 index 4c407562d..000000000 --- a/db/migrate/20151105095431_rename_type_de_champs_id_to_type_de_champ_id_on_champ.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RenameTypeDeChampsIdToTypeDeChampIdOnChamp < ActiveRecord::Migration - def change - rename_column :champs, :type_de_champs_id, :type_de_champ_id - end -end diff --git a/db/migrate/20151110091159_create_reference_admninistrateur_to_procedure.rb b/db/migrate/20151110091159_create_reference_admninistrateur_to_procedure.rb deleted file mode 100644 index 55585bd51..000000000 --- a/db/migrate/20151110091159_create_reference_admninistrateur_to_procedure.rb +++ /dev/null @@ -1,5 +0,0 @@ -class CreateReferenceAdmninistrateurToProcedure < ActiveRecord::Migration - def change - add_reference :procedures, :administrateur, references: :procedures - end -end diff --git a/db/migrate/20151110091451_create_reference_admninistrateur_to_gestionnaire.rb b/db/migrate/20151110091451_create_reference_admninistrateur_to_gestionnaire.rb deleted file mode 100644 index ecd1237ad..000000000 --- a/db/migrate/20151110091451_create_reference_admninistrateur_to_gestionnaire.rb +++ /dev/null @@ -1,5 +0,0 @@ -class CreateReferenceAdmninistrateurToGestionnaire < ActiveRecord::Migration - def change - add_reference :gestionnaires, :administrateur, references: :gestionnaires - end -end diff --git a/db/migrate/20151112151918_add_json_lat_lngs_to_dossier.rb b/db/migrate/20151112151918_add_json_lat_lngs_to_dossier.rb deleted file mode 100644 index 9aac8a6a9..000000000 --- a/db/migrate/20151112151918_add_json_lat_lngs_to_dossier.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddJsonLatLngsToDossier < ActiveRecord::Migration - def change - add_column :dossiers, :json_latlngs, :text - end -end diff --git a/db/migrate/20151113171605_create_exercice_table.rb b/db/migrate/20151113171605_create_exercice_table.rb deleted file mode 100644 index d5d5c34c7..000000000 --- a/db/migrate/20151113171605_create_exercice_table.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateExerciceTable < ActiveRecord::Migration - def change - create_table :exercices do |t| - t.string :ca - t.datetime :dateFinExercice - t.integer :date_fin_exercice_timestamp - end - - add_reference :exercices, :etablissement, references: :etablissements - end -end diff --git a/db/migrate/20151116175817_rename_type_champs_into_type_champ.rb b/db/migrate/20151116175817_rename_type_champs_into_type_champ.rb deleted file mode 100644 index 6a94bcb51..000000000 --- a/db/migrate/20151116175817_rename_type_champs_into_type_champ.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RenameTypeChampsIntoTypeChamp < ActiveRecord::Migration - def change - rename_column :types_de_champ, :type_champs, :type_champ - end -end diff --git a/db/migrate/20151124085333_create_quartier_prioritaire.rb b/db/migrate/20151124085333_create_quartier_prioritaire.rb deleted file mode 100644 index f25156894..000000000 --- a/db/migrate/20151124085333_create_quartier_prioritaire.rb +++ /dev/null @@ -1,12 +0,0 @@ -class CreateQuartierPrioritaire < ActiveRecord::Migration - def change - create_table :quartier_prioritaires do |t| - t.string :code - t.string :nom - t.string :commune - t.text :geometry - end - - add_reference :quartier_prioritaires, :dossier, references: :dossiers - end -end diff --git a/db/migrate/20151126153425_add_archived_to_procedure.rb b/db/migrate/20151126153425_add_archived_to_procedure.rb deleted file mode 100644 index c4654ff67..000000000 --- a/db/migrate/20151126153425_add_archived_to_procedure.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddArchivedToProcedure < ActiveRecord::Migration - def change - add_column :procedures, :archived, :boolean, default: false - end -end diff --git a/db/migrate/20151127103412_add_archived_to_dossier.rb b/db/migrate/20151127103412_add_archived_to_dossier.rb deleted file mode 100644 index 0ee816695..000000000 --- a/db/migrate/20151127103412_add_archived_to_dossier.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddArchivedToDossier < ActiveRecord::Migration - def change - add_column :dossiers, :archived, :boolean, default: false - end -end diff --git a/db/migrate/20151207095904_create_module_api_carto.rb b/db/migrate/20151207095904_create_module_api_carto.rb deleted file mode 100644 index 1b2927cd8..000000000 --- a/db/migrate/20151207095904_create_module_api_carto.rb +++ /dev/null @@ -1,9 +0,0 @@ -class CreateModuleAPICarto < ActiveRecord::Migration - def change - create_table :module_api_cartos do |t| - t.string :name - end - - add_reference :module_api_cartos, :procedure, references: :procedures - end -end diff --git a/db/migrate/20151207140202_update_module_api_carto.rb b/db/migrate/20151207140202_update_module_api_carto.rb deleted file mode 100644 index 9641d5c61..000000000 --- a/db/migrate/20151207140202_update_module_api_carto.rb +++ /dev/null @@ -1,44 +0,0 @@ -class UpdateModuleAPICarto < ActiveRecord::Migration - class Procedure < ApplicationRecord - end - - class ModuleAPICarto < ApplicationRecord - end - - def up - remove_column :module_api_cartos, :name - add_index :module_api_cartos, [:procedure_id], unique: true - - add_column :module_api_cartos, :use_api_carto, :boolean, default: false - add_column :module_api_cartos, :quartiers_prioritaires, :boolean, default: false - add_column :module_api_cartos, :cadastre, :boolean, default: false - - Procedure.all.each do |procedure| - module_api_carto = ModuleAPICarto.new(procedure_id: procedure.id) - module_api_carto.use_api_carto = procedure.use_api_carto - module_api_carto.quartiers_prioritaires = procedure.use_api_carto - - module_api_carto.save! - end - - remove_column :procedures, :use_api_carto - end - - def down - add_column :procedures, :use_api_carto, :boolean, default: false - remove_index :module_api_cartos, [:procedure_id] - - Procedure.all.each do |procedure| - procedure.use_api_carto = ModuleAPICarto.find_by(procedure_id: procedure.id).use_api_carto - procedure.save! - end - - remove_column :module_api_cartos, :use_api_carto - remove_column :module_api_cartos, :quartiers_prioritaires - remove_column :module_api_cartos, :cadastre - - add_column :module_api_cartos, :name, :string - - ModuleAPICarto.destroy_all - end -end diff --git a/db/migrate/20151210134135_add_euro_flag_to_procedure.rb b/db/migrate/20151210134135_add_euro_flag_to_procedure.rb deleted file mode 100644 index 1c03ab91e..000000000 --- a/db/migrate/20151210134135_add_euro_flag_to_procedure.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddEuroFlagToProcedure < ActiveRecord::Migration - def change - add_column :procedures, :euro_flag, :boolean, default: false - end -end diff --git a/db/migrate/20151210150958_add_logo_to_procedure.rb b/db/migrate/20151210150958_add_logo_to_procedure.rb deleted file mode 100644 index e7bd6c7e9..000000000 --- a/db/migrate/20151210150958_add_logo_to_procedure.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddLogoToProcedure < ActiveRecord::Migration - def change - add_column :procedures, :logo, :string - end -end diff --git a/db/migrate/20151211093833_create_rna_information_table.rb b/db/migrate/20151211093833_create_rna_information_table.rb deleted file mode 100644 index 50f444bd0..000000000 --- a/db/migrate/20151211093833_create_rna_information_table.rb +++ /dev/null @@ -1,14 +0,0 @@ -class CreateRNAInformationTable < ActiveRecord::Migration - def change - create_table :rna_informations do |t| - t.string :association_id - t.string :titre - t.text :objet - t.date :date_creation - t.date :date_declaration - t.date :date_publication - end - - add_reference :rna_informations, :entreprise, references: :entreprise - end -end diff --git a/db/migrate/20151214133426_add_api_token_to_administrateur.rb b/db/migrate/20151214133426_add_api_token_to_administrateur.rb deleted file mode 100644 index a0b171b80..000000000 --- a/db/migrate/20151214133426_add_api_token_to_administrateur.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddAPITokenToAdministrateur < ActiveRecord::Migration - def change - add_column :administrateurs, :api_token, :string - end -end diff --git a/db/migrate/20151221164041_add_france_connect_particulier_attributs_to_user.rb b/db/migrate/20151221164041_add_france_connect_particulier_attributs_to_user.rb deleted file mode 100644 index 0a1411152..000000000 --- a/db/migrate/20151221164041_add_france_connect_particulier_attributs_to_user.rb +++ /dev/null @@ -1,9 +0,0 @@ -class AddFranceConnectParticulierAttributsToUser < ActiveRecord::Migration - def change - add_column :users, :gender, :string - add_column :users, :given_name, :string - add_column :users, :family_name, :string - add_column :users, :birthdate, :date - add_column :users, :birthplace, :string - end -end diff --git a/db/migrate/20151222105558_change_type_of_loged_in_with_france_connect_to_user.rb b/db/migrate/20151222105558_change_type_of_loged_in_with_france_connect_to_user.rb deleted file mode 100644 index f3bf38d37..000000000 --- a/db/migrate/20151222105558_change_type_of_loged_in_with_france_connect_to_user.rb +++ /dev/null @@ -1,5 +0,0 @@ -class ChangeTypeOfLogedInWithFranceConnectToUser < ActiveRecord::Migration - def change - change_column :users, :loged_in_with_france_connect, :string - end -end diff --git a/db/migrate/20151223101322_add_openid_to_user.rb b/db/migrate/20151223101322_add_openid_to_user.rb deleted file mode 100644 index 455305495..000000000 --- a/db/migrate/20151223101322_add_openid_to_user.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddOpenidToUser < ActiveRecord::Migration - def change - add_column :users, :france_connect_particulier_id, :string - end -end diff --git a/db/migrate/20160106100227_add_mandataire_social_to_dossier.rb b/db/migrate/20160106100227_add_mandataire_social_to_dossier.rb deleted file mode 100644 index 87e59363a..000000000 --- a/db/migrate/20160106100227_add_mandataire_social_to_dossier.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddMandataireSocialToDossier < ActiveRecord::Migration - def change - add_column :dossiers, :mandataire_social, :boolean, default: false - end -end diff --git a/db/migrate/20160115135025_create_cadastre_table.rb b/db/migrate/20160115135025_create_cadastre_table.rb deleted file mode 100644 index f69bf0dc2..000000000 --- a/db/migrate/20160115135025_create_cadastre_table.rb +++ /dev/null @@ -1,18 +0,0 @@ -class CreateCadastreTable < ActiveRecord::Migration - def change - create_table :cadastres do |t| - t.string :surface_intersection - t.float :surface_parcelle - t.string :numero - t.integer :feuille - t.string :section - t.string :code_dep - t.string :nom_com - t.string :code_com - t.string :code_arr - t.text :geometry - end - - add_reference :cadastres, :dossier, references: :dossiers - end -end diff --git a/db/migrate/20160120094750_create_france_connect_information.rb b/db/migrate/20160120094750_create_france_connect_information.rb deleted file mode 100644 index 97dde9ccd..000000000 --- a/db/migrate/20160120094750_create_france_connect_information.rb +++ /dev/null @@ -1,63 +0,0 @@ -class CreateFranceConnectInformation < ActiveRecord::Migration - class User < ApplicationRecord - end - - class FranceConnectInformation < ApplicationRecord - end - - def up - create_table :france_connect_informations do |t| - t.string :gender - t.string :given_name - t.string :family_name - t.date :birthdate - t.string :birthplace - t.string :france_connect_particulier_id - end - - add_reference :france_connect_informations, :user, references: :users - - User.all.each do |user| - if user.france_connect_particulier_id.present? - FranceConnectInformation.create({ - gender: user.gender, - given_name: user.given_name, - family_name: user.family_name, - birthdate: user.birthdate, - birthplace: user.birthplace, - france_connect_particulier_id: user.france_connect_particulier_id, - user_id: user.id - }) - end - end - - remove_column :users, :gender - remove_column :users, :given_name - remove_column :users, :family_name - remove_column :users, :birthdate - remove_column :users, :birthplace - remove_column :users, :france_connect_particulier_id - end - - def down - add_column :users, :gender, :string - add_column :users, :given_name, :string - add_column :users, :family_name, :string - add_column :users, :birthdate, :date - add_column :users, :birthplace, :string - add_column :users, :france_connect_particulier_id, :string - - FranceConnectInformation.all.each do |fci| - User.find(fci.user_id).update({ - gender: fci.gender, - given_name: fci.given_name, - family_name: fci.family_name, - birthdate: fci.birthdate, - birthplace: fci.birthplace, - france_connect_particulier_id: fci.france_connect_particulier_id - }) - end - - drop_table :france_connect_informations - end -end diff --git a/db/migrate/20160120141602_remove_default_date_to_dossier.rb b/db/migrate/20160120141602_remove_default_date_to_dossier.rb deleted file mode 100644 index fa1d36503..000000000 --- a/db/migrate/20160120141602_remove_default_date_to_dossier.rb +++ /dev/null @@ -1,6 +0,0 @@ -class RemoveDefaultDateToDossier < ActiveRecord::Migration - def change - change_column_default(:dossiers, :created_at, nil) - change_column_default(:dossiers, :updated_at, nil) - end -end diff --git a/db/migrate/20160121110603_add_email_to_france_connect_information.rb b/db/migrate/20160121110603_add_email_to_france_connect_information.rb deleted file mode 100644 index d4b551891..000000000 --- a/db/migrate/20160121110603_add_email_to_france_connect_information.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddEmailToFranceConnectInformation < ActiveRecord::Migration - def change - add_column :france_connect_informations, :email_france_connect, :string - end -end diff --git a/db/migrate/20160127162841_add_cerfa_flag_to_procedure.rb b/db/migrate/20160127162841_add_cerfa_flag_to_procedure.rb deleted file mode 100644 index 5589bbbf1..000000000 --- a/db/migrate/20160127162841_add_cerfa_flag_to_procedure.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddCerfaFlagToProcedure < ActiveRecord::Migration - def change - add_column :procedures, :cerfa_flag, :boolean, :default => false - end -end diff --git a/db/migrate/20160127170437_change_date_creation_type_to_entreprise.rb b/db/migrate/20160127170437_change_date_creation_type_to_entreprise.rb deleted file mode 100644 index 6451dc0d1..000000000 --- a/db/migrate/20160127170437_change_date_creation_type_to_entreprise.rb +++ /dev/null @@ -1,9 +0,0 @@ -class ChangeDateCreationTypeToEntreprise < ActiveRecord::Migration - def up - change_column :entreprises, :date_creation, "timestamp USING to_timestamp(date_creation) at time zone 'UTC-2'" - end - - def down - change_column :entreprises, :date_creation, "integer USING extract(epoch from date_creation::timestamp with time zone)::integer" - end -end diff --git a/db/migrate/20160204155519_create_invites.rb b/db/migrate/20160204155519_create_invites.rb deleted file mode 100644 index a2ef60184..000000000 --- a/db/migrate/20160204155519_create_invites.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateInvites < ActiveRecord::Migration - def change - create_table :invites do |t| - t.string :email - t.string :email_sender - end - - add_reference :invites, :dossier, references: :dossiers - add_reference :invites, :user, references: :users - end -end diff --git a/db/migrate/20160223134354_devise_create_administrations.rb b/db/migrate/20160223134354_devise_create_administrations.rb deleted file mode 100644 index 7c48f4fcf..000000000 --- a/db/migrate/20160223134354_devise_create_administrations.rb +++ /dev/null @@ -1,41 +0,0 @@ -class DeviseCreateAdministrations < ActiveRecord::Migration - def change - create_table(:administrations) do |t| - ## Database authenticatable - t.string :email, null: false, default: "" - t.string :encrypted_password, null: false, default: "" - - ## Recoverable - t.string :reset_password_token - t.datetime :reset_password_sent_at - - ## Rememberable - t.datetime :remember_created_at - - ## Trackable - 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 - t.string :last_sign_in_ip - - ## Confirmable - # t.string :confirmation_token - # t.datetime :confirmed_at - # t.datetime :confirmation_sent_at - # t.string :unconfirmed_email # Only if using reconfirmable - - ## Lockable - # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts - # t.string :unlock_token # Only if unlock strategy is :email or :both - # t.datetime :locked_at - - t.timestamps - end - - add_index :administrations, :email, unique: true - add_index :administrations, :reset_password_token, unique: true - # add_index :administrations, :confirmation_token, unique: true - # add_index :administrations, :unlock_token, unique: true - end -end diff --git a/db/migrate/20160314102523_add_procedure_filter_to_gestionnaire.rb b/db/migrate/20160314102523_add_procedure_filter_to_gestionnaire.rb deleted file mode 100644 index 71ba45d0e..000000000 --- a/db/migrate/20160314102523_add_procedure_filter_to_gestionnaire.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddProcedureFilterToGestionnaire < ActiveRecord::Migration - def change - add_column :gestionnaires, :procedure_filter, :integer, array: true, default: [] - end -end diff --git a/db/migrate/20160314160801_add_created_at_to_cerfa.rb b/db/migrate/20160314160801_add_created_at_to_cerfa.rb deleted file mode 100644 index a9e3a25d7..000000000 --- a/db/migrate/20160314160801_add_created_at_to_cerfa.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddCreatedAtToCerfa < ActiveRecord::Migration - def change - add_column :cerfas, :created_at, :datetime - end -end diff --git a/db/migrate/20160314161959_add_created_at_to_piece_justificative.rb b/db/migrate/20160314161959_add_created_at_to_piece_justificative.rb deleted file mode 100644 index 61cec7fb9..000000000 --- a/db/migrate/20160314161959_add_created_at_to_piece_justificative.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddCreatedAtToPieceJustificative < ActiveRecord::Migration - def change - add_column :pieces_justificatives, :created_at, :datetime - end -end diff --git a/db/migrate/20160315101245_add_mandatory_to_type_de_champs.rb b/db/migrate/20160315101245_add_mandatory_to_type_de_champs.rb deleted file mode 100644 index d08aefcfc..000000000 --- a/db/migrate/20160315101245_add_mandatory_to_type_de_champs.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddMandatoryToTypeDeChamps < ActiveRecord::Migration - def change - add_column :types_de_champ, :mandatory, :boolean, default: false - end -end diff --git a/db/migrate/20160317135217_d_bremove_piece_justificative_empty.rb b/db/migrate/20160317135217_d_bremove_piece_justificative_empty.rb deleted file mode 100644 index f9e34f7f2..000000000 --- a/db/migrate/20160317135217_d_bremove_piece_justificative_empty.rb +++ /dev/null @@ -1,8 +0,0 @@ -class DBremovePieceJustificativeEmpty < ActiveRecord::Migration - class PieceJustificative < ApplicationRecord - end - - def change - PieceJustificative.where(content: nil).delete_all - end -end diff --git a/db/migrate/20160317144949_piece_justificative_have_user.rb b/db/migrate/20160317144949_piece_justificative_have_user.rb deleted file mode 100644 index d8584d997..000000000 --- a/db/migrate/20160317144949_piece_justificative_have_user.rb +++ /dev/null @@ -1,21 +0,0 @@ -class PieceJustificativeHaveUser < ActiveRecord::Migration - class PieceJustificative < ApplicationRecord - belongs_to :dossier - end - - class Dossier < ApplicationRecord - belongs_to :user - end - - class User < ApplicationRecord - end - - def change - add_reference :pieces_justificatives, :user, references: :users - - PieceJustificative.all.each do |piece_justificative| - piece_justificative.user_id = piece_justificative.dossier.user.id - piece_justificative.save - end - end -end diff --git a/db/migrate/20160317153115_cerfa_have_user.rb b/db/migrate/20160317153115_cerfa_have_user.rb deleted file mode 100644 index 44ebf2db9..000000000 --- a/db/migrate/20160317153115_cerfa_have_user.rb +++ /dev/null @@ -1,21 +0,0 @@ -class CerfaHaveUser < ActiveRecord::Migration - class Cerfa < ApplicationRecord - belongs_to :dossier - end - - class Dossier < ApplicationRecord - belongs_to :user - end - - class User < ApplicationRecord - end - - def change - add_reference :cerfas, :user, references: :users - - Cerfa.all.each do |cerfa| - cerfa.user_id = cerfa.dossier.user.id - cerfa.save - end - end -end diff --git a/db/migrate/20160419142017_add_piece_justificative_reference_to_commentaire.rb b/db/migrate/20160419142017_add_piece_justificative_reference_to_commentaire.rb deleted file mode 100644 index d0f9bc8f9..000000000 --- a/db/migrate/20160419142017_add_piece_justificative_reference_to_commentaire.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddPieceJustificativeReferenceToCommentaire < ActiveRecord::Migration - def change - add_reference :commentaires, :piece_justificative, references: :piece_justificatives - end -end diff --git a/db/migrate/20160512160602_add_original_filename_to_pieces_justificatives.rb b/db/migrate/20160512160602_add_original_filename_to_pieces_justificatives.rb deleted file mode 100644 index 49b136ba3..000000000 --- a/db/migrate/20160512160602_add_original_filename_to_pieces_justificatives.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddOriginalFilenameToPiecesJustificatives < ActiveRecord::Migration - def change - add_column :pieces_justificatives, :original_filename, :string - end -end diff --git a/db/migrate/20160512160658_add_original_filename_to_cerfas.rb b/db/migrate/20160512160658_add_original_filename_to_cerfas.rb deleted file mode 100644 index e12e86f52..000000000 --- a/db/migrate/20160512160658_add_original_filename_to_cerfas.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddOriginalFilenameToCerfas < ActiveRecord::Migration - def change - add_column :cerfas, :original_filename, :string - end -end diff --git a/db/migrate/20160512160824_add_content_secure_token_to_cerfas.rb b/db/migrate/20160512160824_add_content_secure_token_to_cerfas.rb deleted file mode 100644 index 1453eded5..000000000 --- a/db/migrate/20160512160824_add_content_secure_token_to_cerfas.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddContentSecureTokenToCerfas < ActiveRecord::Migration - def change - add_column :cerfas, :content_secure_token, :string - end -end diff --git a/db/migrate/20160512160836_add_content_secure_token_to_pieces_justificatives.rb b/db/migrate/20160512160836_add_content_secure_token_to_pieces_justificatives.rb deleted file mode 100644 index 1b256c74b..000000000 --- a/db/migrate/20160512160836_add_content_secure_token_to_pieces_justificatives.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddContentSecureTokenToPiecesJustificatives < ActiveRecord::Migration - def change - add_column :pieces_justificatives, :content_secure_token, :string - end -end diff --git a/db/migrate/20160513093425_add_logo_secure_token_to_procedures.rb b/db/migrate/20160513093425_add_logo_secure_token_to_procedures.rb deleted file mode 100644 index 359771b96..000000000 --- a/db/migrate/20160513093425_add_logo_secure_token_to_procedures.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddLogoSecureTokenToProcedures < ActiveRecord::Migration - def change - add_column :procedures, :logo_secure_token, :string - end -end diff --git a/db/migrate/20160519100904_admin_has_and_belong_gestionnaire.rb b/db/migrate/20160519100904_admin_has_and_belong_gestionnaire.rb deleted file mode 100644 index d655b9366..000000000 --- a/db/migrate/20160519100904_admin_has_and_belong_gestionnaire.rb +++ /dev/null @@ -1,32 +0,0 @@ -class AdminHasAndBelongGestionnaire < ActiveRecord::Migration - class Gestionnaire < ApplicationRecord - end - - class AdministrateursGestionnaire < ApplicationRecord - end - - def up - create_table :administrateurs_gestionnaires, id: false do |t| - t.belongs_to :administrateur, index: true - t.belongs_to :gestionnaire, index: true - end - - Gestionnaire.all.each do |gestionnaire| - execute "insert into administrateurs_gestionnaires (gestionnaire_id, administrateur_id) values (#{gestionnaire.id}, #{gestionnaire.administrateur_id}) " - end - - remove_column :gestionnaires, :administrateur_id - end - - def down - add_column :gestionnaires, :administrateur_id, :integer - - AdministrateursGestionnaire.all.each do |ag| - gestionnaire = Gestionnaire.find(ag.gestionnaire_id) - gestionnaire.administrateur_id = ag.administrateur_id - gestionnaire.save - end - - drop_table :administrateurs_gestionnaires - end -end diff --git a/db/migrate/20160519101018_gestionnaire_is_assign_to_procedure.rb b/db/migrate/20160519101018_gestionnaire_is_assign_to_procedure.rb deleted file mode 100644 index 059c8aa48..000000000 --- a/db/migrate/20160519101018_gestionnaire_is_assign_to_procedure.rb +++ /dev/null @@ -1,36 +0,0 @@ -class GestionnaireIsAssignToProcedure < ActiveRecord::Migration - class AssignTo < ApplicationRecord - belongs_to :gestionnaire - belongs_to :procedure - end - - class Gestionnaire < ApplicationRecord - has_and_belongs_to_many :administrateurs - has_many :procedures, through: :assign_to - end - - class Administrateur < ApplicationRecord - has_and_belongs_to_many :gestionnaires - has_many :procedures - end - - class Procedure < ApplicationRecord - belongs_to :administrateur - has_many :gestionnaires, through: :assign_to - end - - def change - create_table :assign_tos, id: false do |t| - t.belongs_to :gestionnaire, index: true - t.belongs_to :procedure, index: true - end - - Administrateur.all.each do |administrateur| - administrateur.gestionnaires.each do |gestionnaire| - administrateur.procedures.each do |procedure| - AssignTo.create gestionnaire: gestionnaire, procedure: procedure - end - end - end - end -end diff --git a/db/migrate/20160523163054_add_foreign_key_admnistrateur_gestionnaire.rb b/db/migrate/20160523163054_add_foreign_key_admnistrateur_gestionnaire.rb deleted file mode 100644 index 61bbb4424..000000000 --- a/db/migrate/20160523163054_add_foreign_key_admnistrateur_gestionnaire.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddForeignKeyAdmnistrateurGestionnaire < ActiveRecord::Migration - def change - add_index :administrateurs_gestionnaires, [:gestionnaire_id, :administrateur_id], unique: true, name: 'unique_couple_administrateur_gestionnaire' - end -end diff --git a/db/migrate/20160524093540_set_original_filename_for_uploaders.rb b/db/migrate/20160524093540_set_original_filename_for_uploaders.rb deleted file mode 100644 index 2bd688a4e..000000000 --- a/db/migrate/20160524093540_set_original_filename_for_uploaders.rb +++ /dev/null @@ -1,23 +0,0 @@ -class SetOriginalFilenameForUploaders < ActiveRecord::Migration - class PieceJustificative < ApplicationRecord - end - - class Cerfa < ApplicationRecord - end - - def change - PieceJustificative.all.each do |pj| - if pj.original_filename.nil? - pj.original_filename = pj.content - pj.save! - end - end - - Cerfa.all.each do |cerfa| - if cerfa.original_filename.nil? - cerfa.original_filename = cerfa.content - cerfa.save! - end - end - end -end diff --git a/db/migrate/20160607150440_add_order_place_in_type_de_piece_justificative.rb b/db/migrate/20160607150440_add_order_place_in_type_de_piece_justificative.rb deleted file mode 100644 index 7cf5fa801..000000000 --- a/db/migrate/20160607150440_add_order_place_in_type_de_piece_justificative.rb +++ /dev/null @@ -1,9 +0,0 @@ -class AddOrderPlaceInTypeDePieceJustificative < ActiveRecord::Migration - def up - add_column :types_de_piece_justificative, :order_place, :integer - end - - def down - remove_column :types_de_piece_justificative, :order_place - end -end diff --git a/db/migrate/20160609125949_add_procedure_status.rb b/db/migrate/20160609125949_add_procedure_status.rb deleted file mode 100644 index 7e7b38160..000000000 --- a/db/migrate/20160609125949_add_procedure_status.rb +++ /dev/null @@ -1,12 +0,0 @@ -class AddProcedureStatus < ActiveRecord::Migration - class Procedure < ApplicationRecord - end - - def change - add_column :procedures, :published, :boolean, default: false, null: false - Procedure.all.each do |procedure| - procedure.published = true - procedure.save! - end - end -end diff --git a/db/migrate/20160609145737_delete_default_description_to_dossier.rb b/db/migrate/20160609145737_delete_default_description_to_dossier.rb deleted file mode 100644 index 7eea84a40..000000000 --- a/db/migrate/20160609145737_delete_default_description_to_dossier.rb +++ /dev/null @@ -1,60 +0,0 @@ -class DeleteDefaultDescriptionToDossier < ActiveRecord::Migration - class Dossier < ApplicationRecord - end - - class Champ < ApplicationRecord - end - - class Procedure < ApplicationRecord - end - - class TypeDeChamp < ApplicationRecord - end - - def up - Procedure.all.each do |procedure| - # change all type_de_champ place_order by +1 to insert new type_de_champ description on first place - TypeDeChamp.where(procedure_id: procedure.id).each do |type_de_champ| - type_de_champ.order_place += 1 - type_de_champ.save - end - - # insert type_de_champ description on first place - TypeDeChamp.create(libelle: 'Description', description: 'Description de votre demande', type_champ: 'textarea', order_place: 0, procedure_id: procedure.id, mandatory: true) - end - - Dossier.all.each do |dossier| - # get the new type de champ - new_type_de_champ = TypeDeChamp.where(libelle: 'Description', type_champ: 'textarea', order_place: 0, procedure_id: dossier.procedure_id, mandatory: true) - - # create a new champ with the actual description value - Champ.create(value: dossier.description, type_de_champ_id: new_type_de_champ.first.id, dossier_id: dossier.id) - end - - remove_column :dossiers, :description - end - - def down - add_column :dossiers, :description, :text - - Champ.destroy_all(dossier_id: 0) - - TypeDeChamp.where(libelle: 'Description', type_champ: 'textarea', order_place: 0, mandatory: true).each do |type_de_champ| - Champ.where(type_de_champ_id: type_de_champ.id).each do |champ| - dossier = Dossier.find(champ.dossier_id) - dossier.description = champ.value - dossier.save - - champ.delete - end - - procedure_id = type_de_champ.procedure_id - type_de_champ.delete - - TypeDeChamp.where(procedure_id: procedure_id).each do |type_de_champ_2| - type_de_champ_2.order_place -= 1 - type_de_champ_2.save - end - end - end -end diff --git a/db/migrate/20160622081321_convert_all_datetime_to_date_on_database.rb b/db/migrate/20160622081321_convert_all_datetime_to_date_on_database.rb deleted file mode 100644 index 96c094166..000000000 --- a/db/migrate/20160622081321_convert_all_datetime_to_date_on_database.rb +++ /dev/null @@ -1,13 +0,0 @@ -class ConvertAllDatetimeToDateOnDatabase < ActiveRecord::Migration - class TypeDeChamp < ApplicationRecord - end - - def change - TypeDeChamp.all.each do |type_de_champ| - if type_de_champ.type_champ == 'datetime' - type_de_champ.type_champ = 'date' - type_de_champ.save - end - end - end -end diff --git a/db/migrate/20160622081322_add_procedure_path_mapping_table.rb b/db/migrate/20160622081322_add_procedure_path_mapping_table.rb deleted file mode 100644 index f29b5cdef..000000000 --- a/db/migrate/20160622081322_add_procedure_path_mapping_table.rb +++ /dev/null @@ -1,18 +0,0 @@ -class AddProcedurePathMappingTable < ActiveRecord::Migration - class ProcedurePath < ApplicationRecord - end - - def change - create_table :procedure_paths do |t| - t.string :path, limit: 30, null: true, unique: true, index: true - t.integer :procedure_id, unique: true, null: true - t.integer :administrateur_id, unique: true, null: true - end - add_foreign_key :procedure_paths, :procedures - add_foreign_key :procedure_paths, :administrateurs - - Procedure.all.each do |procedure| - ProcedurePath.create(path: (procedure.id).to_s, procedure_id: procedure.id, administrateur_id: procedure.administrateur.id) - end - end -end diff --git a/db/migrate/20160718124741_gestionnaire_can_follow_dossier.rb b/db/migrate/20160718124741_gestionnaire_can_follow_dossier.rb deleted file mode 100644 index 15247e65f..000000000 --- a/db/migrate/20160718124741_gestionnaire_can_follow_dossier.rb +++ /dev/null @@ -1,8 +0,0 @@ -class GestionnaireCanFollowDossier < ActiveRecord::Migration - def change - create_table :follows do |t| - t.belongs_to :gestionnaire, index: true - t.belongs_to :dossier, index: true - end - end -end diff --git a/db/migrate/20160722135927_add_preference_list_dossier_table.rb b/db/migrate/20160722135927_add_preference_list_dossier_table.rb deleted file mode 100644 index d638ee92f..000000000 --- a/db/migrate/20160722135927_add_preference_list_dossier_table.rb +++ /dev/null @@ -1,15 +0,0 @@ -class AddPreferenceListDossierTable < ActiveRecord::Migration - def change - create_table :preference_list_dossiers do |t| - t.string :libelle - t.string :table - t.string :attr - t.string :attr_decorate - t.string :bootstrap_lg - t.string :order - t.string :filter - end - - add_belongs_to :preference_list_dossiers, :gestionnaire - end -end diff --git a/db/migrate/20160802113112_build_default_preference_list_dossier.rb b/db/migrate/20160802113112_build_default_preference_list_dossier.rb deleted file mode 100644 index 67e4687f3..000000000 --- a/db/migrate/20160802113112_build_default_preference_list_dossier.rb +++ /dev/null @@ -1,135 +0,0 @@ -class BuildDefaultPreferenceListDossier < ActiveRecord::Migration - class Gestionnaire < ApplicationRecord - def build_default_preferences_list_dossier - PreferenceListDossier.available_columns.each do |table| - table.second.each do |column| - if valid_couple_table_attr? table.first, column.first - PreferenceListDossier.create( - libelle: column.second[:libelle], - table: column.second[:table], - attr: column.second[:attr], - attr_decorate: column.second[:attr_decorate], - bootstrap_lg: column.second[:bootstrap_lg], - order: nil, - filter: nil, - gestionnaire_id: self.id - ) - end - end - end - end - - def valid_couple_table_attr?(table, column) - couples = [ - { - table: :dossier, - column: :dossier_id - }, - { - table: :procedure, - column: :libelle - }, - { - table: :etablissement, - column: :siret - }, - { - table: :entreprise, - column: :raison_sociale - }, - { - table: :dossier, - column: :state - } - ] - - couples.include?({ table: table, column: column }) - end - end - - class PreferenceListDossier < ApplicationRecord - def self.available_columns - { - dossier: columns_dossier, - procedure: columns_procedure, - entreprise: columns_entreprise, - etablissement: columns_etablissement, - user: columns_user - } - end - - def self.columns_dossier - table = nil - - { - dossier_id: create_column('ID', table, 'id', 'id', 1), - created_at: create_column('Créé le', table, 'created_at', 'first_creation', 2), - updated_at: create_column('Mise à jour le', table, 'updated_at', 'last_update', 2), - state: create_column('Statut', table, 'state', 'display_state', 1) - } - end - - def self.columns_procedure - table = 'procedure' - - { - libelle: create_column('Libellé démarche', table, 'libelle', 'libelle', 4), - organisation: create_column('Organisation', table, 'organisation', 'organisation', 3), - direction: create_column('Direction', table, 'direction', 'direction', 3) - } - end - - def self.columns_entreprise - table = 'entreprise' - - { - siren: create_column('SIREN', table, 'siren', 'siren', 2), - forme_juridique: create_column('Forme juridique', table, 'forme_juridique', 'forme_juridique', 3), - nom_commercial: create_column('Nom commercial', table, 'nom_commercial', 'nom_commercial', 3), - raison_sociale: create_column('Raison sociale', table, 'raison_sociale', 'raison_sociale', 3), - siret_siege_social: create_column('SIRET siège social', table, 'siret_siege_social', 'siret_siege_social', 2), - date_creation: create_column('Date de création', table, 'date_creation', 'date_creation', 2) - } - end - - def self.columns_etablissement - table = 'etablissement' - - { - siret: create_column('SIRET', table, 'siret', 'siret', 2), - libelle: create_column('Nom établissement', table, 'libelle_naf', 'libelle_naf', 3), - code_postal: create_column('Code postal', table, 'code_postal', 'code_postal', 1) - } - end - - def self.columns_user - table = 'user' - - { - email: create_column('Email', table, 'email', 'email', 2) - } - end - - def self.create_column(libelle, table, attr, attr_decorate, bootstrap_lg) - { - libelle: libelle, - table: table, - attr: attr, - attr_decorate: attr_decorate, - bootstrap_lg: bootstrap_lg, - order: nil, - filter: nil - } - end - end - - def up - Gestionnaire.all.each(&:build_default_preferences_list_dossier) - end - - def down - Gestionnaire.all.each do |gestionnaire| - PreferenceListDossier.where(gestionnaire_id: gestionnaire.id).delete_all - end - end -end diff --git a/db/migrate/20160802131031_add_public_attr_on_type_de_champ.rb b/db/migrate/20160802131031_add_public_attr_on_type_de_champ.rb deleted file mode 100644 index 05491de73..000000000 --- a/db/migrate/20160802131031_add_public_attr_on_type_de_champ.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddPublicAttrOnTypeDeChamp < ActiveRecord::Migration - def change - add_column :types_de_champ, :private, :boolean, default: false - end -end diff --git a/db/migrate/20160802161734_add_type_attr_on_type_de_champ.rb b/db/migrate/20160802161734_add_type_attr_on_type_de_champ.rb deleted file mode 100644 index d1ab25589..000000000 --- a/db/migrate/20160802161734_add_type_attr_on_type_de_champ.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddTypeAttrOnTypeDeChamp < ActiveRecord::Migration - def change - add_column :types_de_champ, :type, :string - end -end diff --git a/db/migrate/20160803081304_fix_default_type_on_type_de_champ_table.rb b/db/migrate/20160803081304_fix_default_type_on_type_de_champ_table.rb deleted file mode 100644 index 6bc12ed6d..000000000 --- a/db/migrate/20160803081304_fix_default_type_on_type_de_champ_table.rb +++ /dev/null @@ -1,16 +0,0 @@ -class FixDefaultTypeOnTypeDeChampTable < ActiveRecord::Migration - class TypeDeChamp < ApplicationRecord - end - - def up - 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) - end -end diff --git a/db/migrate/20160804130638_add_type_attr_in_champ_table.rb b/db/migrate/20160804130638_add_type_attr_in_champ_table.rb deleted file mode 100644 index 5f42889d9..000000000 --- a/db/migrate/20160804130638_add_type_attr_in_champ_table.rb +++ /dev/null @@ -1,24 +0,0 @@ -class AddTypeAttrInChampTable < ActiveRecord::Migration - class TypeDeChamp < ApplicationRecord - has_many :champs - end - - class Champ < ApplicationRecord - belongs_to :type_de_champ - end - - def up - add_column :champs, :type, :string - - Champ.all.each do |champ| - type = 'ChampPublic' if champ.type_de_champ.class == TypeDeChampPublic - type = 'ChampPrivate' if champ.type_de_champ.class == TypeDeChampPrivate - - champ.update_attribute(:type, type) - end - end - - def down - remove_column :champs, :type - end -end diff --git a/db/migrate/20160808115924_add_deposit_attr_in_dossier_table.rb b/db/migrate/20160808115924_add_deposit_attr_in_dossier_table.rb deleted file mode 100644 index a3794eebe..000000000 --- a/db/migrate/20160808115924_add_deposit_attr_in_dossier_table.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddDepositAttrInDossierTable < ActiveRecord::Migration - def change - add_column :dossiers, :deposit_datetime, :datetime - end -end diff --git a/db/migrate/20160809083606_create_drop_down_list_table.rb b/db/migrate/20160809083606_create_drop_down_list_table.rb deleted file mode 100644 index 505d65067..000000000 --- a/db/migrate/20160809083606_create_drop_down_list_table.rb +++ /dev/null @@ -1,8 +0,0 @@ -class CreateDropDownListTable < ActiveRecord::Migration - def change - create_table :drop_down_lists do |t| - t.string :value - t.belongs_to :type_de_champ - end - end -end diff --git a/db/migrate/20160822142045_delete_value_of_filter_procedure.rb b/db/migrate/20160822142045_delete_value_of_filter_procedure.rb deleted file mode 100644 index e1f8c771d..000000000 --- a/db/migrate/20160822142045_delete_value_of_filter_procedure.rb +++ /dev/null @@ -1,8 +0,0 @@ -class DeleteValueOfFilterProcedure < ActiveRecord::Migration - class Gestionnaire < ApplicationRecord - end - - def change - Gestionnaire.all.update_all(procedure_filter: '{}') - end -end diff --git a/db/migrate/20160824094151_add_lien_site_web_in_procedure_table.rb b/db/migrate/20160824094151_add_lien_site_web_in_procedure_table.rb deleted file mode 100644 index 3635b2cd9..000000000 --- a/db/migrate/20160824094151_add_lien_site_web_in_procedure_table.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddLienSiteWebInProcedureTable < ActiveRecord::Migration - def change - add_column :procedures, :lien_site_web, :string - end -end diff --git a/db/migrate/20160824094451_add_lien_notice_in_procedure_table.rb b/db/migrate/20160824094451_add_lien_notice_in_procedure_table.rb deleted file mode 100644 index 218805fee..000000000 --- a/db/migrate/20160824094451_add_lien_notice_in_procedure_table.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddLienNoticeInProcedureTable < ActiveRecord::Migration - def change - add_column :procedures, :lien_notice, :string - end -end diff --git a/db/migrate/20160829094658_add_for_individual_attr_in_procedure_table.rb b/db/migrate/20160829094658_add_for_individual_attr_in_procedure_table.rb deleted file mode 100644 index abcf83c05..000000000 --- a/db/migrate/20160829094658_add_for_individual_attr_in_procedure_table.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddForIndividualAttrInProcedureTable < ActiveRecord::Migration - def change - add_column :procedures, :for_individual, :boolean, default: false - end -end diff --git a/db/migrate/20160829114646_create_individual_table.rb b/db/migrate/20160829114646_create_individual_table.rb deleted file mode 100644 index f93c6a8ca..000000000 --- a/db/migrate/20160829114646_create_individual_table.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateIndividualTable < ActiveRecord::Migration - def change - create_table :individuals do |t| - t.string :nom - t.string :prenom - t.string :birthdate - end - - add_belongs_to :individuals, :dossier - end -end diff --git a/db/migrate/20160830142653_create_mail_templates_table.rb b/db/migrate/20160830142653_create_mail_templates_table.rb deleted file mode 100644 index 8cc41d792..000000000 --- a/db/migrate/20160830142653_create_mail_templates_table.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateMailTemplatesTable < ActiveRecord::Migration - def change - create_table :mail_templates do |t| - t.string :object - t.text :body - t.string :type - end - - add_belongs_to :mail_templates, :procedure - end -end diff --git a/db/migrate/20160901082824_initiated_all_received_mail_for_procedure.rb b/db/migrate/20160901082824_initiated_all_received_mail_for_procedure.rb deleted file mode 100644 index edfbec2fd..000000000 --- a/db/migrate/20160901082824_initiated_all_received_mail_for_procedure.rb +++ /dev/null @@ -1,40 +0,0 @@ -class InitiatedAllReceivedMailForProcedure < ActiveRecord::Migration - class Procedure < ApplicationRecord - has_one :mail_received - end - - class MailTemplate < ApplicationRecord - end - - class ::MailReceived < MailTemplate - before_save :default_values - - def default_values - self.object ||= "[TPS] Accusé de réception pour votre dossier nº --numero_dossier--" - self.body ||= "Bonjour, -
-
- Votre administration vous confirme la bonne réception de votre dossier nº--numero_dossier-- complet. Celui-ci sera instruit dans le délais légal déclaré par votre interlocuteur.
-
- En vous souhaitant une bonne journée, -
-
- --- -
- L'équipe TPS" - end - end - - def up - Procedure.all.each do |procedure| - procedure.mail_received ||= MailReceived.create(type: 'MailReceived') - procedure.save - end - end - - def down - Procedure.all.each do |procedure| - procedure.mail_received.delete - end - end -end diff --git a/db/migrate/20160906123255_add_has_procedure_to_pref_list_dossier.rb b/db/migrate/20160906123255_add_has_procedure_to_pref_list_dossier.rb deleted file mode 100644 index e80588537..000000000 --- a/db/migrate/20160906123255_add_has_procedure_to_pref_list_dossier.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddHasProcedureToPrefListDossier < ActiveRecord::Migration - def change - add_belongs_to :preference_list_dossiers, :procedure - end -end diff --git a/db/migrate/20160906134155_build_default_pref_list_dossier_procedure.rb b/db/migrate/20160906134155_build_default_pref_list_dossier_procedure.rb deleted file mode 100644 index 26158f299..000000000 --- a/db/migrate/20160906134155_build_default_pref_list_dossier_procedure.rb +++ /dev/null @@ -1,44 +0,0 @@ -class BuildDefaultPrefListDossierProcedure < ActiveRecord::Migration - class Gestionnaire < ApplicationRecord - has_many :assign_to, dependent: :destroy - has_many :procedures, through: :assign_to - has_many :preference_list_dossiers - end - - class PreferenceListDossier < ApplicationRecord - belongs_to :gestionnaire - belongs_to :procedure - end - - class AssignTo < ApplicationRecord - belongs_to :procedure - belongs_to :gestionnaire - end - - class Procedure < ApplicationRecord - has_many :gestionnaires, through: :assign_to - has_many :preference_list_dossiers - end - - def up - Gestionnaire.all.each do |gestionnaire| - gestionnaire.procedures.each do |procedure| - gestionnaire.preference_list_dossiers.where(procedure: nil).each do |preference| - clone = preference.dup - - clone.procedure = procedure - clone.save - end - - base_object = gestionnaire.preference_list_dossiers.where(procedure: nil).size - created_object = gestionnaire.preference_list_dossiers.where(procedure: procedure).size - - raise "ERROR nb object (#{base_object} != #{created_object})" if created_object != base_object - end - end - end - - def down - PreferenceListDossier.where('procedure_id IS NOT NULL') - end -end diff --git a/db/migrate/20160913093948_add_type_attr_in_invite_table.rb b/db/migrate/20160913093948_add_type_attr_in_invite_table.rb deleted file mode 100644 index a71813a9b..000000000 --- a/db/migrate/20160913093948_add_type_attr_in_invite_table.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddTypeAttrInInviteTable < ActiveRecord::Migration - def change - add_column :invites, :type, :string, default: 'InviteGestionnaire' - end -end diff --git a/db/migrate/20160926160051_change_procedure_filter_attr_in_gestionnaire.rb b/db/migrate/20160926160051_change_procedure_filter_attr_in_gestionnaire.rb deleted file mode 100644 index a52bd1b74..000000000 --- a/db/migrate/20160926160051_change_procedure_filter_attr_in_gestionnaire.rb +++ /dev/null @@ -1,6 +0,0 @@ -class ChangeProcedureFilterAttrInGestionnaire < ActiveRecord::Migration - def change - remove_column :gestionnaires, :procedure_filter - add_column :gestionnaires, :procedure_filter, :integer, default: nil - end -end diff --git a/db/migrate/20160927154248_change_emptyto_nil_in_preference_list_dossier_table.rb b/db/migrate/20160927154248_change_emptyto_nil_in_preference_list_dossier_table.rb deleted file mode 100644 index 7bc555765..000000000 --- a/db/migrate/20160927154248_change_emptyto_nil_in_preference_list_dossier_table.rb +++ /dev/null @@ -1,8 +0,0 @@ -class ChangeEmptytoNilInPreferenceListDossierTable < ActiveRecord::Migration - class PreferenceListDossier < ApplicationRecord - end - - def change - PreferenceListDossier.where(table: '').update_all table: nil - end -end diff --git a/db/migrate/20161004175442_fix_type_de_champ_header_section_with_mandatory_true.rb b/db/migrate/20161004175442_fix_type_de_champ_header_section_with_mandatory_true.rb deleted file mode 100644 index 2282e7e6f..000000000 --- a/db/migrate/20161004175442_fix_type_de_champ_header_section_with_mandatory_true.rb +++ /dev/null @@ -1,10 +0,0 @@ -class FixTypeDeChampHeaderSectionWithMandatoryTrue < ActiveRecord::Migration - class TypeDeChamp < ApplicationRecord - end - - def change - TypeDeChamp.all.each do |type_de_champ| - type_de_champ.update_column(:mandatory, false) if type_de_champ.type_champ == 'header_section' - end - end -end diff --git a/db/migrate/20161005082113_add_individual_with_siret_in_procedure.rb b/db/migrate/20161005082113_add_individual_with_siret_in_procedure.rb deleted file mode 100644 index 408a7c13f..000000000 --- a/db/migrate/20161005082113_add_individual_with_siret_in_procedure.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddIndividualWithSiretInProcedure < ActiveRecord::Migration - def change - add_column :procedures, :individual_with_siret, :boolean, default: false - end -end diff --git a/db/migrate/20161005144657_purge_draft_dossier.rb b/db/migrate/20161005144657_purge_draft_dossier.rb deleted file mode 100644 index 2457d210f..000000000 --- a/db/migrate/20161005144657_purge_draft_dossier.rb +++ /dev/null @@ -1,25 +0,0 @@ -class PurgeDraftDossier < ActiveRecord::Migration - class Dossier < ApplicationRecord - BROUILLON = ['draft'] - - def brouillon? - BROUILLON.include?(state) - end - end - - class Commentaire < ApplicationRecord - belongs_to :dossier - end - - class Cerfa < ApplicationRecord - belongs_to :dossier - belongs_to :user - end - - def change - Cerfa.all.each { |cerfa| cerfa.delete if cerfa.dossier.brouillon? } - Commentaire.all.each { |com| com.delete if com.dossier.brouillon? } - - Dossier.where(state: :draft).destroy_all - end -end diff --git a/db/migrate/20161006085422_add_gender_in_individual_table.rb b/db/migrate/20161006085422_add_gender_in_individual_table.rb deleted file mode 100644 index a60839072..000000000 --- a/db/migrate/20161006085422_add_gender_in_individual_table.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddGenderInIndividualTable < ActiveRecord::Migration - def change - add_column :individuals, :gender, :string - end -end diff --git a/db/migrate/20161007095443_reset_all_preference_list_dossier.rb b/db/migrate/20161007095443_reset_all_preference_list_dossier.rb deleted file mode 100644 index f66180bfa..000000000 --- a/db/migrate/20161007095443_reset_all_preference_list_dossier.rb +++ /dev/null @@ -1,164 +0,0 @@ -class ResetAllPreferenceListDossier < ActiveRecord::Migration - class PreferenceListDossier < ApplicationRecord - belongs_to :gestionnaire - belongs_to :procedure - - def self.available_columns_for(procedure_id = nil) - columns = { - dossier: columns_dossier, - procedure: columns_procedure, - entreprise: columns_entreprise, - etablissement: columns_etablissement, - user: columns_user, - france_connect: columns_france_connect - } - columns - end - - private - - def self.columns_dossier - table = nil - - { - dossier_id: create_column('ID', table, 'id', 'id', 1), - created_at: create_column('Créé le', table, 'created_at', 'first_creation', 2), - updated_at: create_column('Mise à jour le', table, 'updated_at', 'last_update', 2), - state: create_column('Statut', table, 'state', 'display_state', 1) - } - end - - def self.columns_procedure - table = 'procedure' - - { - libelle: create_column('Libellé démarche', table, 'libelle', 'libelle', 4), - organisation: create_column('Organisation', table, 'organisation', 'organisation', 3), - direction: create_column('Direction', table, 'direction', 'direction', 3) - } - end - - def self.columns_entreprise - table = 'entreprise' - - { - siren: create_column('SIREN', table, 'siren', 'siren', 2), - forme_juridique: create_column('Forme juridique', table, 'forme_juridique', 'forme_juridique', 3), - nom_commercial: create_column('Nom commercial', table, 'nom_commercial', 'nom_commercial', 3), - raison_sociale: create_column('Raison sociale', table, 'raison_sociale', 'raison_sociale', 3), - siret_siege_social: create_column('SIRET siège social', table, 'siret_siege_social', 'siret_siege_social', 2), - date_creation: create_column('Date de création', table, 'date_creation', 'date_creation', 2) - } - end - - def self.columns_etablissement - table = 'etablissement' - - { - siret: create_column('SIRET', table, 'siret', 'siret', 2), - libelle: create_column('Nom établissement', table, 'libelle_naf', 'libelle_naf', 3), - code_postal: create_column('Code postal', table, 'code_postal', 'code_postal', 1) - } - end - - def self.columns_user - table = 'user' - { - email: create_column('Email', table, 'email', 'email', 2) - } - end - - def self.columns_france_connect - table = 'france_connect_information' - - { - gender: create_column('Civilité (FC)', table, 'gender', 'gender_fr', 1), - given_name: create_column('Prénom (FC)', table, 'given_name', 'given_name', 2), - family_name: create_column('Nom (FC)', table, 'family_name', 'family_name', 2) - } - end - - def self.create_column(libelle, table, attr, attr_decorate, bootstrap_lg) - { - libelle: libelle, - table: table, - attr: attr, - attr_decorate: attr_decorate, - bootstrap_lg: bootstrap_lg, - order: nil, - filter: nil - } - end - end - - class Gestionnaire < ApplicationRecord - has_many :assign_to, dependent: :destroy - has_many :procedures, through: :assign_to - - def build_default_preferences_list_dossier(procedure_id = nil) - PreferenceListDossier.available_columns_for(procedure_id).each do |table| - table.second.each do |column| - if valid_couple_table_attr? table.first, column.first - PreferenceListDossier.create( - libelle: column.second[:libelle], - table: column.second[:table], - attr: column.second[:attr], - attr_decorate: column.second[:attr_decorate], - bootstrap_lg: column.second[:bootstrap_lg], - order: nil, - filter: nil, - procedure_id: procedure_id, - gestionnaire: self - ) - end - end - end - end - - private - - def valid_couple_table_attr?(table, column) - couples = [ - { - table: :dossier, - column: :dossier_id - }, - { - table: :procedure, - column: :libelle - }, - { - table: :etablissement, - column: :siret - }, - { - table: :entreprise, - column: :raison_sociale - }, - { - table: :dossier, - column: :state - } - ] - - couples.include?({ table: table, column: column }) - end - end - - class Procedure < ApplicationRecord - has_many :assign_to, dependent: :destroy - has_many :gestionnaires, through: :assign_to - end - - def change - PreferenceListDossier.delete_all - - Procedure.all.each do |procedure| - procedure.gestionnaires.each do |gestionnaire| - gestionnaire.build_default_preferences_list_dossier procedure.id - end - end - - Gestionnaire.all.each(&:build_default_preferences_list_dossier) - end -end diff --git a/db/migrate/20161011125345_create_preference_smart_listing_page.rb b/db/migrate/20161011125345_create_preference_smart_listing_page.rb deleted file mode 100644 index 39061ad43..000000000 --- a/db/migrate/20161011125345_create_preference_smart_listing_page.rb +++ /dev/null @@ -1,35 +0,0 @@ -class CreatePreferenceSmartListingPage < ActiveRecord::Migration - class Gestionnaire < ApplicationRecord - has_one :preference_smart_listing_page, dependent: :destroy - - def build_default_preferences_smart_listing_page - PreferenceSmartListingPage.create(page: 1, procedure: nil, gestionnaire: self, liste: 'a_traiter') - end - end - - class PreferenceSmartListingPage < ApplicationRecord - belongs_to :gestionnaire - belongs_to :procedure - - validates :page, presence: true, allow_blank: false, allow_nil: false - validates :liste, presence: true, allow_blank: false, allow_nil: false - validates :procedure, presence: true, allow_blank: true, allow_nil: true - validates :gestionnaire, presence: true, allow_blank: false, allow_nil: false - - validates_uniqueness_of :gestionnaire_id - end - - def change - create_table :preference_smart_listing_pages do |t| - t.string :liste - t.integer :page - end - - add_belongs_to :preference_smart_listing_pages, :procedure - add_belongs_to :preference_smart_listing_pages, :gestionnaire - - Gestionnaire.all.each do |gestionnaire| - gestionnaire.build_default_preferences_smart_listing_page if gestionnaire.preference_smart_listing_page.nil? - end - end -end diff --git a/db/migrate/20161025150900_create_searches.rb b/db/migrate/20161025150900_create_searches.rb deleted file mode 100644 index 3b2ee975f..000000000 --- a/db/migrate/20161025150900_create_searches.rb +++ /dev/null @@ -1,27 +0,0 @@ -class CreateSearches < ActiveRecord::Migration - def up - add_index :champs, :dossier_id - add_index :champs, :type_de_champ_id - add_index :drop_down_lists, :type_de_champ_id - add_index :etablissements, :dossier_id - add_index :entreprises, :dossier_id - add_index :france_connect_informations, :user_id - add_index :individuals, :dossier_id - add_index :pieces_justificatives, :dossier_id - add_index :rna_informations, :entreprise_id - create_view :searches - end - - def down - remove_index :champs, :dossier_id - remove_index :champs, :type_de_champ_id - remove_index :drop_down_lists, :type_de_champ_id - remove_index :etablissements, :dossier_id - remove_index :entreprises, :dossier_id - remove_index :france_connect_informations, :user_id - remove_index :individuals, :dossier_id - remove_index :pieces_justificatives, :dossier_id - remove_index :rna_informations, :entreprise_id - drop_view :searches - end -end diff --git a/db/migrate/20161102154835_update_searches_to_version_2.rb b/db/migrate/20161102154835_update_searches_to_version_2.rb deleted file mode 100644 index 55223b4cf..000000000 --- a/db/migrate/20161102154835_update_searches_to_version_2.rb +++ /dev/null @@ -1,9 +0,0 @@ -class UpdateSearchesToVersion2 < ActiveRecord::Migration - def up - replace_view :searches, version: 2 - end - - def down - replace_view :searches, version: 1 - end -end diff --git a/db/migrate/20161110082244_add_champ_id_to_commentaires.rb b/db/migrate/20161110082244_add_champ_id_to_commentaires.rb deleted file mode 100644 index 1dfc9595f..000000000 --- a/db/migrate/20161110082244_add_champ_id_to_commentaires.rb +++ /dev/null @@ -1,7 +0,0 @@ -class AddChampIdToCommentaires < ActiveRecord::Migration - def change - change_table :commentaires do |t| - t.references :champ, null: true, index: true - end - end -end diff --git a/db/migrate/20161205110427_create_table_preference_devise_profil.rb b/db/migrate/20161205110427_create_table_preference_devise_profil.rb deleted file mode 100644 index 1f1f5c575..000000000 --- a/db/migrate/20161205110427_create_table_preference_devise_profil.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateTablePreferenceDeviseProfil < ActiveRecord::Migration - def change - create_table :preference_devise_profils do |t| - t.string :last_current_devise_profil - end - - add_belongs_to :preference_devise_profils, :administrateurs - add_belongs_to :preference_devise_profils, :gestionnaires - add_belongs_to :preference_devise_profils, :users - end -end diff --git a/db/migrate/20161221153929_create_notification.rb b/db/migrate/20161221153929_create_notification.rb deleted file mode 100644 index b6158499e..000000000 --- a/db/migrate/20161221153929_create_notification.rb +++ /dev/null @@ -1,14 +0,0 @@ -class CreateNotification < ActiveRecord::Migration[5.0] - def change - create_table :notifications do |t| - t.boolean :already_read, default: false - t.string :liste, array: true - t.boolean :multiple, default: false - t.string :type_notif - t.datetime :created_at - t.datetime :updated_at - end - - add_belongs_to :notifications, :dossier - end -end diff --git a/db/migrate/20161227103823_delete_old_attr_in_data_base.rb b/db/migrate/20161227103823_delete_old_attr_in_data_base.rb deleted file mode 100644 index 92fa6a3e9..000000000 --- a/db/migrate/20161227103823_delete_old_attr_in_data_base.rb +++ /dev/null @@ -1,7 +0,0 @@ -class DeleteOldAttrInDataBase < ActiveRecord::Migration[5.0] - def change - remove_column :dossiers, :nom_projet - remove_column :procedures, :test - remove_column :notifications, :multiple - end -end diff --git a/db/migrate/20170118144306_add_lien_to_type_de_piece_justificative.rb b/db/migrate/20170118144306_add_lien_to_type_de_piece_justificative.rb deleted file mode 100644 index 93d970638..000000000 --- a/db/migrate/20170118144306_add_lien_to_type_de_piece_justificative.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddLienToTypeDePieceJustificative < ActiveRecord::Migration[5.0] - def change - add_column :types_de_piece_justificative, :lien_demarche, :string, default: nil - end -end diff --git a/db/migrate/20170215102943_remove_duplicate_email_received.rb b/db/migrate/20170215102943_remove_duplicate_email_received.rb deleted file mode 100644 index af2c6badd..000000000 --- a/db/migrate/20170215102943_remove_duplicate_email_received.rb +++ /dev/null @@ -1,11 +0,0 @@ -class RemoveDuplicateEmailReceived < ActiveRecord::Migration[5.0] - def change - all_mails = MailReceived.all - groupped = all_mails.group_by(&:procedure_id) - filtered = groupped.reject { |_k, v| v.length < 2 } - filtered.each_value do |duplicate_mails| - duplicate_mails.pop - duplicate_mails.each(&:destroy) - end - end -end diff --git a/db/migrate/20170215142944_add_timestamps_to_mail_template.rb b/db/migrate/20170215142944_add_timestamps_to_mail_template.rb deleted file mode 100644 index bbdb2fd2b..000000000 --- a/db/migrate/20170215142944_add_timestamps_to_mail_template.rb +++ /dev/null @@ -1,6 +0,0 @@ -class AddTimestampsToMailTemplate < ActiveRecord::Migration[5.0] - def change - add_column :mail_templates, :created_at, :datetime - add_column :mail_templates, :updated_at, :datetime - end -end diff --git a/db/migrate/20170221143909_remove_useless_dossier_states.rb b/db/migrate/20170221143909_remove_useless_dossier_states.rb deleted file mode 100644 index f907271d5..000000000 --- a/db/migrate/20170221143909_remove_useless_dossier_states.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RemoveUselessDossierStates < ActiveRecord::Migration[5.0] - def change - Dossier.where(state: [:validated, :submitted]).update_all(state: :initiated) - end -end diff --git a/db/migrate/20170223170808_delete_all_mail_validated_in_db.rb b/db/migrate/20170223170808_delete_all_mail_validated_in_db.rb deleted file mode 100644 index dbd8860d1..000000000 --- a/db/migrate/20170223170808_delete_all_mail_validated_in_db.rb +++ /dev/null @@ -1,6 +0,0 @@ -class DeleteAllMailValidatedInDb < ActiveRecord::Migration[5.0] - def change - mail_template_exist = Object.const_get(:MailTemplate).is_a?(Class) rescue false - MailTemplate.where(type: "MailValidated").delete_all if mail_template_exist - end -end diff --git a/db/migrate/20170228144909_add_state_dates_to_dossiers.rb b/db/migrate/20170228144909_add_state_dates_to_dossiers.rb deleted file mode 100644 index b07f022ea..000000000 --- a/db/migrate/20170228144909_add_state_dates_to_dossiers.rb +++ /dev/null @@ -1,7 +0,0 @@ -class AddStateDatesToDossiers < ActiveRecord::Migration[5.0] - def change - add_column :dossiers, :initiated_at, :datetime - add_column :dossiers, :received_at, :datetime - add_column :dossiers, :processed_at, :datetime - end -end diff --git a/db/migrate/20170228150522_move_inet_column_to_string.rb b/db/migrate/20170228150522_move_inet_column_to_string.rb deleted file mode 100644 index cf5a48fdb..000000000 --- a/db/migrate/20170228150522_move_inet_column_to_string.rb +++ /dev/null @@ -1,29 +0,0 @@ -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 diff --git a/db/migrate/20170302105557_create_initiated_mails.rb b/db/migrate/20170302105557_create_initiated_mails.rb deleted file mode 100644 index 91e005e6a..000000000 --- a/db/migrate/20170302105557_create_initiated_mails.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateInitiatedMails < ActiveRecord::Migration[5.0] - def change - create_table :initiated_mails do |t| - t.string :object - t.text :body - t.belongs_to :procedure, index: true, unique: true, foreign_key: true - - t.timestamps - end - end -end diff --git a/db/migrate/20170302112312_remove_deposit_datetime_from_dossiers.rb b/db/migrate/20170302112312_remove_deposit_datetime_from_dossiers.rb deleted file mode 100644 index 823290306..000000000 --- a/db/migrate/20170302112312_remove_deposit_datetime_from_dossiers.rb +++ /dev/null @@ -1,17 +0,0 @@ -class RemoveDepositDatetimeFromDossiers < ActiveRecord::Migration[5.0] - def change - remove_column :dossiers, :deposit_datetime, :datetime - end - - def up - Dossier.where.not(deposit_datetime: nil).each do |dossier| - dossier.update(initiated_at: dossier.deposit_datetime) - end - end - - def down - Dossier.where.not(initiated_at: nil).each do |dossier| - dossier.update(deposit_datetime: dossier.initiated_at) - end - end -end diff --git a/db/migrate/20170306102116_create_received_mails.rb b/db/migrate/20170306102116_create_received_mails.rb deleted file mode 100644 index aaaaefb42..000000000 --- a/db/migrate/20170306102116_create_received_mails.rb +++ /dev/null @@ -1,12 +0,0 @@ -class CreateReceivedMails < ActiveRecord::Migration[5.0] - def change - create_table :received_mails do |t| - t.text :body - t.string :object - t.references :procedure, foreign_key: true - - t.column :created_at, :timestamp, null: true - t.column :updated_at, :timestamp, null: true - end - end -end diff --git a/db/migrate/20170306102238_create_closed_mails.rb b/db/migrate/20170306102238_create_closed_mails.rb deleted file mode 100644 index 49f3bf5e8..000000000 --- a/db/migrate/20170306102238_create_closed_mails.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateClosedMails < ActiveRecord::Migration[5.0] - def change - create_table :closed_mails do |t| - t.text :body - t.string :object - t.belongs_to :procedure, index: true, unique: true, foreign_key: true - - t.timestamps - end - end -end diff --git a/db/migrate/20170306102256_create_refused_mails.rb b/db/migrate/20170306102256_create_refused_mails.rb deleted file mode 100644 index ea7b58846..000000000 --- a/db/migrate/20170306102256_create_refused_mails.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateRefusedMails < ActiveRecord::Migration[5.0] - def change - create_table :refused_mails do |t| - t.text :body - t.string :object - t.belongs_to :procedure, index: true, unique: true, foreign_key: true - - t.timestamps - end - end -end diff --git a/db/migrate/20170306102320_create_without_continuation_mails.rb b/db/migrate/20170306102320_create_without_continuation_mails.rb deleted file mode 100644 index 09dbe1b8e..000000000 --- a/db/migrate/20170306102320_create_without_continuation_mails.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateWithoutContinuationMails < ActiveRecord::Migration[5.0] - def change - create_table :without_continuation_mails do |t| - t.text :body - t.string :object - t.belongs_to :procedure, index: true, unique: true, foreign_key: true - - t.timestamps - end - end -end diff --git a/db/migrate/20170307092820_move_mails_to_new_system.rb b/db/migrate/20170307092820_move_mails_to_new_system.rb deleted file mode 100644 index 02b41ced3..000000000 --- a/db/migrate/20170307092820_move_mails_to_new_system.rb +++ /dev/null @@ -1,11 +0,0 @@ -class MoveMailsToNewSystem < ActiveRecord::Migration[5.0] - def up - execute 'INSERT INTO received_mails (object, body, procedure_id, created_at, updated_at) - SELECT object, body, procedure_id, mail_templates.created_at, mail_templates.updated_at from mail_templates inner join procedures on mail_templates.procedure_id = procedures.id;' - - execute "UPDATE received_mails set created_at='1980-01-01 00:00', updated_at='1980-01-01 00:00' where created_at is NULL" - - change_column_null :received_mails, :created_at, false - change_column_null :received_mails, :updated_at, false - end -end diff --git a/db/migrate/20170313140834_add_auto_archive_to_procedure.rb b/db/migrate/20170313140834_add_auto_archive_to_procedure.rb deleted file mode 100644 index 7d7275651..000000000 --- a/db/migrate/20170313140834_add_auto_archive_to_procedure.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddAutoArchiveToProcedure < ActiveRecord::Migration[5.0] - def change - add_column :procedures, :auto_archive_on, :date - end -end diff --git a/db/migrate/20170328142700_add_mandatory_column_to_types_de_piece_justificative.rb b/db/migrate/20170328142700_add_mandatory_column_to_types_de_piece_justificative.rb deleted file mode 100644 index 46f603b62..000000000 --- a/db/migrate/20170328142700_add_mandatory_column_to_types_de_piece_justificative.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddMandatoryColumnToTypesDePieceJustificative < ActiveRecord::Migration[5.0] - def change - add_column :types_de_piece_justificative, :mandatory, :boolean, default: false - end -end diff --git a/db/migrate/20170414095411_remove_field_limit_for_procedure_paths.rb b/db/migrate/20170414095411_remove_field_limit_for_procedure_paths.rb deleted file mode 100644 index 9de4f3a0b..000000000 --- a/db/migrate/20170414095411_remove_field_limit_for_procedure_paths.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RemoveFieldLimitForProcedurePaths < ActiveRecord::Migration[5.0] - def change - change_column :procedure_paths, :path, :string, limit: nil, null: true, unique: true, index: true - end -end diff --git a/db/migrate/20170425100757_create_avis.rb b/db/migrate/20170425100757_create_avis.rb deleted file mode 100644 index 229be2178..000000000 --- a/db/migrate/20170425100757_create_avis.rb +++ /dev/null @@ -1,13 +0,0 @@ -class CreateAvis < ActiveRecord::Migration[5.0] - def change - create_table :avis do |t| - t.string :email - t.text :introduction - t.text :answer - t.references :gestionnaire - t.references :dossier - - t.timestamps - end - end -end diff --git a/db/migrate/20170523092900_add_claimant_to_avis.rb b/db/migrate/20170523092900_add_claimant_to_avis.rb deleted file mode 100644 index c8a34e182..000000000 --- a/db/migrate/20170523092900_add_claimant_to_avis.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddClaimantToAvis < ActiveRecord::Migration[5.0] - def change - add_reference :avis, :claimant, foreign_key: { to_table: :gestionnaires }, null: false - end -end diff --git a/db/migrate/20170524140630_create_attestation_templates.rb b/db/migrate/20170524140630_create_attestation_templates.rb deleted file mode 100644 index 6517c72ea..000000000 --- a/db/migrate/20170524140630_create_attestation_templates.rb +++ /dev/null @@ -1,16 +0,0 @@ -class CreateAttestationTemplates < ActiveRecord::Migration[5.0] - def change - create_table :attestation_templates do |t| - t.text :title - t.text :body - t.text :footer - t.string :logo - t.string :signature - t.boolean :activated - - t.timestamps - - t.references :procedure, index: { unique: true }, foreign_key: true - end - end -end diff --git a/db/migrate/20170530141608_add_motivation_to_dossier.rb b/db/migrate/20170530141608_add_motivation_to_dossier.rb deleted file mode 100644 index 6ee802630..000000000 --- a/db/migrate/20170530141608_add_motivation_to_dossier.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddMotivationToDossier < ActiveRecord::Migration[5.0] - def change - add_column :dossiers, :motivation, :text - end -end diff --git a/db/migrate/20170601123221_create_attestations.rb b/db/migrate/20170601123221_create_attestations.rb deleted file mode 100644 index 52bf54664..000000000 --- a/db/migrate/20170601123221_create_attestations.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateAttestations < ActiveRecord::Migration[5.0] - def change - create_table :attestations do |t| - t.string :pdf - t.string :title - t.references :dossier, foreign_key: true, null: false - - t.timestamps - end - end -end diff --git a/db/migrate/20170627091953_add_published_at_to_procedure.rb b/db/migrate/20170627091953_add_published_at_to_procedure.rb deleted file mode 100644 index 8f46123e5..000000000 --- a/db/migrate/20170627091953_add_published_at_to_procedure.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddPublishedAtToProcedure < ActiveRecord::Migration[5.0] - def change - add_column :procedures, :published_at, :datetime - end -end diff --git a/db/migrate/20170627120928_add_hidden_at_to_procedures.rb b/db/migrate/20170627120928_add_hidden_at_to_procedures.rb deleted file mode 100644 index a0c109597..000000000 --- a/db/migrate/20170627120928_add_hidden_at_to_procedures.rb +++ /dev/null @@ -1,6 +0,0 @@ -class AddHiddenAtToProcedures < ActiveRecord::Migration[5.0] - def change - add_column :procedures, :hidden_at, :datetime - add_index :procedures, :hidden_at - end -end diff --git a/db/migrate/20170627143701_add_archived_at_to_procedure.rb b/db/migrate/20170627143701_add_archived_at_to_procedure.rb deleted file mode 100644 index ba1bf7890..000000000 --- a/db/migrate/20170627143701_add_archived_at_to_procedure.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddArchivedAtToProcedure < ActiveRecord::Migration[5.0] - def change - add_column :procedures, :archived_at, :datetime - end -end diff --git a/db/migrate/20170627144046_add_hidden_at_to_dossiers.rb b/db/migrate/20170627144046_add_hidden_at_to_dossiers.rb deleted file mode 100644 index b70d02e69..000000000 --- a/db/migrate/20170627144046_add_hidden_at_to_dossiers.rb +++ /dev/null @@ -1,6 +0,0 @@ -class AddHiddenAtToDossiers < ActiveRecord::Migration[5.0] - def change - add_column :dossiers, :hidden_at, :datetime - add_index :dossiers, :hidden_at - end -end diff --git a/db/migrate/20170711125429_remove_published_from_procedures.rb b/db/migrate/20170711125429_remove_published_from_procedures.rb deleted file mode 100644 index 7312fd8dc..000000000 --- a/db/migrate/20170711125429_remove_published_from_procedures.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RemovePublishedFromProcedures < ActiveRecord::Migration[5.0] - def change - remove_column :procedures, :published - end -end diff --git a/db/migrate/20170711125726_remove_archived_from_procedures.rb b/db/migrate/20170711125726_remove_archived_from_procedures.rb deleted file mode 100644 index 0813e0811..000000000 --- a/db/migrate/20170711125726_remove_archived_from_procedures.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RemoveArchivedFromProcedures < ActiveRecord::Migration[5.0] - def change - remove_column :procedures, :archived - end -end diff --git a/db/migrate/20170713151123_add_uniq_constraint_on_gestionnaire_dossier_couple.rb b/db/migrate/20170713151123_add_uniq_constraint_on_gestionnaire_dossier_couple.rb deleted file mode 100644 index d4ce457d0..000000000 --- a/db/migrate/20170713151123_add_uniq_constraint_on_gestionnaire_dossier_couple.rb +++ /dev/null @@ -1,7 +0,0 @@ -class AddUniqConstraintOnGestionnaireDossierCouple < ActiveRecord::Migration[5.0] - def up - change_column_null :follows, :gestionnaire_id, false - change_column_null :follows, :dossier_id, false - add_index :follows, [:gestionnaire_id, :dossier_id], unique: true - end -end diff --git a/db/migrate/20170801083632_add_id_to_assign_to.rb b/db/migrate/20170801083632_add_id_to_assign_to.rb deleted file mode 100644 index 195930ab5..000000000 --- a/db/migrate/20170801083632_add_id_to_assign_to.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddIdToAssignTo < ActiveRecord::Migration[5.0] - def change - add_column :assign_tos, :id, :primary_key - end -end diff --git a/db/migrate/20170908094900_add_confidentiel_field_to_avis.rb b/db/migrate/20170908094900_add_confidentiel_field_to_avis.rb deleted file mode 100644 index eed554510..000000000 --- a/db/migrate/20170908094900_add_confidentiel_field_to_avis.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddConfidentielFieldToAvis < ActiveRecord::Migration[5.0] - def change - add_column :avis, :confidentiel, :boolean, default: false, null: false - end -end diff --git a/db/migrate/20170915080151_create_procedure_presentations.rb b/db/migrate/20170915080151_create_procedure_presentations.rb deleted file mode 100644 index 1798e0b15..000000000 --- a/db/migrate/20170915080151_create_procedure_presentations.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreateProcedurePresentations < ActiveRecord::Migration[5.0] - def change - create_table :procedure_presentations do |t| - t.references :assign_to, index: { unique: true }, foreign_key: true - t.text :displayed_fields, array: true, default: [{ "label" => "Demandeur", "table" => "user", "column" => "email" }.to_json], null: false - t.json :sort, default: { "table" => "self", "column" => "id", "order" => "desc" }.to_json, null: false - t.json :filters, default: { "a-suivre" => [], "suivis" => [], "traites" => [], "tous" => [], "archives" => [] }.to_json, null: false - end - end -end diff --git a/db/migrate/20170926083816_create_delayed_jobs.rb b/db/migrate/20170926083816_create_delayed_jobs.rb deleted file mode 100644 index 130a8d570..000000000 --- a/db/migrate/20170926083816_create_delayed_jobs.rb +++ /dev/null @@ -1,22 +0,0 @@ -class CreateDelayedJobs < ActiveRecord::Migration[5.0] - def self.up - create_table :delayed_jobs, force: true do |table| - table.integer :priority, default: 0, null: false # Allows some jobs to jump to the front of the queue - table.integer :attempts, default: 0, null: false # Provides for retries, but still fail eventually. - table.text :handler, null: false # YAML-encoded string of the object that will do work - table.text :last_error # reason for last failure (See Note below) - table.datetime :run_at # When to run. Could be Time.zone.now for immediately, or sometime in the future. - table.datetime :locked_at # Set when a client is working on this object - table.datetime :failed_at # Set when all retries have failed (actually, by default, the record is deleted instead) - table.string :locked_by # Who is working on this object (if locked) - table.string :queue # The name of the queue this job is in - table.timestamps null: true - end - - add_index :delayed_jobs, [:priority, :run_at], name: "delayed_jobs_priority" - end - - def self.down - drop_table :delayed_jobs - end -end diff --git a/db/migrate/20170926092716_add_cron_to_delayed_jobs.rb b/db/migrate/20170926092716_add_cron_to_delayed_jobs.rb deleted file mode 100644 index 33e89d190..000000000 --- a/db/migrate/20170926092716_add_cron_to_delayed_jobs.rb +++ /dev/null @@ -1,9 +0,0 @@ -class AddCronToDelayedJobs < ActiveRecord::Migration[5.0] - def self.up - add_column :delayed_jobs, :cron, :string - end - - def self.down - remove_column :delayed_jobs, :cron - end -end diff --git a/db/migrate/20171019085515_add_content_secure_token_column_to_attestation.rb b/db/migrate/20171019085515_add_content_secure_token_column_to_attestation.rb deleted file mode 100644 index 8b5f8821f..000000000 --- a/db/migrate/20171019085515_add_content_secure_token_column_to_attestation.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddContentSecureTokenColumnToAttestation < ActiveRecord::Migration[5.0] - def change - add_column :attestations, :content_secure_token, :string - end -end diff --git a/db/migrate/20171019113449_add_logo_secure_token_column_to_attestation_template.rb b/db/migrate/20171019113449_add_logo_secure_token_column_to_attestation_template.rb deleted file mode 100644 index e1bf8462e..000000000 --- a/db/migrate/20171019113449_add_logo_secure_token_column_to_attestation_template.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddLogoSecureTokenColumnToAttestationTemplate < ActiveRecord::Migration[5.0] - def change - add_column :attestation_templates, :logo_secure_token, :string - end -end diff --git a/db/migrate/20171019113610_add_signature_secure_token_column_to_attestation_template.rb b/db/migrate/20171019113610_add_signature_secure_token_column_to_attestation_template.rb deleted file mode 100644 index 84a2509f3..000000000 --- a/db/migrate/20171019113610_add_signature_secure_token_column_to_attestation_template.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddSignatureSecureTokenColumnToAttestationTemplate < ActiveRecord::Migration[5.0] - def change - add_column :attestation_templates, :signature_secure_token, :string - end -end diff --git a/db/migrate/20171024100606_add_time_stamp_to_champs.rb b/db/migrate/20171024100606_add_time_stamp_to_champs.rb deleted file mode 100644 index c144ed4a2..000000000 --- a/db/migrate/20171024100606_add_time_stamp_to_champs.rb +++ /dev/null @@ -1,6 +0,0 @@ -class AddTimeStampToChamps < ActiveRecord::Migration[5.0] - def change - add_column :champs, :created_at, :datetime - add_column :champs, :updated_at, :datetime - end -end diff --git a/db/migrate/20171024101439_add_last_views_at_to_follow.rb b/db/migrate/20171024101439_add_last_views_at_to_follow.rb deleted file mode 100644 index f9f831db8..000000000 --- a/db/migrate/20171024101439_add_last_views_at_to_follow.rb +++ /dev/null @@ -1,8 +0,0 @@ -class AddLastViewsAtToFollow < ActiveRecord::Migration[5.0] - def change - add_column :follows, :demande_seen_at, :datetime - add_column :follows, :annotations_privees_seen_at, :datetime - add_column :follows, :avis_seen_at, :datetime - add_column :follows, :messagerie_seen_at, :datetime - end -end diff --git a/db/migrate/20171024135653_add_column_updated_at_to_piece_justificative.rb b/db/migrate/20171024135653_add_column_updated_at_to_piece_justificative.rb deleted file mode 100644 index 820b41703..000000000 --- a/db/migrate/20171024135653_add_column_updated_at_to_piece_justificative.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddColumnUpdatedAtToPieceJustificative < ActiveRecord::Migration[5.0] - def change - add_column :pieces_justificatives, :updated_at, :datetime - end -end diff --git a/db/migrate/20171030150323_add_file_to_commentaires.rb b/db/migrate/20171030150323_add_file_to_commentaires.rb deleted file mode 100644 index 7e803453e..000000000 --- a/db/migrate/20171030150323_add_file_to_commentaires.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddFileToCommentaires < ActiveRecord::Migration[5.0] - def change - add_column :commentaires, :file, :string - end -end diff --git a/db/migrate/20171117165748_change_procedure_presentation_default.rb b/db/migrate/20171117165748_change_procedure_presentation_default.rb deleted file mode 100644 index 7a8d3e1fd..000000000 --- a/db/migrate/20171117165748_change_procedure_presentation_default.rb +++ /dev/null @@ -1,5 +0,0 @@ -class ChangeProcedurePresentationDefault < ActiveRecord::Migration[5.0] - def change - change_column_default :procedure_presentations, :sort, from: { "table" => "self", "column" => "id", "order" => "desc" }.to_json, to: { "table" => "notifications", "column" => "notifications", "order" => "desc" }.to_json - end -end diff --git a/db/migrate/20171123125346_make_procedures_organisation_not_null.rb b/db/migrate/20171123125346_make_procedures_organisation_not_null.rb deleted file mode 100644 index 011abe7df..000000000 --- a/db/migrate/20171123125346_make_procedures_organisation_not_null.rb +++ /dev/null @@ -1,5 +0,0 @@ -class MakeProceduresOrganisationNotNull < ActiveRecord::Migration[5.0] - def change - change_column_null :procedures, :organisation, false - end -end diff --git a/db/migrate/20171205151128_add_timestamps_to_entreprise.rb b/db/migrate/20171205151128_add_timestamps_to_entreprise.rb deleted file mode 100644 index d4362cb58..000000000 --- a/db/migrate/20171205151128_add_timestamps_to_entreprise.rb +++ /dev/null @@ -1,6 +0,0 @@ -class AddTimestampsToEntreprise < ActiveRecord::Migration[5.0] - def change - add_column :entreprises, :created_at, :datetime - add_column :entreprises, :updated_at, :datetime - end -end diff --git a/db/migrate/20171214112701_rename_dossier_initiated_by_en_construction.rb b/db/migrate/20171214112701_rename_dossier_initiated_by_en_construction.rb deleted file mode 100644 index e547434cd..000000000 --- a/db/migrate/20171214112701_rename_dossier_initiated_by_en_construction.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RenameDossierInitiatedByEnConstruction < ActiveRecord::Migration[5.0] - def change - rename_column :dossiers, :initiated_at, :en_construction_at - end -end diff --git a/db/migrate/20171214155554_rename_dossier_received_at_by_en_instruction_at.rb b/db/migrate/20171214155554_rename_dossier_received_at_by_en_instruction_at.rb deleted file mode 100644 index af84fb67f..000000000 --- a/db/migrate/20171214155554_rename_dossier_received_at_by_en_instruction_at.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RenameDossierReceivedAtByEnInstructionAt < ActiveRecord::Migration[5.0] - def change - rename_column :dossiers, :received_at, :en_instruction_at - end -end diff --git a/db/migrate/20180104150513_add_active_to_administrateurs.rb b/db/migrate/20180104150513_add_active_to_administrateurs.rb deleted file mode 100644 index 5de20b1f3..000000000 --- a/db/migrate/20180104150513_add_active_to_administrateurs.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddActiveToAdministrateurs < ActiveRecord::Migration[5.0] - def change - add_column :administrateurs, :active, :boolean, default: false - end -end diff --git a/db/migrate/20180105152235_add_whitelisted_at_column_to_procedure.rb b/db/migrate/20180105152235_add_whitelisted_at_column_to_procedure.rb deleted file mode 100644 index e6d533cd3..000000000 --- a/db/migrate/20180105152235_add_whitelisted_at_column_to_procedure.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddWhitelistedAtColumnToProcedure < ActiveRecord::Migration[5.0] - def change - add_column :procedures, :whitelisted_at, :datetime - end -end diff --git a/db/migrate/20180108132507_enable_unaccent_postgresql_extension.rb b/db/migrate/20180108132507_enable_unaccent_postgresql_extension.rb deleted file mode 100644 index f7872c27d..000000000 --- a/db/migrate/20180108132507_enable_unaccent_postgresql_extension.rb +++ /dev/null @@ -1,9 +0,0 @@ -class EnableUnaccentPostgresqlExtension < ActiveRecord::Migration[5.0] - def up - execute 'CREATE EXTENSION IF NOT EXISTS unaccent;' - end - - def down - execute 'DROP EXTENSION IF EXISTS unaccent;' - end -end diff --git a/db/migrate/20180108144114_drop_mail_templates_table.rb b/db/migrate/20180108144114_drop_mail_templates_table.rb deleted file mode 100644 index 2aca24d78..000000000 --- a/db/migrate/20180108144114_drop_mail_templates_table.rb +++ /dev/null @@ -1,5 +0,0 @@ -class DropMailTemplatesTable < ActiveRecord::Migration[5.0] - def change - drop_table :mail_templates - end -end diff --git a/db/migrate/20180108152958_rename_object_to_subject_in_mails.rb b/db/migrate/20180108152958_rename_object_to_subject_in_mails.rb deleted file mode 100644 index 6bf91beee..000000000 --- a/db/migrate/20180108152958_rename_object_to_subject_in_mails.rb +++ /dev/null @@ -1,9 +0,0 @@ -class RenameObjectToSubjectInMails < ActiveRecord::Migration[5.0] - def change - rename_column :closed_mails, :object, :subject - rename_column :initiated_mails, :object, :subject - rename_column :received_mails, :object, :subject - rename_column :refused_mails, :object, :subject - rename_column :without_continuation_mails, :object, :subject - end -end diff --git a/db/migrate/20180111153245_drop_preference_devise_profils.rb b/db/migrate/20180111153245_drop_preference_devise_profils.rb deleted file mode 100644 index c8c53cc1b..000000000 --- a/db/migrate/20180111153245_drop_preference_devise_profils.rb +++ /dev/null @@ -1,5 +0,0 @@ -class DropPreferenceDeviseProfils < ActiveRecord::Migration[5.0] - def change - drop_table :preference_devise_profils - end -end diff --git a/db/migrate/20180111153257_drop_preference_list_dossiers.rb b/db/migrate/20180111153257_drop_preference_list_dossiers.rb deleted file mode 100644 index 91b65374e..000000000 --- a/db/migrate/20180111153257_drop_preference_list_dossiers.rb +++ /dev/null @@ -1,5 +0,0 @@ -class DropPreferenceListDossiers < ActiveRecord::Migration[5.0] - def change - drop_table :preference_list_dossiers - end -end diff --git a/db/migrate/20180111153308_drop_preference_smart_listing_pages.rb b/db/migrate/20180111153308_drop_preference_smart_listing_pages.rb deleted file mode 100644 index fac3e1bc8..000000000 --- a/db/migrate/20180111153308_drop_preference_smart_listing_pages.rb +++ /dev/null @@ -1,5 +0,0 @@ -class DropPreferenceSmartListingPages < ActiveRecord::Migration[5.0] - def change - drop_table :preference_smart_listing_pages - end -end diff --git a/db/migrate/20180130180754_create_active_storage_tables.active_storage.rb b/db/migrate/20180130180754_create_active_storage_tables.active_storage.rb deleted file mode 100644 index a3b996c1e..000000000 --- a/db/migrate/20180130180754_create_active_storage_tables.active_storage.rb +++ /dev/null @@ -1,26 +0,0 @@ -# This migration comes from active_storage (originally 20170806125915) -class CreateActiveStorageTables < ActiveRecord::Migration[5.2] - def change - create_table :active_storage_blobs do |t| - t.string :key, null: false - t.string :filename, null: false - t.string :content_type - t.text :metadata - t.bigint :byte_size, null: false - t.string :checksum, null: false - t.datetime :created_at, null: false - - t.index [:key], unique: true - end - - create_table :active_storage_attachments do |t| - t.string :name, null: false - t.references :record, null: false, polymorphic: true, index: false - t.references :blob, null: false - - t.datetime :created_at, null: false - - t.index [:record_type, :record_id, :name, :blob_id], name: "index_active_storage_attachments_uniqueness", unique: true - end - end -end diff --git a/db/migrate/20180201163642_drop_notifications.rb b/db/migrate/20180201163642_drop_notifications.rb deleted file mode 100644 index 05bd9b347..000000000 --- a/db/migrate/20180201163642_drop_notifications.rb +++ /dev/null @@ -1,5 +0,0 @@ -class DropNotifications < ActiveRecord::Migration[5.0] - def change - drop_table :notifications - end -end diff --git a/db/migrate/20180206153121_add_ask_birthday_to_procedure.rb b/db/migrate/20180206153121_add_ask_birthday_to_procedure.rb deleted file mode 100644 index 6dc56e59f..000000000 --- a/db/migrate/20180206153121_add_ask_birthday_to_procedure.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddAskBirthdayToProcedure < ActiveRecord::Migration[5.0] - def change - add_column :procedures, :ask_birthday, :boolean, default: false, null: false - end -end diff --git a/db/migrate/20180209133452_add_private_to_champ_and_type_de_champ.rb b/db/migrate/20180209133452_add_private_to_champ_and_type_de_champ.rb deleted file mode 100644 index 5feb76084..000000000 --- a/db/migrate/20180209133452_add_private_to_champ_and_type_de_champ.rb +++ /dev/null @@ -1,11 +0,0 @@ -class AddPrivateToChampAndTypeDeChamp < ActiveRecord::Migration[5.2] - disable_ddl_transaction! - - def change - add_column :champs, :private, :boolean, index: true - add_column :types_de_champ, :private, :boolean, index: true - - add_index :champs, :private, algorithm: :concurrently - add_index :types_de_champ, :private, algorithm: :concurrently - end -end diff --git a/db/migrate/20180219170553_add_unique_index_on_assign_tos_gestionnaire_id_procedure_id.rb b/db/migrate/20180219170553_add_unique_index_on_assign_tos_gestionnaire_id_procedure_id.rb deleted file mode 100644 index 77efa47ae..000000000 --- a/db/migrate/20180219170553_add_unique_index_on_assign_tos_gestionnaire_id_procedure_id.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddUniqueIndexOnAssignTosGestionnaireIdProcedureId < ActiveRecord::Migration[5.2] - def change - add_index :assign_tos, [:gestionnaire_id, :procedure_id], unique: true - end -end diff --git a/db/migrate/20180221104139_add_entreprise_to_etablissement.rb b/db/migrate/20180221104139_add_entreprise_to_etablissement.rb deleted file mode 100644 index 81889d58c..000000000 --- a/db/migrate/20180221104139_add_entreprise_to_etablissement.rb +++ /dev/null @@ -1,26 +0,0 @@ -class AddEntrepriseToEtablissement < ActiveRecord::Migration[5.2] - def change - add_column :etablissements, :entreprise_siren, :string - add_column :etablissements, :entreprise_capital_social, :integer - add_column :etablissements, :entreprise_numero_tva_intracommunautaire, :string - add_column :etablissements, :entreprise_forme_juridique, :string - add_column :etablissements, :entreprise_forme_juridique_code, :string - add_column :etablissements, :entreprise_nom_commercial, :string - add_column :etablissements, :entreprise_raison_sociale, :string - add_column :etablissements, :entreprise_siret_siege_social, :string - add_column :etablissements, :entreprise_code_effectif_entreprise, :string - add_column :etablissements, :entreprise_date_creation, :date - add_column :etablissements, :entreprise_nom, :string - add_column :etablissements, :entreprise_prenom, :string - - add_column :etablissements, :association_rna, :string - add_column :etablissements, :association_titre, :string - add_column :etablissements, :association_objet, :text - add_column :etablissements, :association_date_creation, :date - add_column :etablissements, :association_date_declaration, :date - add_column :etablissements, :association_date_publication, :date - - add_column :champs, :etablissement_id, :integer, index: true - add_column :exercices, :date_fin_exercice, :datetime - end -end diff --git a/db/migrate/20180226162351_remove_procedure_filter_from_gestionnaires.rb b/db/migrate/20180226162351_remove_procedure_filter_from_gestionnaires.rb deleted file mode 100644 index 95020cb14..000000000 --- a/db/migrate/20180226162351_remove_procedure_filter_from_gestionnaires.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RemoveProcedureFilterFromGestionnaires < ActiveRecord::Migration[5.2] - def change - remove_column :gestionnaires, :procedure_filter, :integer, default: nil - end -end diff --git a/db/migrate/20180301123826_add_webhook_to_procedures.rb b/db/migrate/20180301123826_add_webhook_to_procedures.rb deleted file mode 100644 index 9aba4a9c8..000000000 --- a/db/migrate/20180301123826_add_webhook_to_procedures.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddWebhookToProcedures < ActiveRecord::Migration[5.2] - def change - add_column :procedures, :web_hook_url, :string - end -end diff --git a/db/migrate/20180307101545_change_capital_social_limit.rb b/db/migrate/20180307101545_change_capital_social_limit.rb deleted file mode 100644 index 2fd59e038..000000000 --- a/db/migrate/20180307101545_change_capital_social_limit.rb +++ /dev/null @@ -1,6 +0,0 @@ -class ChangeCapitalSocialLimit < ActiveRecord::Migration[5.2] - def change - change_column :etablissements, :entreprise_capital_social, :integer, limit: 8 - change_column :entreprises, :capital_social, :integer, limit: 8 - end -end diff --git a/db/migrate/20180308110811_add_defaults_to_champs.rb b/db/migrate/20180308110811_add_defaults_to_champs.rb deleted file mode 100644 index f623956fb..000000000 --- a/db/migrate/20180308110811_add_defaults_to_champs.rb +++ /dev/null @@ -1,6 +0,0 @@ -class AddDefaultsToChamps < ActiveRecord::Migration[5.2] - def change - change_column :champs, :private, :boolean, default: false, null: false - change_column :types_de_champ, :private, :boolean, default: false, null: false - end -end diff --git a/db/migrate/20180319154850_remove_mandataire_social_on_dossier.rb b/db/migrate/20180319154850_remove_mandataire_social_on_dossier.rb deleted file mode 100644 index 3d427c7b4..000000000 --- a/db/migrate/20180319154850_remove_mandataire_social_on_dossier.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RemoveMandataireSocialOnDossier < ActiveRecord::Migration[5.2] - def change - remove_column :dossiers, :mandataire_social - end -end diff --git a/db/migrate/20180319214757_add_timestamps_columns.rb b/db/migrate/20180319214757_add_timestamps_columns.rb deleted file mode 100644 index 4794fc06d..000000000 --- a/db/migrate/20180319214757_add_timestamps_columns.rb +++ /dev/null @@ -1,19 +0,0 @@ -class AddTimestampsColumns < ActiveRecord::Migration[5.2] - def change - add_timestamps :assign_tos, null: true - add_timestamps :cadastres, null: true - add_timestamps :drop_down_lists, null: true - add_timestamps :etablissements, null: true - add_timestamps :exercices, null: true - add_timestamps :follows, null: true - add_timestamps :france_connect_informations, null: true - add_timestamps :individuals, null: true - add_timestamps :invites, null: true - add_timestamps :module_api_cartos, null: true - add_timestamps :procedure_paths, null: true - add_timestamps :procedure_presentations, null: true - add_timestamps :quartier_prioritaires, null: true - add_timestamps :rna_informations, null: true - add_timestamps :types_de_champ, null: true - end -end diff --git a/db/migrate/20180323101837_create_join_table_administrateurs_procedures.rb b/db/migrate/20180323101837_create_join_table_administrateurs_procedures.rb deleted file mode 100644 index a77186ac5..000000000 --- a/db/migrate/20180323101837_create_join_table_administrateurs_procedures.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateJoinTableAdministrateursProcedures < ActiveRecord::Migration[5.2] - def change - create_join_table :administrateurs, :procedures do |t| - t.timestamps - - t.index :administrateur_id - t.index :procedure_id - t.index [:administrateur_id, :procedure_id], unique: true, name: :index_unique_admin_proc_couple - end - end -end diff --git a/db/migrate/20180403094135_add_second_birthdate_column_to_individual.rb b/db/migrate/20180403094135_add_second_birthdate_column_to_individual.rb deleted file mode 100644 index a3a8c1c4f..000000000 --- a/db/migrate/20180403094135_add_second_birthdate_column_to_individual.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddSecondBirthdateColumnToIndividual < ActiveRecord::Migration[5.2] - def change - add_column :individuals, :second_birthdate, :date - end -end diff --git a/db/migrate/20180404113409_change_birthdate_type_from_individual.rb b/db/migrate/20180404113409_change_birthdate_type_from_individual.rb deleted file mode 100644 index 0b0e750ec..000000000 --- a/db/migrate/20180404113409_change_birthdate_type_from_individual.rb +++ /dev/null @@ -1,6 +0,0 @@ -class ChangeBirthdateTypeFromIndividual < ActiveRecord::Migration[5.2] - def up - remove_column :individuals, :birthdate, :string - rename_column :individuals, :second_birthdate, :birthdate - end -end diff --git a/db/migrate/20180405131207_create_features.rb b/db/migrate/20180405131207_create_features.rb deleted file mode 100644 index 540d1b4d7..000000000 --- a/db/migrate/20180405131207_create_features.rb +++ /dev/null @@ -1,12 +0,0 @@ -class CreateFeatures < ActiveRecord::Migration[5.2] - def change - create_table :flipflop_features do |t| - t.string :key, null: false - t.boolean :enabled, null: false, default: false - - t.timestamps null: false - end - - add_column :administrateurs, :features, :jsonb, null: false, default: {} - end -end diff --git a/db/migrate/20180411152844_add_cloned_from_library_column_to_procedure.rb b/db/migrate/20180411152844_add_cloned_from_library_column_to_procedure.rb deleted file mode 100644 index 2534b8060..000000000 --- a/db/migrate/20180411152844_add_cloned_from_library_column_to_procedure.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddClonedFromLibraryColumnToProcedure < ActiveRecord::Migration[5.2] - def change - add_column :procedures, :cloned_from_library, :boolean, default: false - end -end diff --git a/db/migrate/20180416120759_create_services.rb b/db/migrate/20180416120759_create_services.rb deleted file mode 100644 index 2af2eca7f..000000000 --- a/db/migrate/20180416120759_create_services.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreateServices < ActiveRecord::Migration[5.2] - def change - create_table :services do |t| - t.string :type_organisme, null: false - t.string :nom, null: false - - t.timestamps - end - end -end diff --git a/db/migrate/20180416122152_add_service_to_procedures.rb b/db/migrate/20180416122152_add_service_to_procedures.rb deleted file mode 100644 index 79c3e919d..000000000 --- a/db/migrate/20180416122152_add_service_to_procedures.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddServiceToProcedures < ActiveRecord::Migration[5.2] - def change - add_reference :procedures, :service, foreign_key: true - end -end diff --git a/db/migrate/20180418094115_update_searches_to_version_3.rb b/db/migrate/20180418094115_update_searches_to_version_3.rb deleted file mode 100644 index f9736b4a0..000000000 --- a/db/migrate/20180418094115_update_searches_to_version_3.rb +++ /dev/null @@ -1,9 +0,0 @@ -class UpdateSearchesToVersion3 < ActiveRecord::Migration[5.2] - def up - replace_view :searches, version: 3 - end - - def down - replace_view :searches, version: 2 - end -end diff --git a/db/migrate/20180419093104_add_administrateur_to_services.rb b/db/migrate/20180419093104_add_administrateur_to_services.rb deleted file mode 100644 index a60ed5356..000000000 --- a/db/migrate/20180419093104_add_administrateur_to_services.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddAdministrateurToServices < ActiveRecord::Migration[5.2] - def change - add_reference :services, :administrateur, foreign_key: true - end -end diff --git a/db/migrate/20180423102102_add_unique_index_to_services.rb b/db/migrate/20180423102102_add_unique_index_to_services.rb deleted file mode 100644 index 50feedb51..000000000 --- a/db/migrate/20180423102102_add_unique_index_to_services.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddUniqueIndexToServices < ActiveRecord::Migration[5.2] - def change - add_index :services, [:administrateur_id, :nom], unique: true - end -end diff --git a/db/migrate/20180423141411_add_test_started_at_to_procedures.rb b/db/migrate/20180423141411_add_test_started_at_to_procedures.rb deleted file mode 100644 index d42154c5e..000000000 --- a/db/migrate/20180423141411_add_test_started_at_to_procedures.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddTestStartedAtToProcedures < ActiveRecord::Migration[5.2] - def change - add_column :procedures, :test_started_at, :datetime, index: true - end -end diff --git a/db/migrate/20180424130548_add_parent_procedure_to_procedures.rb b/db/migrate/20180424130548_add_parent_procedure_to_procedures.rb deleted file mode 100644 index e3cd545bc..000000000 --- a/db/migrate/20180424130548_add_parent_procedure_to_procedures.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddParentProcedureToProcedures < ActiveRecord::Migration[5.2] - def change - add_reference :procedures, :parent_procedure, foreign_key: { to_table: :procedures } - end -end diff --git a/db/migrate/20180502092852_remove_parent_procedure_foreign_key.rb b/db/migrate/20180502092852_remove_parent_procedure_foreign_key.rb deleted file mode 100644 index 5b466f851..000000000 --- a/db/migrate/20180502092852_remove_parent_procedure_foreign_key.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RemoveParentProcedureForeignKey < ActiveRecord::Migration[5.2] - def change - remove_foreign_key :procedures, column: "parent_procedure_id" - end -end diff --git a/db/migrate/20180502104006_add_cadre_juridique_to_procedure.rb b/db/migrate/20180502104006_add_cadre_juridique_to_procedure.rb deleted file mode 100644 index 91cd50287..000000000 --- a/db/migrate/20180502104006_add_cadre_juridique_to_procedure.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddCadreJuridiqueToProcedure < ActiveRecord::Migration[5.2] - def change - add_column :procedures, :cadre_juridique, :string - end -end diff --git a/db/migrate/20180509152919_add_columns_to_service.rb b/db/migrate/20180509152919_add_columns_to_service.rb deleted file mode 100644 index 00ced36ec..000000000 --- a/db/migrate/20180509152919_add_columns_to_service.rb +++ /dev/null @@ -1,9 +0,0 @@ -class AddColumnsToService < ActiveRecord::Migration[5.2] - def change - add_column :services, :organisme, :string - add_column :services, :email, :string - add_column :services, :telephone, :string - add_column :services, :horaires, :text - add_column :services, :adresse, :text - end -end diff --git a/db/migrate/20180511100229_allow_procedure_organisme_to_be_null.rb b/db/migrate/20180511100229_allow_procedure_organisme_to_be_null.rb deleted file mode 100644 index bb60fa2c3..000000000 --- a/db/migrate/20180511100229_allow_procedure_organisme_to_be_null.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AllowProcedureOrganismeToBeNull < ActiveRecord::Migration[5.2] - def change - change_column_null :procedures, :organisation, true - end -end diff --git a/db/migrate/20180511124302_create_virus_scans.rb b/db/migrate/20180511124302_create_virus_scans.rb deleted file mode 100644 index 80e8e4380..000000000 --- a/db/migrate/20180511124302_create_virus_scans.rb +++ /dev/null @@ -1,12 +0,0 @@ -class CreateVirusScans < ActiveRecord::Migration[5.2] - def change - create_table :virus_scans do |t| - t.datetime :scanned_at - t.string :status - t.references :champ, index: true - t.string :blob_key - - t.timestamps - end - end -end diff --git a/db/migrate/20180514091001_add_confirmable_to_user_devise.rb b/db/migrate/20180514091001_add_confirmable_to_user_devise.rb deleted file mode 100644 index 5aa95d2eb..000000000 --- a/db/migrate/20180514091001_add_confirmable_to_user_devise.rb +++ /dev/null @@ -1,18 +0,0 @@ -class AddConfirmableToUserDevise < ActiveRecord::Migration[5.2] - def up - add_column :users, :confirmation_token, :string - add_column :users, :confirmed_at, :datetime - add_column :users, :confirmation_sent_at, :datetime - add_index :users, :confirmation_token, unique: true - # User.reset_column_information # Need for some types of updates, but not for update_all. - # To avoid a short time window between running the migration and updating all existing - # users as confirmed, do the following - User.all.update_all confirmed_at: Time.zone.now - # All existing user accounts should be able to log in after this. - end - - def down - remove_columns :users, :confirmation_token, :confirmed_at, :confirmation_sent_at - # remove_columns :users, :unconfirmed_email # Only if using reconfirmable - end -end diff --git a/db/migrate/20180515135415_add_aasm_state_to_procedures.rb b/db/migrate/20180515135415_add_aasm_state_to_procedures.rb deleted file mode 100644 index b290b0c08..000000000 --- a/db/migrate/20180515135415_add_aasm_state_to_procedures.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddAasmStateToProcedures < ActiveRecord::Migration[5.2] - def change - add_column :procedures, :aasm_state, :string, index: true, default: :brouillon - end -end diff --git a/db/migrate/20180516155238_add_test_procedure_to_procedure_paths.rb b/db/migrate/20180516155238_add_test_procedure_to_procedure_paths.rb deleted file mode 100644 index fbc80c7d0..000000000 --- a/db/migrate/20180516155238_add_test_procedure_to_procedure_paths.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddTestProcedureToProcedurePaths < ActiveRecord::Migration[5.2] - def change - add_reference :procedure_paths, :test_procedure - end -end diff --git a/db/migrate/20180522142109_add_retention_times_to_procedure.rb b/db/migrate/20180522142109_add_retention_times_to_procedure.rb deleted file mode 100644 index 7b4d847b0..000000000 --- a/db/migrate/20180522142109_add_retention_times_to_procedure.rb +++ /dev/null @@ -1,6 +0,0 @@ -class AddRetentionTimesToProcedure < ActiveRecord::Migration[5.2] - def change - add_column :procedures, :duree_conservation_dossiers_dans_ds, :integer - add_column :procedures, :duree_conservation_dossiers_hors_ds, :integer - end -end diff --git a/db/migrate/20180524201142_add_durees_conservation_required_to_procedure.rb b/db/migrate/20180524201142_add_durees_conservation_required_to_procedure.rb deleted file mode 100644 index b63975aba..000000000 --- a/db/migrate/20180524201142_add_durees_conservation_required_to_procedure.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddDureesConservationRequiredToProcedure < ActiveRecord::Migration[5.2] - def change - add_column :procedures, :durees_conservation_required, :boolean, default: true - end -end diff --git a/db/migrate/20180530095508_create_deleted_dossiers.rb b/db/migrate/20180530095508_create_deleted_dossiers.rb deleted file mode 100644 index 9558b23d6..000000000 --- a/db/migrate/20180530095508_create_deleted_dossiers.rb +++ /dev/null @@ -1,12 +0,0 @@ -class CreateDeletedDossiers < ActiveRecord::Migration[5.2] - def change - create_table :deleted_dossiers do |t| - t.references :procedure - t.bigint :dossier_id - t.datetime :deleted_at - t.string :state - - t.timestamps - end - end -end diff --git a/db/migrate/20180601084546_add_juridique_required_column_to_procedure.rb b/db/migrate/20180601084546_add_juridique_required_column_to_procedure.rb deleted file mode 100644 index 3c915b158..000000000 --- a/db/migrate/20180601084546_add_juridique_required_column_to_procedure.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddJuridiqueRequiredColumnToProcedure < ActiveRecord::Migration[5.2] - def change - add_column :procedures, :juridique_required, :boolean, default: true - end -end diff --git a/db/migrate/20180627092237_update_searches_to_version_4.rb b/db/migrate/20180627092237_update_searches_to_version_4.rb deleted file mode 100644 index 92bc9a8b7..000000000 --- a/db/migrate/20180627092237_update_searches_to_version_4.rb +++ /dev/null @@ -1,9 +0,0 @@ -class UpdateSearchesToVersion4 < ActiveRecord::Migration[5.2] - def up - replace_view :searches, version: 4 - end - - def down - replace_view :searches, version: 3 - end -end diff --git a/db/migrate/20180718133126_create_task_records.rb b/db/migrate/20180718133126_create_task_records.rb deleted file mode 100644 index ce6d2441b..000000000 --- a/db/migrate/20180718133126_create_task_records.rb +++ /dev/null @@ -1,7 +0,0 @@ -class CreateTaskRecords < ActiveRecord::Migration[5.2] - def change - create_table :task_records, id: false do |t| - t.string :version, null: false - end - end -end diff --git a/db/migrate/20180719125038_add_siret_to_services.rb b/db/migrate/20180719125038_add_siret_to_services.rb deleted file mode 100644 index 275be8b54..000000000 --- a/db/migrate/20180719125038_add_siret_to_services.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddSiretToServices < ActiveRecord::Migration[5.2] - def change - add_column :services, :siret, :string - end -end diff --git a/db/migrate/20180724153247_add_search_terms_to_dossiers.rb b/db/migrate/20180724153247_add_search_terms_to_dossiers.rb deleted file mode 100644 index 5986e6953..000000000 --- a/db/migrate/20180724153247_add_search_terms_to_dossiers.rb +++ /dev/null @@ -1,8 +0,0 @@ -class AddSearchTermsToDossiers < ActiveRecord::Migration[5.2] - def change - add_column :dossiers, :search_terms, :text - add_column :dossiers, :private_search_terms, :text - add_index :dossiers, "to_tsvector('french', search_terms)", using: :gin, name: 'index_dossiers_on_search_terms' - add_index :dossiers, "to_tsvector('french', search_terms || private_search_terms)", using: :gin, name: 'index_dossiers_on_search_terms_private_search_terms' - end -end diff --git a/db/migrate/20180808142237_create_feedbacks.rb b/db/migrate/20180808142237_create_feedbacks.rb deleted file mode 100644 index b79ed6dc3..000000000 --- a/db/migrate/20180808142237_create_feedbacks.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreateFeedbacks < ActiveRecord::Migration[5.2] - def change - create_table :feedbacks do |t| - t.references :user, foreign_key: true - t.integer :mark - - t.timestamps - end - end -end diff --git a/db/migrate/20180822162952_drop_cerfas.rb b/db/migrate/20180822162952_drop_cerfas.rb deleted file mode 100644 index 0a48c0adb..000000000 --- a/db/migrate/20180822162952_drop_cerfas.rb +++ /dev/null @@ -1,5 +0,0 @@ -class DropCerfas < ActiveRecord::Migration[5.2] - def change - drop_table :cerfas - end -end diff --git a/db/migrate/20180824142849_add_encrypted_token_column_to_administrateur.rb b/db/migrate/20180824142849_add_encrypted_token_column_to_administrateur.rb deleted file mode 100644 index 4e7676cf5..000000000 --- a/db/migrate/20180824142849_add_encrypted_token_column_to_administrateur.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddEncryptedTokenColumnToAdministrateur < ActiveRecord::Migration[5.2] - def change - add_column :administrateurs, :encrypted_token, :string - end -end diff --git a/db/migrate/20180827102828_add_rating_to_feedbacks.rb b/db/migrate/20180827102828_add_rating_to_feedbacks.rb deleted file mode 100644 index cc3c0c97d..000000000 --- a/db/migrate/20180827102828_add_rating_to_feedbacks.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddRatingToFeedbacks < ActiveRecord::Migration[5.2] - def change - add_column :feedbacks, :rating, :string - end -end diff --git a/db/migrate/20180827111328_make_feedbacks_rating_not_null.rb b/db/migrate/20180827111328_make_feedbacks_rating_not_null.rb deleted file mode 100644 index 5a3d0d818..000000000 --- a/db/migrate/20180827111328_make_feedbacks_rating_not_null.rb +++ /dev/null @@ -1,5 +0,0 @@ -class MakeFeedbacksRatingNotNull < ActiveRecord::Migration[5.2] - def change - change_column_null :feedbacks, :rating, false - end -end diff --git a/db/migrate/20180827111451_remove_mark_on_feedbacks.rb b/db/migrate/20180827111451_remove_mark_on_feedbacks.rb deleted file mode 100644 index 8f6a4ec6a..000000000 --- a/db/migrate/20180827111451_remove_mark_on_feedbacks.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RemoveMarkOnFeedbacks < ActiveRecord::Migration[5.2] - def change - remove_column :feedbacks, :mark - end -end diff --git a/db/migrate/20180913160415_add_path_to_procedures.rb b/db/migrate/20180913160415_add_path_to_procedures.rb deleted file mode 100644 index d44c06cda..000000000 --- a/db/migrate/20180913160415_add_path_to_procedures.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddPathToProcedures < ActiveRecord::Migration[5.2] - def change - add_column :procedures, :path, :string, index: true - end -end diff --git a/db/migrate/20180919084403_change_procedure_presentation_fields_to_jsonb.rb b/db/migrate/20180919084403_change_procedure_presentation_fields_to_jsonb.rb deleted file mode 100644 index df00c18f6..000000000 --- a/db/migrate/20180919084403_change_procedure_presentation_fields_to_jsonb.rb +++ /dev/null @@ -1,10 +0,0 @@ -class ChangeProcedurePresentationFieldsToJsonb < ActiveRecord::Migration[5.2] - def change - change_table(:procedure_presentations) do |t| - t.rename :displayed_fields, :old_displayed_fields - t.column :displayed_fields, :jsonb, null: false, default: [{ label: "Demandeur", table: "user", column: "email" }] - t.change :sort, :jsonb, default: { table: "notifications", column: "notifications", order: "desc" } - t.change :filters, :jsonb, default: { "a-suivre": [], suivis: [], traites: [], tous: [], archives: [] } - end - end -end diff --git a/db/migrate/20180924074121_drop_entreprises.rb b/db/migrate/20180924074121_drop_entreprises.rb deleted file mode 100644 index d15bb323b..000000000 --- a/db/migrate/20180924074121_drop_entreprises.rb +++ /dev/null @@ -1,5 +0,0 @@ -class DropEntreprises < ActiveRecord::Migration[5.2] - def change - drop_table :entreprises - end -end diff --git a/db/migrate/20180926145604_delete_api_token_column_from_administrateur.rb b/db/migrate/20180926145604_delete_api_token_column_from_administrateur.rb deleted file mode 100644 index 4d94d165c..000000000 --- a/db/migrate/20180926145604_delete_api_token_column_from_administrateur.rb +++ /dev/null @@ -1,5 +0,0 @@ -class DeleteAPITokenColumnFromAdministrateur < ActiveRecord::Migration[5.2] - def change - remove_column :administrateurs, :api_token, :string - end -end diff --git a/db/migrate/20181002162757_drop_search_view.rb b/db/migrate/20181002162757_drop_search_view.rb deleted file mode 100644 index 3db48750b..000000000 --- a/db/migrate/20181002162757_drop_search_view.rb +++ /dev/null @@ -1,5 +0,0 @@ -class DropSearchView < ActiveRecord::Migration[5.2] - def change - drop_view :searches, revert_to_version: 4 - end -end diff --git a/db/migrate/20181002164310_remove_old_displayed_fields_from_procedure_presentations.rb b/db/migrate/20181002164310_remove_old_displayed_fields_from_procedure_presentations.rb deleted file mode 100644 index f77f9de26..000000000 --- a/db/migrate/20181002164310_remove_old_displayed_fields_from_procedure_presentations.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RemoveOldDisplayedFieldsFromProcedurePresentations < ActiveRecord::Migration[5.2] - def change - remove_column :procedure_presentations, :old_displayed_fields - end -end diff --git a/db/migrate/20181010070424_remove_type_from_invites.rb b/db/migrate/20181010070424_remove_type_from_invites.rb deleted file mode 100644 index 69fab420f..000000000 --- a/db/migrate/20181010070424_remove_type_from_invites.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RemoveTypeFromInvites < ActiveRecord::Migration[5.2] - def change - remove_column :invites, :type - end -end diff --git a/db/migrate/20181010183331_create_geo_areas.rb b/db/migrate/20181010183331_create_geo_areas.rb deleted file mode 100644 index b634e5c67..000000000 --- a/db/migrate/20181010183331_create_geo_areas.rb +++ /dev/null @@ -1,14 +0,0 @@ -class CreateGeoAreas < ActiveRecord::Migration[5.2] - def change - create_table :geo_areas do |t| - t.string :source, index: true - - t.jsonb :geometry - t.jsonb :properties - - t.references :champ, foreign_key: true, index: true - end - - add_column :types_de_champ, :options, :jsonb - end -end diff --git a/db/migrate/20181030103913_add_geo_id_to_geo_areas.rb b/db/migrate/20181030103913_add_geo_id_to_geo_areas.rb deleted file mode 100644 index ce8fd73d2..000000000 --- a/db/migrate/20181030103913_add_geo_id_to_geo_areas.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddGeoIdToGeoAreas < ActiveRecord::Migration[5.2] - def change - add_column :geo_areas, :geo_reference_id, :string - end -end diff --git a/db/migrate/20181030141238_drop_procedure_paths.rb b/db/migrate/20181030141238_drop_procedure_paths.rb deleted file mode 100644 index 473ac329f..000000000 --- a/db/migrate/20181030141238_drop_procedure_paths.rb +++ /dev/null @@ -1,5 +0,0 @@ -class DropProcedurePaths < ActiveRecord::Migration[5.2] - def change - drop_table :procedure_paths - end -end diff --git a/db/migrate/20181031100150_add_migrated_to_module_api_cartos.rb b/db/migrate/20181031100150_add_migrated_to_module_api_cartos.rb deleted file mode 100644 index 8735ab8e0..000000000 --- a/db/migrate/20181031100150_add_migrated_to_module_api_cartos.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddMigratedToModuleAPICartos < ActiveRecord::Migration[5.2] - def change - add_column :module_api_cartos, :migrated, :boolean - end -end diff --git a/db/migrate/20181108091339_add_encrypted_login_token_column_to_gestionnaire.rb b/db/migrate/20181108091339_add_encrypted_login_token_column_to_gestionnaire.rb deleted file mode 100644 index 9d92083f8..000000000 --- a/db/migrate/20181108091339_add_encrypted_login_token_column_to_gestionnaire.rb +++ /dev/null @@ -1,6 +0,0 @@ -class AddEncryptedLoginTokenColumnToGestionnaire < ActiveRecord::Migration[5.2] - def change - add_column :gestionnaires, :encrypted_login_token, :text - add_column :gestionnaires, :login_token_created_at, :datetime - end -end diff --git a/db/migrate/20181108151929_add_features_column_to_gestionnaires.rb b/db/migrate/20181108151929_add_features_column_to_gestionnaires.rb deleted file mode 100644 index c90c6ebb6..000000000 --- a/db/migrate/20181108151929_add_features_column_to_gestionnaires.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddFeaturesColumnToGestionnaires < ActiveRecord::Migration[5.2] - def change - add_column :gestionnaires, :features, :jsonb, null: false, default: {} - end -end diff --git a/db/migrate/20181121234008_remove_champ_id_from_commentaires.rb b/db/migrate/20181121234008_remove_champ_id_from_commentaires.rb deleted file mode 100644 index e8bb7f80d..000000000 --- a/db/migrate/20181121234008_remove_champ_id_from_commentaires.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RemoveChampIdFromCommentaires < ActiveRecord::Migration[5.2] - def change - remove_column :commentaires, :champ_id - end -end diff --git a/db/migrate/20181123181020_add_stable_id_to_types_de_champ.rb b/db/migrate/20181123181020_add_stable_id_to_types_de_champ.rb deleted file mode 100644 index 958eb90a2..000000000 --- a/db/migrate/20181123181020_add_stable_id_to_types_de_champ.rb +++ /dev/null @@ -1,6 +0,0 @@ -class AddStableIdToTypesDeChamp < ActiveRecord::Migration[5.2] - def change - add_column :types_de_champ, :stable_id, :bigint - add_index :types_de_champ, :stable_id - end -end diff --git a/db/migrate/20181123195208_create_dossier_operation_logs.rb b/db/migrate/20181123195208_create_dossier_operation_logs.rb deleted file mode 100644 index 7a6003219..000000000 --- a/db/migrate/20181123195208_create_dossier_operation_logs.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateDossierOperationLogs < ActiveRecord::Migration[5.2] - def change - create_table :dossier_operation_logs do |t| - t.string :operation, null: false - t.references :dossier, foreign_key: true, index: true - t.references :gestionnaire, foreign_key: true, index: true - - t.timestamps - end - end -end diff --git a/db/migrate/20181204125101_add_user_id_to_commentaires.rb b/db/migrate/20181204125101_add_user_id_to_commentaires.rb deleted file mode 100644 index 0ba86c3a0..000000000 --- a/db/migrate/20181204125101_add_user_id_to_commentaires.rb +++ /dev/null @@ -1,9 +0,0 @@ -class AddUserIdToCommentaires < ActiveRecord::Migration[5.2] - def change - add_column :commentaires, :user_id, :bigint - add_column :commentaires, :gestionnaire_id, :bigint - - add_index :commentaires, :user_id - add_index :commentaires, :gestionnaire_id - end -end diff --git a/db/migrate/20181217125100_create_champ_groups.rb b/db/migrate/20181217125100_create_champ_groups.rb deleted file mode 100644 index ac55a12e8..000000000 --- a/db/migrate/20181217125100_create_champ_groups.rb +++ /dev/null @@ -1,15 +0,0 @@ -class CreateChampGroups < ActiveRecord::Migration[5.2] - def change - add_column :types_de_champ, :parent_id, :bigint - add_index :types_de_champ, :parent_id - - add_column :champs, :parent_id, :bigint - add_index :champs, :parent_id - - add_column :champs, :row, :integer - add_index :champs, :row - - add_foreign_key :types_de_champ, :types_de_champ, column: :parent_id - add_foreign_key :champs, :champs, column: :parent_id - end -end diff --git a/db/migrate/20181218103212_drop_old_carto.rb b/db/migrate/20181218103212_drop_old_carto.rb deleted file mode 100644 index 351ac155b..000000000 --- a/db/migrate/20181218103212_drop_old_carto.rb +++ /dev/null @@ -1,6 +0,0 @@ -class DropOldCarto < ActiveRecord::Migration[5.2] - def change - drop_table :cadastres - drop_table :quartier_prioritaires - end -end diff --git a/db/migrate/20181218204707_add_missing_timestamps.rb b/db/migrate/20181218204707_add_missing_timestamps.rb deleted file mode 100644 index 0bf3ec998..000000000 --- a/db/migrate/20181218204707_add_missing_timestamps.rb +++ /dev/null @@ -1,6 +0,0 @@ -class AddMissingTimestamps < ActiveRecord::Migration[5.2] - def change - add_timestamps :administrateurs_gestionnaires, null: true - add_timestamps :geo_areas, null: true - end -end diff --git a/db/migrate/20181221103901_drop_rna_informations.rb b/db/migrate/20181221103901_drop_rna_informations.rb deleted file mode 100644 index 39bd0d75c..000000000 --- a/db/migrate/20181221103901_drop_rna_informations.rb +++ /dev/null @@ -1,5 +0,0 @@ -class DropRNAInformations < ActiveRecord::Migration[5.2] - def change - drop_table :rna_informations - end -end diff --git a/db/migrate/20190110163655_add_automatic_operation_column_to_dossier_operation_log.rb b/db/migrate/20190110163655_add_automatic_operation_column_to_dossier_operation_log.rb deleted file mode 100644 index 2d934bb79..000000000 --- a/db/migrate/20190110163655_add_automatic_operation_column_to_dossier_operation_log.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddAutomaticOperationColumnToDossierOperationLog < ActiveRecord::Migration[5.2] - def change - add_column :dossier_operation_logs, :automatic_operation, :bool, default: false, null: false - end -end diff --git a/db/migrate/20190201164951_create_trusted_device_tokens.rb b/db/migrate/20190201164951_create_trusted_device_tokens.rb deleted file mode 100644 index c53bec685..000000000 --- a/db/migrate/20190201164951_create_trusted_device_tokens.rb +++ /dev/null @@ -1,11 +0,0 @@ -class CreateTrustedDeviceTokens < ActiveRecord::Migration[5.2] - def change - create_table :trusted_device_tokens do |t| - t.string :token, null: false - t.references :gestionnaire, foreign_key: true - - t.timestamps - end - add_index :trusted_device_tokens, :token, unique: true - end -end diff --git a/db/migrate/20190213144145_add_administration_column_to_log_dossier_operation.rb b/db/migrate/20190213144145_add_administration_column_to_log_dossier_operation.rb deleted file mode 100644 index cfaf6aa1f..000000000 --- a/db/migrate/20190213144145_add_administration_column_to_log_dossier_operation.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddAdministrationColumnToLogDossierOperation < ActiveRecord::Migration[5.2] - def change - add_reference :dossier_operation_logs, :administration, foreign_key: true - end -end diff --git a/db/migrate/20190226105641_add_procedure_id_index_to_types_de_champ.rb b/db/migrate/20190226105641_add_procedure_id_index_to_types_de_champ.rb deleted file mode 100644 index 52fe10271..000000000 --- a/db/migrate/20190226105641_add_procedure_id_index_to_types_de_champ.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddProcedureIdIndexToTypesDeChamp < ActiveRecord::Migration[5.2] - def change - add_index :types_de_champ, :procedure_id - end -end diff --git a/db/migrate/20190226160356_add_procedure_id_index_to_types_de_piece_justificative.rb b/db/migrate/20190226160356_add_procedure_id_index_to_types_de_piece_justificative.rb deleted file mode 100644 index bc4579cd2..000000000 --- a/db/migrate/20190226160356_add_procedure_id_index_to_types_de_piece_justificative.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddProcedureIdIndexToTypesDePieceJustificative < ActiveRecord::Migration[5.2] - def change - add_index :types_de_piece_justificative, :procedure_id - end -end diff --git a/db/migrate/20190311140926_remove_type_from_types_de_champ.rb b/db/migrate/20190311140926_remove_type_from_types_de_champ.rb deleted file mode 100644 index ad7878f8e..000000000 --- a/db/migrate/20190311140926_remove_type_from_types_de_champ.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RemoveTypeFromTypesDeChamp < ActiveRecord::Migration[5.2] - def change - remove_column :types_de_champ, :type, :string - end -end diff --git a/db/migrate/20190318154812_add_email_notifications_column_to_assign_to.rb b/db/migrate/20190318154812_add_email_notifications_column_to_assign_to.rb deleted file mode 100644 index 9443922fc..000000000 --- a/db/migrate/20190318154812_add_email_notifications_column_to_assign_to.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddEmailNotificationsColumnToAssignTo < ActiveRecord::Migration[5.2] - def change - add_column :assign_tos, :email_notifications_enabled, :boolean, default: false, null: false - end -end diff --git a/db/migrate/20190327102357_add_expects_multiple_submissions_column_to_procedure.rb b/db/migrate/20190327102357_add_expects_multiple_submissions_column_to_procedure.rb deleted file mode 100644 index 4dadc63fb..000000000 --- a/db/migrate/20190327102357_add_expects_multiple_submissions_column_to_procedure.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddExpectsMultipleSubmissionsColumnToProcedure < ActiveRecord::Migration[5.2] - def change - add_column :procedures, :expects_multiple_submissions, :boolean, default: false, null: false - end -end diff --git a/db/migrate/20190327102360_add_digest_and_timestamps_to_dossier_operation_logs.rb b/db/migrate/20190327102360_add_digest_and_timestamps_to_dossier_operation_logs.rb deleted file mode 100644 index 235e78f78..000000000 --- a/db/migrate/20190327102360_add_digest_and_timestamps_to_dossier_operation_logs.rb +++ /dev/null @@ -1,8 +0,0 @@ -class AddDigestAndTimestampsToDossierOperationLogs < ActiveRecord::Migration[5.2] - def change - add_column :dossier_operation_logs, :keep_until, :datetime - add_column :dossier_operation_logs, :executed_at, :datetime - add_column :dossier_operation_logs, :digest, :text - add_index :dossier_operation_logs, :keep_until - end -end diff --git a/db/migrate/20190409132006_create_action_text_tables.action_text.rb b/db/migrate/20190409132006_create_action_text_tables.action_text.rb deleted file mode 100644 index a749b0d6e..000000000 --- a/db/migrate/20190409132006_create_action_text_tables.action_text.rb +++ /dev/null @@ -1,15 +0,0 @@ -# This migration comes from action_text (originally 201805281641) -class CreateActionTextTables < ActiveRecord::Migration[5.2] - def change - create_table :action_text_rich_texts do |t| - t.string :name, null: false - t.text :body, limit: 16777215 - t.references :record, null: false, polymorphic: true, index: false - - t.datetime :created_at, null: false - t.datetime :updated_at, null: false - - t.index [:record_type, :record_id, :name], name: "index_action_text_rich_texts_uniqueness", unique: true - end - end -end diff --git a/db/migrate/20190522131959_add_lockable_to_devise.rb b/db/migrate/20190522131959_add_lockable_to_devise.rb deleted file mode 100644 index c83dc6696..000000000 --- a/db/migrate/20190522131959_add_lockable_to_devise.rb +++ /dev/null @@ -1,23 +0,0 @@ -class AddLockableToDevise < ActiveRecord::Migration[5.2] - def change - add_column :users, :failed_attempts, :integer, default: 0, null: false - add_column :users, :unlock_token, :string - add_column :users, :locked_at, :datetime - add_index :users, :unlock_token, unique: true - - add_column :gestionnaires, :failed_attempts, :integer, default: 0, null: false - add_column :gestionnaires, :unlock_token, :string - add_column :gestionnaires, :locked_at, :datetime - add_index :gestionnaires, :unlock_token, unique: true - - add_column :administrateurs, :failed_attempts, :integer, default: 0, null: false - add_column :administrateurs, :unlock_token, :string - add_column :administrateurs, :locked_at, :datetime - add_index :administrateurs, :unlock_token, unique: true - - add_column :administrations, :failed_attempts, :integer, default: 0, null: false - add_column :administrations, :unlock_token, :string - add_column :administrations, :locked_at, :datetime - add_index :administrations, :unlock_token, unique: true - end -end diff --git a/db/migrate/20190607122941_ensure_follow_dates_not_null.rb b/db/migrate/20190607122941_ensure_follow_dates_not_null.rb deleted file mode 100644 index 9d7805d16..000000000 --- a/db/migrate/20190607122941_ensure_follow_dates_not_null.rb +++ /dev/null @@ -1,8 +0,0 @@ -class EnsureFollowDatesNotNull < ActiveRecord::Migration[5.2] - def change - change_column_null :follows, :demande_seen_at, false - change_column_null :follows, :annotations_privees_seen_at, false - change_column_null :follows, :avis_seen_at, false - change_column_null :follows, :messagerie_seen_at, false - end -end diff --git a/db/migrate/20190607124156_add_follow_unfollowed_at.rb b/db/migrate/20190607124156_add_follow_unfollowed_at.rb deleted file mode 100644 index befe5830f..000000000 --- a/db/migrate/20190607124156_add_follow_unfollowed_at.rb +++ /dev/null @@ -1,17 +0,0 @@ -class AddFollowUnfollowedAt < ActiveRecord::Migration[5.2] - # We need up/down migrations because `remove_index` doesn’t allow `unique: true` and can’t be properly rolled back. - def up - add_column :follows, :unfollowed_at, :datetime - - remove_index :follows, [:gestionnaire_id, :dossier_id] - add_index :follows, [:gestionnaire_id, :dossier_id, :unfollowed_at], unique: true, - name: :uniqueness_index # We need a custom name because the autogenerated name would be too long - end - - def down - remove_column :follows, :unfollowed_at - # We don’t need to remove the index: dropping the column automatically deletes it. - - add_index :follows, [:gestionnaire_id, :dossier_id], unique: true - end -end diff --git a/db/migrate/20190616141702_create_bill_signature.rb b/db/migrate/20190616141702_create_bill_signature.rb deleted file mode 100644 index 95b0b9a2e..000000000 --- a/db/migrate/20190616141702_create_bill_signature.rb +++ /dev/null @@ -1,10 +0,0 @@ -class CreateBillSignature < ActiveRecord::Migration[5.2] - def change - create_table :bill_signatures do |t| - t.string :digest - t.timestamps - end - - add_reference :dossier_operation_logs, :bill_signature, foreign_key: true - end -end diff --git a/db/migrate/20190627090420_add_declarative_with_state_to_procedures.rb b/db/migrate/20190627090420_add_declarative_with_state_to_procedures.rb deleted file mode 100644 index 6c17cf6a0..000000000 --- a/db/migrate/20190627090420_add_declarative_with_state_to_procedures.rb +++ /dev/null @@ -1,6 +0,0 @@ -class AddDeclarativeWithStateToProcedures < ActiveRecord::Migration[5.2] - def change - add_column :procedures, :declarative_with_state, :string - add_index :procedures, :declarative_with_state - end -end diff --git a/db/migrate/20190627132911_secured_login_by_default.rb b/db/migrate/20190627132911_secured_login_by_default.rb deleted file mode 100644 index 0a5a0e423..000000000 --- a/db/migrate/20190627132911_secured_login_by_default.rb +++ /dev/null @@ -1,5 +0,0 @@ -class SecuredLoginByDefault < ActiveRecord::Migration[5.2] - def change - change_column_default(:gestionnaires, :features, from: {}, to: { "enable_email_login_token": true }) - end -end diff --git a/db/migrate/20190704094454_create_flipper_tables.rb b/db/migrate/20190704094454_create_flipper_tables.rb deleted file mode 100644 index ca4390c5c..000000000 --- a/db/migrate/20190704094454_create_flipper_tables.rb +++ /dev/null @@ -1,22 +0,0 @@ -class CreateFlipperTables < ActiveRecord::Migration[5.2] - def self.up - create_table :flipper_features do |t| - t.string :key, null: false - t.timestamps null: false - end - add_index :flipper_features, :key, unique: true - - create_table :flipper_gates do |t| - t.string :feature_key, null: false - t.string :key, null: false - t.string :value - t.timestamps null: false - end - add_index :flipper_gates, [:feature_key, :key, :value], unique: true - end - - def self.down - drop_table :flipper_gates - drop_table :flipper_features - end -end diff --git a/db/migrate/20190704133749_add_unconfirmed_email_column_to_users.rb b/db/migrate/20190704133749_add_unconfirmed_email_column_to_users.rb deleted file mode 100644 index 054edb9cf..000000000 --- a/db/migrate/20190704133749_add_unconfirmed_email_column_to_users.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddUnconfirmedEmailColumnToUsers < ActiveRecord::Migration[5.2] - def change - add_column :users, :unconfirmed_email, :text - end -end diff --git a/db/migrate/20190704144304_drop_administrateur_id.rb b/db/migrate/20190704144304_drop_administrateur_id.rb deleted file mode 100644 index abdb668c7..000000000 --- a/db/migrate/20190704144304_drop_administrateur_id.rb +++ /dev/null @@ -1,5 +0,0 @@ -class DropAdministrateurId < ActiveRecord::Migration[5.2] - def change - remove_reference :procedures, :administrateur - end -end diff --git a/db/migrate/20190711135401_remove_expects_multiple_submissions_from_procedure.rb b/db/migrate/20190711135401_remove_expects_multiple_submissions_from_procedure.rb deleted file mode 100644 index 9327f6eec..000000000 --- a/db/migrate/20190711135401_remove_expects_multiple_submissions_from_procedure.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RemoveExpectsMultipleSubmissionsFromProcedure < ActiveRecord::Migration[5.2] - def change - remove_column :procedures, :expects_multiple_submissions, :boolean, default: false, null: false - end -end diff --git a/db/migrate/20190711135457_remove_individual_with_siret_from_procedure.rb b/db/migrate/20190711135457_remove_individual_with_siret_from_procedure.rb deleted file mode 100644 index cf6ab32e7..000000000 --- a/db/migrate/20190711135457_remove_individual_with_siret_from_procedure.rb +++ /dev/null @@ -1,5 +0,0 @@ -class RemoveIndividualWithSiretFromProcedure < ActiveRecord::Migration[5.2] - def change - remove_column :procedures, :individual_with_siret, :boolean, default: false - end -end diff --git a/db/migrate/20190717132452_add_monavis_to_procedures.rb b/db/migrate/20190717132452_add_monavis_to_procedures.rb deleted file mode 100644 index d97b5056f..000000000 --- a/db/migrate/20190717132452_add_monavis_to_procedures.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddMonavisToProcedures < ActiveRecord::Migration[5.2] - def change - add_column :procedures, :monavis_embed, :text - end -end diff --git a/db/migrate/20190717151228_add_message_to_invites.rb b/db/migrate/20190717151228_add_message_to_invites.rb deleted file mode 100644 index dae608b19..000000000 --- a/db/migrate/20190717151228_add_message_to_invites.rb +++ /dev/null @@ -1,5 +0,0 @@ -class AddMessageToInvites < ActiveRecord::Migration[5.2] - def change - add_column :invites, :message, :text - end -end diff --git a/db/migrate/20190730153555_drop_deprecated_piece_justificative_tables.rb b/db/migrate/20190730153555_drop_deprecated_piece_justificative_tables.rb deleted file mode 100644 index 8a3b6c53c..000000000 --- a/db/migrate/20190730153555_drop_deprecated_piece_justificative_tables.rb +++ /dev/null @@ -1,40 +0,0 @@ -class DropDeprecatedPieceJustificativeTables < ActiveRecord::Migration[5.2] - def change - assert_empty_table!(:types_de_piece_justificative) - assert_empty_table!(:pieces_justificatives) - - drop_table :types_de_piece_justificative do |t| - t.string "libelle" - t.string "description" - t.boolean "api_entreprise", default: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.integer "procedure_id" - t.integer "order_place" - t.string "lien_demarche" - t.boolean "mandatory", default: false - t.index ["procedure_id"], name: "index_types_de_piece_justificative_on_procedure_id" - end - - drop_table :pieces_justificatives do |t| - t.string "content" - t.integer "dossier_id" - t.integer "type_de_piece_justificative_id" - t.datetime "created_at" - t.integer "user_id" - t.string "original_filename" - t.string "content_secure_token" - t.datetime "updated_at" - t.index ["dossier_id"], name: "index_pieces_justificatives_on_dossier_id" - t.index ["type_de_piece_justificative_id"], name: "index_pieces_justificatives_on_type_de_piece_justificative_id" - end - end - - def assert_empty_table!(table) - results = ActiveRecord::Base.connection.exec_query("SELECT COUNT(*) FROM #{table}") - records_count = results.first['count'] - if records_count > 0 - raise "Abord dropping `#{table}` table: it still contains #{records_count} records." - end - end -end diff --git a/db/migrate/20190730153555_recreate_structure.rb b/db/migrate/20190730153555_recreate_structure.rb new file mode 100644 index 000000000..3640bf5c4 --- /dev/null +++ b/db/migrate/20190730153555_recreate_structure.rb @@ -0,0 +1,651 @@ +class RecreateStructure < ActiveRecord::Migration[5.2] + # Recreate from schema.rb as of 2019_07_30_153555 + def change + # These are extensions that must be enabled in order to support this database + enable_extension "plpgsql" + enable_extension "unaccent" + + create_table "action_text_rich_texts" do |t| + t.string "name", null: false + t.text "body" + t.string "record_type", null: false + t.bigint "record_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["record_type", "record_id", "name"], name: "index_action_text_rich_texts_uniqueness", unique: true + end + + create_table "active_storage_attachments" do |t| + t.string "name", null: false + t.string "record_type", null: false + t.bigint "record_id", null: false + t.bigint "blob_id", null: false + t.datetime "created_at", null: false + t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id" + t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true + end + + create_table "active_storage_blobs" do |t| + t.string "key", null: false + t.string "filename", null: false + t.string "content_type" + t.text "metadata" + t.bigint "byte_size", null: false + t.string "checksum", null: false + t.datetime "created_at", null: false + t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true + end + + create_table "administrateurs", id: :serial do |t| + 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.datetime "current_sign_in_at" + t.datetime "last_sign_in_at" + t.string "current_sign_in_ip" + t.string "last_sign_in_ip" + t.datetime "created_at" + t.datetime "updated_at" + t.boolean "active", default: false + t.jsonb "features", default: {}, null: false + t.string "encrypted_token" + t.integer "failed_attempts", default: 0, null: false + t.string "unlock_token" + t.datetime "locked_at" + t.index ["email"], name: "index_administrateurs_on_email", unique: true + t.index ["reset_password_token"], name: "index_administrateurs_on_reset_password_token", unique: true + t.index ["unlock_token"], name: "index_administrateurs_on_unlock_token", unique: true + end + + create_table "administrateurs_gestionnaires", id: false do |t| + t.integer "administrateur_id" + t.integer "gestionnaire_id" + t.datetime "created_at" + t.datetime "updated_at" + t.index ["administrateur_id"], name: "index_administrateurs_gestionnaires_on_administrateur_id" + t.index ["gestionnaire_id", "administrateur_id"], name: "unique_couple_administrateur_gestionnaire", unique: true + t.index ["gestionnaire_id"], name: "index_administrateurs_gestionnaires_on_gestionnaire_id" + end + + create_table "administrateurs_procedures", id: false do |t| + t.bigint "administrateur_id", null: false + t.bigint "procedure_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["administrateur_id", "procedure_id"], name: "index_unique_admin_proc_couple", unique: true + t.index ["administrateur_id"], name: "index_administrateurs_procedures_on_administrateur_id" + t.index ["procedure_id"], name: "index_administrateurs_procedures_on_procedure_id" + end + + create_table "administrations", id: :serial do |t| + 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.datetime "current_sign_in_at" + t.datetime "last_sign_in_at" + t.string "current_sign_in_ip" + t.string "last_sign_in_ip" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "failed_attempts", default: 0, null: false + t.string "unlock_token" + t.datetime "locked_at" + t.index ["email"], name: "index_administrations_on_email", unique: true + t.index ["reset_password_token"], name: "index_administrations_on_reset_password_token", unique: true + t.index ["unlock_token"], name: "index_administrations_on_unlock_token", unique: true + end + + create_table "assign_tos", id: :serial do |t| + t.integer "gestionnaire_id" + t.integer "procedure_id" + t.datetime "created_at" + t.datetime "updated_at" + t.boolean "email_notifications_enabled", default: false, null: false + t.index ["gestionnaire_id", "procedure_id"], name: "index_assign_tos_on_gestionnaire_id_and_procedure_id", unique: true + t.index ["gestionnaire_id"], name: "index_assign_tos_on_gestionnaire_id" + t.index ["procedure_id"], name: "index_assign_tos_on_procedure_id" + end + + create_table "attestation_templates", id: :serial do |t| + t.text "title" + t.text "body" + t.text "footer" + t.string "logo" + t.string "signature" + t.boolean "activated" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "procedure_id" + t.string "logo_secure_token" + t.string "signature_secure_token" + t.index ["procedure_id"], name: "index_attestation_templates_on_procedure_id", unique: true + end + + create_table "attestations", id: :serial do |t| + t.string "pdf" + t.string "title" + t.integer "dossier_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "content_secure_token" + t.index ["dossier_id"], name: "index_attestations_on_dossier_id" + end + + create_table "avis", id: :serial do |t| + t.string "email" + t.text "introduction" + t.text "answer" + t.integer "gestionnaire_id" + t.integer "dossier_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.integer "claimant_id", null: false + t.boolean "confidentiel", default: false, null: false + t.index ["claimant_id"], name: "index_avis_on_claimant_id" + t.index ["dossier_id"], name: "index_avis_on_dossier_id" + t.index ["gestionnaire_id"], name: "index_avis_on_gestionnaire_id" + end + + create_table "bill_signatures" do |t| + t.string "digest" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "champs", id: :serial do |t| + t.string "value" + t.integer "type_de_champ_id" + t.integer "dossier_id" + t.string "type" + t.datetime "created_at" + t.datetime "updated_at" + t.boolean "private", default: false, null: false + t.integer "etablissement_id" + t.bigint "parent_id" + t.integer "row" + t.index ["dossier_id"], name: "index_champs_on_dossier_id" + t.index ["parent_id"], name: "index_champs_on_parent_id" + t.index ["private"], name: "index_champs_on_private" + t.index ["row"], name: "index_champs_on_row" + t.index ["type_de_champ_id"], name: "index_champs_on_type_de_champ_id" + end + + create_table "closed_mails", id: :serial do |t| + t.text "body" + t.string "subject" + t.integer "procedure_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["procedure_id"], name: "index_closed_mails_on_procedure_id" + end + + create_table "commentaires", id: :serial do |t| + t.string "email" + t.datetime "created_at", null: false + t.string "body" + t.integer "dossier_id" + t.datetime "updated_at", null: false + t.integer "piece_justificative_id" + t.string "file" + t.bigint "user_id" + t.bigint "gestionnaire_id" + t.index ["dossier_id"], name: "index_commentaires_on_dossier_id" + t.index ["gestionnaire_id"], name: "index_commentaires_on_gestionnaire_id" + t.index ["user_id"], name: "index_commentaires_on_user_id" + end + + create_table "delayed_jobs", id: :serial do |t| + t.integer "priority", default: 0, null: false + t.integer "attempts", default: 0, null: false + t.text "handler", null: false + t.text "last_error" + t.datetime "run_at" + t.datetime "locked_at" + t.datetime "failed_at" + t.string "locked_by" + t.string "queue" + t.datetime "created_at" + t.datetime "updated_at" + t.string "cron" + t.index ["priority", "run_at"], name: "delayed_jobs_priority" + end + + create_table "deleted_dossiers" do |t| + t.bigint "procedure_id" + t.bigint "dossier_id" + t.datetime "deleted_at" + t.string "state" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["procedure_id"], name: "index_deleted_dossiers_on_procedure_id" + end + + create_table "dossier_operation_logs" do |t| + t.string "operation", null: false + t.bigint "dossier_id" + t.bigint "gestionnaire_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.boolean "automatic_operation", default: false, null: false + t.bigint "administration_id" + t.datetime "keep_until" + t.datetime "executed_at" + t.text "digest" + t.bigint "bill_signature_id" + t.index ["administration_id"], name: "index_dossier_operation_logs_on_administration_id" + t.index ["bill_signature_id"], name: "index_dossier_operation_logs_on_bill_signature_id" + t.index ["dossier_id"], name: "index_dossier_operation_logs_on_dossier_id" + t.index ["gestionnaire_id"], name: "index_dossier_operation_logs_on_gestionnaire_id" + t.index ["keep_until"], name: "index_dossier_operation_logs_on_keep_until" + end + + create_table "dossiers", id: :serial do |t| + t.boolean "autorisation_donnees" + t.integer "procedure_id" + t.datetime "created_at" + t.datetime "updated_at" + t.string "state" + t.integer "user_id" + t.text "json_latlngs" + t.boolean "archived", default: false + t.datetime "en_construction_at" + t.datetime "en_instruction_at" + t.datetime "processed_at" + t.text "motivation" + t.datetime "hidden_at" + t.text "search_terms" + t.text "private_search_terms" + t.index "to_tsvector('french'::regconfig, (search_terms || private_search_terms))", name: "index_dossiers_on_search_terms_private_search_terms", using: :gin + t.index "to_tsvector('french'::regconfig, search_terms)", name: "index_dossiers_on_search_terms", using: :gin + t.index ["hidden_at"], name: "index_dossiers_on_hidden_at" + t.index ["procedure_id"], name: "index_dossiers_on_procedure_id" + t.index ["user_id"], name: "index_dossiers_on_user_id" + end + + create_table "drop_down_lists", id: :serial do |t| + t.string "value" + t.integer "type_de_champ_id" + t.datetime "created_at" + t.datetime "updated_at" + t.index ["type_de_champ_id"], name: "index_drop_down_lists_on_type_de_champ_id" + end + + create_table "etablissements", id: :serial do |t| + t.string "siret" + t.boolean "siege_social" + t.string "naf" + t.string "libelle_naf" + t.string "adresse" + t.string "numero_voie" + t.string "type_voie" + t.string "nom_voie" + t.string "complement_adresse" + t.string "code_postal" + t.string "localite" + t.string "code_insee_localite" + t.integer "dossier_id" + t.integer "entreprise_id" + t.string "entreprise_siren" + t.bigint "entreprise_capital_social" + t.string "entreprise_numero_tva_intracommunautaire" + t.string "entreprise_forme_juridique" + t.string "entreprise_forme_juridique_code" + t.string "entreprise_nom_commercial" + t.string "entreprise_raison_sociale" + t.string "entreprise_siret_siege_social" + t.string "entreprise_code_effectif_entreprise" + t.date "entreprise_date_creation" + t.string "entreprise_nom" + t.string "entreprise_prenom" + t.string "association_rna" + t.string "association_titre" + t.text "association_objet" + t.date "association_date_creation" + t.date "association_date_declaration" + t.date "association_date_publication" + t.datetime "created_at" + t.datetime "updated_at" + t.index ["dossier_id"], name: "index_etablissements_on_dossier_id" + end + + create_table "exercices", id: :serial do |t| + t.string "ca" + t.datetime "dateFinExercice" + t.integer "date_fin_exercice_timestamp" + t.integer "etablissement_id" + t.datetime "date_fin_exercice" + t.datetime "created_at" + t.datetime "updated_at" + end + + create_table "feedbacks" do |t| + t.bigint "user_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.string "rating", null: false + t.index ["user_id"], name: "index_feedbacks_on_user_id" + end + + create_table "flipflop_features" do |t| + t.string "key", null: false + t.boolean "enabled", default: false, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + create_table "flipper_features", force: :cascade do |t| + t.string "key", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["key"], name: "index_flipper_features_on_key", unique: true + end + + create_table "flipper_gates", force: :cascade do |t| + t.string "feature_key", null: false + t.string "key", null: false + t.string "value" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["feature_key", "key", "value"], name: "index_flipper_gates_on_feature_key_and_key_and_value", unique: true + end + + create_table "follows", id: :serial do |t| + t.integer "gestionnaire_id", null: false + t.integer "dossier_id", null: false + t.datetime "demande_seen_at", null: false + t.datetime "annotations_privees_seen_at", null: false + t.datetime "avis_seen_at", null: false + t.datetime "messagerie_seen_at", null: false + t.datetime "created_at" + t.datetime "updated_at" + t.datetime "unfollowed_at" + t.index ["dossier_id"], name: "index_follows_on_dossier_id" + t.index ["gestionnaire_id", "dossier_id", "unfollowed_at"], name: "uniqueness_index", unique: true + t.index ["gestionnaire_id"], name: "index_follows_on_gestionnaire_id" + end + + create_table "france_connect_informations", id: :serial do |t| + t.string "gender" + t.string "given_name" + t.string "family_name" + t.date "birthdate" + t.string "birthplace" + t.string "france_connect_particulier_id" + t.integer "user_id" + t.string "email_france_connect" + t.datetime "created_at" + t.datetime "updated_at" + t.index ["user_id"], name: "index_france_connect_informations_on_user_id" + end + + create_table "geo_areas" do |t| + t.string "source" + t.jsonb "geometry" + t.jsonb "properties" + t.bigint "champ_id" + t.string "geo_reference_id" + t.datetime "created_at" + t.datetime "updated_at" + t.index ["champ_id"], name: "index_geo_areas_on_champ_id" + t.index ["source"], name: "index_geo_areas_on_source" + end + + create_table "gestionnaires", id: :serial do |t| + 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.datetime "current_sign_in_at" + t.datetime "last_sign_in_at" + t.string "current_sign_in_ip" + t.string "last_sign_in_ip" + t.datetime "created_at" + t.datetime "updated_at" + t.text "encrypted_login_token" + t.datetime "login_token_created_at" + t.jsonb "features", default: {"enable_email_login_token"=>true}, null: false + t.integer "failed_attempts", default: 0, null: false + t.string "unlock_token" + t.datetime "locked_at" + t.index ["email"], name: "index_gestionnaires_on_email", unique: true + t.index ["reset_password_token"], name: "index_gestionnaires_on_reset_password_token", unique: true + t.index ["unlock_token"], name: "index_gestionnaires_on_unlock_token", unique: true + end + + create_table "individuals", id: :serial do |t| + t.string "nom" + t.string "prenom" + t.integer "dossier_id" + t.string "gender" + t.datetime "created_at" + t.datetime "updated_at" + t.date "birthdate" + t.index ["dossier_id"], name: "index_individuals_on_dossier_id" + end + + create_table "initiated_mails", id: :serial do |t| + t.string "subject" + t.text "body" + t.integer "procedure_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["procedure_id"], name: "index_initiated_mails_on_procedure_id" + end + + create_table "invites", id: :serial do |t| + t.string "email" + t.string "email_sender" + t.integer "dossier_id" + t.integer "user_id" + t.datetime "created_at" + t.datetime "updated_at" + t.text "message" + end + + create_table "module_api_cartos", id: :serial do |t| + t.integer "procedure_id" + t.boolean "use_api_carto", default: false + t.boolean "quartiers_prioritaires", default: false + t.boolean "cadastre", default: false + t.datetime "created_at" + t.datetime "updated_at" + t.boolean "migrated" + t.index ["procedure_id"], name: "index_module_api_cartos_on_procedure_id", unique: true + end + + create_table "procedure_presentations", id: :serial do |t| + t.integer "assign_to_id" + t.jsonb "sort", default: {"order"=>"desc", "table"=>"notifications", "column"=>"notifications"}, null: false + t.jsonb "filters", default: {"tous"=>[], "suivis"=>[], "traites"=>[], "a-suivre"=>[], "archives"=>[]}, null: false + t.datetime "created_at" + t.datetime "updated_at" + t.jsonb "displayed_fields", default: [{"label"=>"Demandeur", "table"=>"user", "column"=>"email"}], null: false + t.index ["assign_to_id"], name: "index_procedure_presentations_on_assign_to_id", unique: true + end + + create_table "procedures", id: :serial do |t| + t.string "libelle" + t.string "description" + t.string "organisation" + t.string "direction" + t.string "lien_demarche" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.boolean "euro_flag", default: false + t.string "logo" + t.boolean "cerfa_flag", default: false + t.string "logo_secure_token" + t.string "lien_site_web" + t.string "lien_notice" + t.boolean "for_individual", default: false + t.date "auto_archive_on" + t.datetime "published_at" + t.datetime "hidden_at" + t.datetime "archived_at" + t.datetime "whitelisted_at" + t.boolean "ask_birthday", default: false, null: false + t.string "web_hook_url" + t.boolean "cloned_from_library", default: false + t.bigint "parent_procedure_id" + t.datetime "test_started_at" + t.string "aasm_state", default: "brouillon" + t.bigint "service_id" + t.integer "duree_conservation_dossiers_dans_ds" + t.integer "duree_conservation_dossiers_hors_ds" + t.string "cadre_juridique" + t.boolean "juridique_required", default: true + t.boolean "durees_conservation_required", default: true + t.string "path" + t.string "declarative_with_state" + t.text "monavis_embed" + t.index ["declarative_with_state"], name: "index_procedures_on_declarative_with_state" + t.index ["hidden_at"], name: "index_procedures_on_hidden_at" + t.index ["parent_procedure_id"], name: "index_procedures_on_parent_procedure_id" + t.index ["service_id"], name: "index_procedures_on_service_id" + end + + create_table "received_mails", id: :serial do |t| + t.text "body" + t.string "subject" + t.integer "procedure_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["procedure_id"], name: "index_received_mails_on_procedure_id" + end + + create_table "refused_mails", id: :serial do |t| + t.text "body" + t.string "subject" + t.integer "procedure_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["procedure_id"], name: "index_refused_mails_on_procedure_id" + end + + create_table "services" do |t| + t.string "type_organisme", null: false + t.string "nom", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.bigint "administrateur_id" + t.string "organisme" + t.string "email" + t.string "telephone" + t.text "horaires" + t.text "adresse" + t.string "siret" + t.index ["administrateur_id", "nom"], name: "index_services_on_administrateur_id_and_nom", unique: true + t.index ["administrateur_id"], name: "index_services_on_administrateur_id" + end + + create_table "task_records", id: false do |t| + t.string "version", null: false + end + + create_table "trusted_device_tokens" do |t| + t.string "token", null: false + t.bigint "gestionnaire_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["gestionnaire_id"], name: "index_trusted_device_tokens_on_gestionnaire_id" + t.index ["token"], name: "index_trusted_device_tokens_on_token", unique: true + end + + create_table "types_de_champ", id: :serial do |t| + t.string "libelle" + t.string "type_champ" + t.integer "order_place" + t.integer "procedure_id" + t.text "description" + t.boolean "mandatory", default: false + t.boolean "private", default: false, null: false + t.datetime "created_at" + t.datetime "updated_at" + t.jsonb "options" + t.bigint "stable_id" + t.bigint "parent_id" + t.index ["parent_id"], name: "index_types_de_champ_on_parent_id" + t.index ["private"], name: "index_types_de_champ_on_private" + t.index ["procedure_id"], name: "index_types_de_champ_on_procedure_id" + t.index ["stable_id"], name: "index_types_de_champ_on_stable_id" + end + + create_table "users", id: :serial do |t| + 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.datetime "current_sign_in_at" + t.datetime "last_sign_in_at" + t.string "current_sign_in_ip" + t.string "last_sign_in_ip" + t.datetime "created_at" + t.datetime "updated_at" + t.string "siret" + t.string "loged_in_with_france_connect", default: "false" + t.string "confirmation_token" + t.datetime "confirmed_at" + t.datetime "confirmation_sent_at" + t.text "unconfirmed_email" + t.integer "failed_attempts", default: 0, null: false + t.string "unlock_token" + t.datetime "locked_at" + t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true + t.index ["email"], name: "index_users_on_email", unique: true + t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true + t.index ["unlock_token"], name: "index_users_on_unlock_token", unique: true + end + + create_table "virus_scans" do |t| + t.datetime "scanned_at" + t.string "status" + t.bigint "champ_id" + t.string "blob_key" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["champ_id"], name: "index_virus_scans_on_champ_id" + end + + create_table "without_continuation_mails", id: :serial do |t| + t.text "body" + t.string "subject" + t.integer "procedure_id" + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + t.index ["procedure_id"], name: "index_without_continuation_mails_on_procedure_id" + end + + add_foreign_key "attestation_templates", "procedures" + add_foreign_key "attestations", "dossiers" + add_foreign_key "avis", "gestionnaires", column: "claimant_id" + add_foreign_key "champs", "champs", column: "parent_id" + add_foreign_key "closed_mails", "procedures" + add_foreign_key "commentaires", "dossiers" + add_foreign_key "dossier_operation_logs", "administrations" + add_foreign_key "dossier_operation_logs", "bill_signatures" + add_foreign_key "dossier_operation_logs", "dossiers" + add_foreign_key "dossier_operation_logs", "gestionnaires" + add_foreign_key "dossiers", "users" + add_foreign_key "feedbacks", "users" + add_foreign_key "geo_areas", "champs" + add_foreign_key "initiated_mails", "procedures" + add_foreign_key "procedure_presentations", "assign_tos" + add_foreign_key "procedures", "services" + add_foreign_key "received_mails", "procedures" + add_foreign_key "refused_mails", "procedures" + add_foreign_key "services", "administrateurs" + add_foreign_key "trusted_device_tokens", "gestionnaires" + add_foreign_key "types_de_champ", "types_de_champ", column: "parent_id" + add_foreign_key "without_continuation_mails", "procedures" + end +end diff --git a/db/schema.rb b/db/schema.rb index c064f5dba..0d0416d1e 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -530,7 +530,6 @@ ActiveRecord::Schema.define(version: 2019_08_28_073736) do t.boolean "durees_conservation_required", default: true t.string "path" t.string "declarative_with_state" - t.text "monavis" t.text "monavis_embed" t.index ["declarative_with_state"], name: "index_procedures_on_declarative_with_state" t.index ["hidden_at"], name: "index_procedures_on_hidden_at" @@ -622,10 +621,10 @@ ActiveRecord::Schema.define(version: 2019_08_28_073736) do t.string "confirmation_token" t.datetime "confirmed_at" t.datetime "confirmation_sent_at" + t.text "unconfirmed_email" t.integer "failed_attempts", default: 0, null: false t.string "unlock_token" t.datetime "locked_at" - t.text "unconfirmed_email" t.bigint "instructeur_id" t.bigint "administrateur_id" t.index ["administrateur_id"], name: "index_users_on_administrateur_id" diff --git a/lib/tasks/2017_07_18_clean_followed_dossiers.rake b/lib/tasks/2017_07_18_clean_followed_dossiers.rake index 2c9a5f4ce..abd204e15 100644 --- a/lib/tasks/2017_07_18_clean_followed_dossiers.rake +++ b/lib/tasks/2017_07_18_clean_followed_dossiers.rake @@ -3,7 +3,7 @@ namespace :'2017_07_18_clean_followed_dossiers' do Follow.where(gestionnaire_id: nil).destroy_all Follow.where(dossier_id: nil).destroy_all - duplicate_follows = Follow.group('gestionnaire_id', 'dossier_id').count.select { |_gestionnaire_id_dossier_id, count| count > 1 }.keys + duplicate_follows = Follow.group('gestionnaire_id', 'dossier_id').count.filter { |_gestionnaire_id_dossier_id, count| count > 1 }.keys duplicate_ids = duplicate_follows.map { |gestionnaire_id, dossier_id| Follow.where(gestionnaire_id: gestionnaire_id, dossier_id: dossier_id).pluck(:id) } diff --git a/lib/tasks/2017_07_26_clean_birthdate_on_individual.rake b/lib/tasks/2017_07_26_clean_birthdate_on_individual.rake index caa4c674f..629146e06 100644 --- a/lib/tasks/2017_07_26_clean_birthdate_on_individual.rake +++ b/lib/tasks/2017_07_26_clean_birthdate_on_individual.rake @@ -3,7 +3,7 @@ require Rails.root.join("lib", "tasks", "task_helper") namespace :'2017_07_26_clean_birthdate_on_individual' do task clean: :environment do # remove duplicates - duplicate_individuals = Individual.group("dossier_id").count.select { |_dossier_id, count| count > 1 }.keys + duplicate_individuals = Individual.group("dossier_id").count.filter { |_dossier_id, count| count > 1 }.keys duplicate_individuals.each { |dossier_id| Individual.where(dossier_id: dossier_id, nom: nil).delete_all } # Match "" => nil @@ -11,13 +11,13 @@ namespace :'2017_07_26_clean_birthdate_on_individual' do individuals_with_date = Individual.where.not(birthdate: nil) # Match 31/12/2017 => 2017-12-31 - individuals_with_date.select { |i| /^\d{2}\/\d{2}\/\d{4}$/.match(i.birthdate) }.each do |i| + individuals_with_date.filter { |i| /^\d{2}\/\d{2}\/\d{4}$/.match(i.birthdate) }.each do |i| rake_puts "cleaning #{i.birthdate}" i.update(birthdate: Date.parse(i.birthdate).iso8601) rescue nil end # Match 31/12/17 => 2017-12-31 - individuals_with_date.select { |i| /^\d{2}\/\d{2}\/\d{2}$/.match(i.birthdate) }.each do |i| + individuals_with_date.filter { |i| /^\d{2}\/\d{2}\/\d{2}$/.match(i.birthdate) }.each do |i| rake_puts "cleaning #{i.birthdate}" new_date = Date.strptime(i.birthdate, "%d/%m/%y") if new_date.year > 2017 diff --git a/lib/tasks/2017_08_01_clean_assign_to.rake b/lib/tasks/2017_08_01_clean_assign_to.rake index bbc2d86dd..25e192eec 100644 --- a/lib/tasks/2017_08_01_clean_assign_to.rake +++ b/lib/tasks/2017_08_01_clean_assign_to.rake @@ -1,6 +1,6 @@ namespace :'2017_08_01_clean_assign_to' do task clean: :environment do - duplicates = AssignTo.group(:gestionnaire_id, :procedure_id).count.select { |_gestionnaire_id_procedure_id, count| count > 1 }.keys + duplicates = AssignTo.group(:gestionnaire_id, :procedure_id).count.filter { |_gestionnaire_id_procedure_id, count| count > 1 }.keys duplicate_ids = duplicates.map { |gestionnaire_id, procedure_id| AssignTo.where(gestionnaire_id: gestionnaire_id, procedure_id: procedure_id).pluck(:id) } diff --git a/lib/tasks/2018_01_18_clean_datetime_in_champs.rake b/lib/tasks/2018_01_18_clean_datetime_in_champs.rake index a5f5bb627..3f3128444 100644 --- a/lib/tasks/2018_01_18_clean_datetime_in_champs.rake +++ b/lib/tasks/2018_01_18_clean_datetime_in_champs.rake @@ -5,20 +5,20 @@ namespace :'2018_01_18_clean_datetime_in_champs' do datetime_champs = TypeDeChamp.where(type_champ: "datetime").flat_map(&:champ) # Match " HH:MM" => nil a datetime is not valid if not composed by date AND time - datetime_champs.select { |c| /^\s\d{2}:\d{2}$/.match(c.value) }.each do |c| + datetime_champs.filter { |c| /^\s\d{2}:\d{2}$/.match(c.value) }.each do |c| rake_puts "cleaning #{c.value} => nil" c.update_columns(value: nil) end # Match "dd/mm/YYYY HH:MM" => "YYYY-mm-dd HH:MM" - datetime_champs.select { |c| /^\d{2}\/\d{2}\/\d{4}\s\d{2}:\d{2}$/ =~ c.value }.each do |c| + datetime_champs.filter { |c| /^\d{2}\/\d{2}\/\d{4}\s\d{2}:\d{2}$/ =~ c.value }.each do |c| formated_date = Time.zone.strptime(c.value, "%d/%m/%Y %H:%M").strftime("%Y-%m-%d %H:%M") rake_puts "cleaning #{c.value} => #{formated_date}" c.update_columns(value: formated_date) end # Match "ddmmYYYY HH:MM" => "YYYY-mm-dd HH:MM" - datetime_champs.select { |c| /^\d{8}\s\d{2}:\d{2}$/ =~ c.value }.each do |c| + datetime_champs.filter { |c| /^\d{8}\s\d{2}:\d{2}$/ =~ c.value }.each do |c| day = c.value[0, 2] month = c.value[2, 2] year = c.value[4, 4] diff --git a/lib/tasks/2018_02_28_clean_gestionnaire_emails.rake b/lib/tasks/2018_02_28_clean_gestionnaire_emails.rake index 6106ae5ab..19c51d2f9 100644 --- a/lib/tasks/2018_02_28_clean_gestionnaire_emails.rake +++ b/lib/tasks/2018_02_28_clean_gestionnaire_emails.rake @@ -1,10 +1,10 @@ namespace :'2018_02_28_clean_invalid_emails_accounts' do task clean: :environment do - Gestionnaire.pluck(:email, :id).select { |e, _id| e.include?(" ") }.each do |_email, id| + Gestionnaire.pluck(:email, :id).filter { |e, _id| e.include?(" ") }.each do |_email, id| Gestionnaire.find_by(id: id, current_sign_in_at: nil)&.destroy # ensure account was never used end - User.pluck(:email, :id).select { |e, _id| e.include?(" ") }.each do |_email, id| + User.pluck(:email, :id).filter { |e, _id| e.include?(" ") }.each do |_email, id| User.find_by(id: id, current_sign_in_at: nil)&.destroy # ensure account was never used end end diff --git a/lib/tasks/2018_04_03_attestation_closed_mail_discrepancy.rake b/lib/tasks/2018_04_03_attestation_closed_mail_discrepancy.rake index 72db6d867..2c7a20cf9 100644 --- a/lib/tasks/2018_04_03_attestation_closed_mail_discrepancy.rake +++ b/lib/tasks/2018_04_03_attestation_closed_mail_discrepancy.rake @@ -1,7 +1,7 @@ namespace :'2018_04_03_attestation_closed_mail_discrepancy' do task mail_adminstrators: :environment do Administrateur.includes(:procedures).find_each(batch_size: 10) do |admin| - procedures = admin.procedures.where(archived_at: nil).select { |p| p.closed_mail_template_attestation_inconsistency_state == :missing_tag } + procedures = admin.procedures.where(archived_at: nil).filter { |p| p.closed_mail_template_attestation_inconsistency_state == :missing_tag } if procedures.any? # Use `deliver_now` because the delayed job cannot find the `Mailers::AttestationClosedMailDiscrepancyMaile` class in production Mailers::AttestationClosedMailDiscrepancyMailer.missing_attestation_tag_email(admin, procedures).deliver_now! diff --git a/lib/tasks/2018_06_05_resend_attestations.rake b/lib/tasks/2018_06_05_resend_attestations.rake index de3e49b49..a2ad1aaf4 100644 --- a/lib/tasks/2018_06_05_resend_attestations.rake +++ b/lib/tasks/2018_06_05_resend_attestations.rake @@ -3,7 +3,7 @@ require Rails.root.join("lib", "tasks", "task_helper") namespace :'2018_06_05_resend_attestations' do task set: :environment do procedure = Procedure.find(4247) - dossiers = procedure.dossiers.includes(:attestation).where(state: 'accepte').select do |d| + dossiers = procedure.dossiers.includes(:attestation).where(state: 'accepte').filter do |d| d.processed_at < procedure.attestation_template.updated_at end diff --git a/lib/tasks/2018_06_06_users_for_admins_and_gestionnaires.rake b/lib/tasks/2018_06_06_users_for_admins_and_gestionnaires.rake index 91c56b6af..5f94192ca 100644 --- a/lib/tasks/2018_06_06_users_for_admins_and_gestionnaires.rake +++ b/lib/tasks/2018_06_06_users_for_admins_and_gestionnaires.rake @@ -14,7 +14,7 @@ namespace :'2018_06_06_users_for_admins_and_gestionnaires' do .joins("INNER JOIN users ON #{table_name}.email = users.email") .where(users: { confirmed_at: nil }) .to_a - .select(&block) + .filter(&block) rake_puts "Sending emails to #{already_activated.count} #{table_name} that were already confirmed" diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb index 4eac9c120..52105bbab 100644 --- a/spec/controllers/application_controller_spec.rb +++ b/spec/controllers/application_controller_spec.rb @@ -5,7 +5,7 @@ describe ApplicationController, type: :controller do it 'is present' do before_actions = ApplicationController ._process_action_callbacks - .find_all { |process_action_callbacks| process_action_callbacks.kind == :before } + .filter { |process_action_callbacks| process_action_callbacks.kind == :before } .map(&:filter) expect(before_actions).to include(:set_raven_context) diff --git a/spec/controllers/instructeurs/instructeur_controller_spec.rb b/spec/controllers/instructeurs/instructeur_controller_spec.rb index 67ea8ca89..3c8ae4dff 100644 --- a/spec/controllers/instructeurs/instructeur_controller_spec.rb +++ b/spec/controllers/instructeurs/instructeur_controller_spec.rb @@ -5,7 +5,7 @@ describe Instructeurs::InstructeurController, type: :controller do it 'is present' do before_actions = Instructeurs::InstructeurController ._process_action_callbacks - .find_all { |process_action_callbacks| process_action_callbacks.kind == :before } + .filter { |process_action_callbacks| process_action_callbacks.kind == :before } .map(&:filter) expect(before_actions).to include(:authenticate_instructeur!) diff --git a/spec/controllers/instructeurs/procedures_controller_spec.rb b/spec/controllers/instructeurs/procedures_controller_spec.rb index ef66acd25..a6a0b8246 100644 --- a/spec/controllers/instructeurs/procedures_controller_spec.rb +++ b/spec/controllers/instructeurs/procedures_controller_spec.rb @@ -5,7 +5,7 @@ describe Instructeurs::ProceduresController, type: :controller do it "is present" do before_actions = Instructeurs::ProceduresController ._process_action_callbacks - .find_all { |process_action_callbacks| process_action_callbacks.kind == :before } + .filter { |process_action_callbacks| process_action_callbacks.kind == :before } .map(&:filter) expect(before_actions).to include(:ensure_ownership!) @@ -46,7 +46,7 @@ describe Instructeurs::ProceduresController, type: :controller do it "is present" do before_actions = Instructeurs::ProceduresController ._process_action_callbacks - .find_all { |process_action_callbacks| process_action_callbacks.kind == :before } + .filter { |process_action_callbacks| process_action_callbacks.kind == :before } .map(&:filter) expect(before_actions).to include(:redirect_to_avis_if_needed) diff --git a/spec/controllers/new_administrateur/administrateur_controller_spec.rb b/spec/controllers/new_administrateur/administrateur_controller_spec.rb index 6dbd65ffd..d55ce9b99 100644 --- a/spec/controllers/new_administrateur/administrateur_controller_spec.rb +++ b/spec/controllers/new_administrateur/administrateur_controller_spec.rb @@ -3,7 +3,7 @@ describe NewAdministrateur::AdministrateurController, type: :controller do it 'is present' do before_actions = NewAdministrateur::AdministrateurController ._process_action_callbacks - .find_all { |process_action_callbacks| process_action_callbacks.kind == :before } + .filter { |process_action_callbacks| process_action_callbacks.kind == :before } .map(&:filter) expect(before_actions).to include(:authenticate_administrateur!) diff --git a/spec/controllers/users/dossiers_controller_spec.rb b/spec/controllers/users/dossiers_controller_spec.rb index 478ede36c..4c60081bc 100644 --- a/spec/controllers/users/dossiers_controller_spec.rb +++ b/spec/controllers/users/dossiers_controller_spec.rb @@ -7,7 +7,7 @@ describe Users::DossiersController, type: :controller do it 'are present' do before_actions = Users::DossiersController ._process_action_callbacks - .find_all { |process_action_callbacks| process_action_callbacks.kind == :before } + .filter { |process_action_callbacks| process_action_callbacks.kind == :before } .map(&:filter) expect(before_actions).to include(:ensure_ownership!, :ensure_ownership_or_invitation!, :forbid_invite_submission!) diff --git a/spec/controllers/users/user_controller_spec.rb b/spec/controllers/users/user_controller_spec.rb index 7f6c2b1f1..f5601760e 100644 --- a/spec/controllers/users/user_controller_spec.rb +++ b/spec/controllers/users/user_controller_spec.rb @@ -5,7 +5,7 @@ describe Users::UserController, type: :controller do it 'is present' do before_actions = Users::UserController ._process_action_callbacks - .find_all { |process_action_callbacks| process_action_callbacks.kind == :before } + .filter { |process_action_callbacks| process_action_callbacks.kind == :before } .map(&:filter) expect(before_actions).to include(:authenticate_user!) diff --git a/spec/models/attestation_template_spec.rb b/spec/models/attestation_template_spec.rb index 129c3c358..471b591d8 100644 --- a/spec/models/attestation_template_spec.rb +++ b/spec/models/attestation_template_spec.rb @@ -149,12 +149,12 @@ describe AttestationTemplate, type: :model do context 'and their value in the dossier are not nil' do before do dossier.champs - .select { |champ| champ.libelle == 'libelleA' } + .filter { |champ| champ.libelle == 'libelleA' } .first .update(value: 'libelle1') dossier.champs - .select { |champ| champ.libelle == 'libelleB' } + .filter { |champ| champ.libelle == 'libelleB' } .first .update(value: 'libelle2') end diff --git a/spec/models/concern/tags_substitution_concern_spec.rb b/spec/models/concern/tags_substitution_concern_spec.rb index c6be332c5..e3c379e92 100644 --- a/spec/models/concern/tags_substitution_concern_spec.rb +++ b/spec/models/concern/tags_substitution_concern_spec.rb @@ -99,12 +99,12 @@ describe TagsSubstitutionConcern, type: :model do context 'and their value in the dossier are not nil' do before do dossier.champs - .select { |champ| champ.libelle == 'libelleA' } + .filter { |champ| champ.libelle == 'libelleA' } .first .update(value: 'libelle1') dossier.champs - .select { |champ| champ.libelle == 'libelleB' } + .filter { |champ| champ.libelle == 'libelleB' } .first .update(value: 'libelle2') end @@ -114,6 +114,33 @@ describe TagsSubstitutionConcern, type: :model do end end + context 'when the procedure has a type de champ repetition' do + let(:template) { '--Répétition--' } + let(:types_de_champ) do + [ + create(:type_de_champ_repetition, libelle: 'Répétition', types_de_champ: [ + create(:type_de_champ_text, libelle: 'Nom'), + create(:type_de_champ_text, libelle: 'Prénom') + ]) + ] + end + + before do + repetition = dossier.champs + .find { |champ| champ.libelle == 'Répétition' } + repetition.add_row(1) + paul_champs, pierre_champs = repetition.rows + + paul_champs.first.update(value: 'Paul') + paul_champs.last.update(value: 'Chavard') + + pierre_champs.first.update(value: 'Pierre') + pierre_champs.last.update(value: 'de La Morinerie') + end + + it { is_expected.to eq("Répétition\n\nNom : Paul\nPrénom : Chavard\n\nNom : Pierre\nPrénom : de La Morinerie") } + end + context 'when the procedure has a linked drop down menus type de champ' do let(:type_de_champ) do create(:type_de_champ_linked_drop_down_list, libelle: 'libelle') @@ -228,12 +255,12 @@ describe TagsSubstitutionConcern, type: :model do context 'and its value in the dossier are not nil' do before do dossier.champs - .select { |champ| champ.type_champ == TypeDeChamp.type_champs.fetch(:date) } + .filter { |champ| champ.type_champ == TypeDeChamp.type_champs.fetch(:date) } .first .update(value: '2017-04-15') dossier.champs - .select { |champ| champ.type_champ == TypeDeChamp.type_champs.fetch(:datetime) } + .filter { |champ| champ.type_champ == TypeDeChamp.type_champs.fetch(:datetime) } .first .update(value: '2017-09-13 09:00') end diff --git a/spec/models/dossier_spec.rb b/spec/models/dossier_spec.rb index 1222e3c22..08d65d4fe 100644 --- a/spec/models/dossier_spec.rb +++ b/spec/models/dossier_spec.rb @@ -460,7 +460,7 @@ describe Dossier do before do (dossier.champs + dossier.champs_private) - .select { |c| c.libelle.match?(/^specified/) } + .filter { |c| c.libelle.match?(/^specified/) } .each { |c| c.update_attribute(:value, "specified") } end