Merge pull request #4193 from betagouv/get-rid-of-old-migrations

Replace old migrations with a single “recreate_structure”
This commit is contained in:
Nicolas Bouilleaud 2019-09-16 15:01:02 +02:00 committed by GitHub
commit 9770212e1d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
292 changed files with 653 additions and 3112 deletions

View file

@ -4,6 +4,7 @@ require:
AllCops:
Exclude:
- "db/schema.rb"
- "db/migrate/20190730153555_recreate_structure.rb"
- "bin/*"
- "node_modules/**/*"

View file

@ -1,7 +0,0 @@
class CreateDossiers < ActiveRecord::Migration
def change
create_table :dossiers do |t|
t.string :description
end
end
end

View file

@ -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

View file

@ -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

View file

@ -1,5 +0,0 @@
class AddAutorisationDonneesToDossiers < ActiveRecord::Migration
def change
add_column :dossiers, :autorisation_donnees, :boolean
end
end

View file

@ -1,6 +0,0 @@
class AddPositionToDossiers < ActiveRecord::Migration
def change
add_column :dossiers, :position_lat, :string
add_column :dossiers, :position_lon, :string
end
end

View file

@ -1,5 +0,0 @@
class AddRefDossierToDossiers < ActiveRecord::Migration
def change
add_column :dossiers, :ref_dossier, :string
end
end

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -1,5 +0,0 @@
class AddDossierTermineToDossiers < ActiveRecord::Migration
def change
add_column :dossiers, :dossier_termine, :boolean
end
end

View file

@ -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

View file

@ -1,5 +0,0 @@
class AddUseAdmiFacileToEvenementVie < ActiveRecord::Migration
def change
add_column :evenement_vies, :use_admi_facile, :boolean
end
end

View file

@ -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

View file

@ -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

View file

@ -1,5 +0,0 @@
class AddUseAdmiFacileToRefFormulaire < ActiveRecord::Migration
def change
add_column :ref_formulaires, :use_admi_facile, :boolean
end
end

View file

@ -1,5 +0,0 @@
class AddRefFormulaireToDossier < ActiveRecord::Migration
def change
add_column :dossiers, :ref_formulaire, :string
end
end

View file

@ -1,5 +0,0 @@
class AddRefPiecesJointesRefToDossierPdf < ActiveRecord::Migration
def change
add_reference :dossier_pdfs, :ref_pieces_jointes, index: true
end
end

View file

@ -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

View file

@ -1,5 +0,0 @@
class RenameRefDossierPdfIntoContent < ActiveRecord::Migration
def change
rename_column :dossier_pdfs, :ref_dossier_pdf, :content
end
end

View file

@ -1,5 +0,0 @@
class RenameDossierPdfintofPieceJointe < ActiveRecord::Migration
def change
rename_table :dossier_pdfs, :pieces_jointes
end
end

View file

@ -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

View file

@ -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

View file

@ -1,5 +0,0 @@
class AddFormulaireIdToTypePieceJointe < ActiveRecord::Migration
def change
add_column :types_piece_jointe, :formulaire_id, :integer
end
end

View file

@ -1,5 +0,0 @@
class RenameRefDemarcheIntoDemarcheId < ActiveRecord::Migration
def change
rename_column :formulaires, :ref_demarche, :demarche_id
end
end

View file

@ -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

View file

@ -1,5 +0,0 @@
class RenameEvenementVieFromDemarcheIntoEvenementVieId < ActiveRecord::Migration
def change
rename_column :formulaires, :evenement_vie, :evenement_vie_id
end
end

View file

@ -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

View file

@ -1,6 +0,0 @@
class ChangeDatePrevisionnelDataType < ActiveRecord::Migration
def change
remove_column :dossiers, :date_previsionnelle
add_column :dossiers, :date_previsionnelle, :date
end
end

View file

@ -1,5 +0,0 @@
class AddEmailContactToFormulaire < ActiveRecord::Migration
def change
add_column :formulaires, :email_contact, :string
end
end

View file

@ -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

View file

@ -1,5 +0,0 @@
class DropEvenementViesTable < ActiveRecord::Migration
def change
drop_table :evenement_vies
end
end

View file

@ -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

View file

@ -1,5 +0,0 @@
class RenamePieceJointeToPieceJustificatives < ActiveRecord::Migration
def change
rename_table :pieces_jointes, :pieces_justificatives
end
end

View file

@ -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

View file

@ -1,5 +0,0 @@
class RenameFormulaireIdToProcedureId < ActiveRecord::Migration
def change
rename_column :dossiers, :formulaire_id, :procedure_id
end
end

View file

@ -1,5 +0,0 @@
class DeleteTableUsers < ActiveRecord::Migration
def change
drop_table :users
end
end

View file

@ -1,5 +0,0 @@
class DropTablePros < ActiveRecord::Migration
def change
drop_table :pros
end
end

View file

@ -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

View file

@ -1,5 +0,0 @@
class DefaultAPIEntrepriseAtFalseToTypeDePieceJustificative < ActiveRecord::Migration
def change
change_column :types_de_piece_justificative, :api_entreprise, :boolean, :default => false
end
end

View file

@ -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

View file

@ -1,6 +0,0 @@
class AddStateToDossier < ActiveRecord::Migration
def change
remove_column :dossiers, :dossier_termine
add_column :dossiers, :state, :string
end
end

View file

@ -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

View file

@ -1,6 +0,0 @@
class AddUserToDossier < ActiveRecord::Migration
def change
add_reference :dossiers, :user, index: true
add_foreign_key :dossiers, :users
end
end

View file

@ -1,5 +0,0 @@
class AddUseAPICartoToProcedure < ActiveRecord::Migration
def change
add_column :procedures, :use_api_carto, :boolean, :default => false
end
end

View file

@ -1,5 +0,0 @@
class AddSiretToUser < ActiveRecord::Migration
def change
add_column :users, :siret, :string
end
end

View file

@ -1,5 +0,0 @@
class AddLoginWithFranceConnectToUser < ActiveRecord::Migration
def change
add_column :users, :login_with_france_connect, :boolean, :default => false
end
end

View file

@ -1,5 +0,0 @@
class RenameLoginWithFranceConnectToLogedInWithFranceConnect < ActiveRecord::Migration
def change
rename_column :users, :login_with_france_connect, :loged_in_with_france_connect
end
end

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -1,5 +0,0 @@
class ChangeStateProposedToSubmitted < ActiveRecord::Migration
def change
Dossier.where(state: 'proposed').update_all(state: 'submitted')
end
end

View file

@ -1,5 +0,0 @@
class ChangeStatereplyToReplied < ActiveRecord::Migration
def change
Dossier.where(state: 'reply').update_all(state: 'replied')
end
end

View file

@ -1,5 +0,0 @@
class ChangeStateConfirmedToValidated < ActiveRecord::Migration
def change
Dossier.where(state: 'confirmed').update_all(state: 'validated')
end
end

View file

@ -1,5 +0,0 @@
class ChangeStateDepositedToSubmitValidate < ActiveRecord::Migration
def change
Dossier.where(state: 'deposited').update_all(state: 'submit_validated')
end
end

View file

@ -1,5 +0,0 @@
class ChangeStateProcessedToClosed < ActiveRecord::Migration
def change
Dossier.where(state: 'processed').update_all(state: 'closed')
end
end

View file

@ -1,5 +0,0 @@
class ChangeStateSubmittedToInitiated < ActiveRecord::Migration
def change
Dossier.where(state: 'submitted').update_all(state: 'initiated')
end
end

View file

@ -1,5 +0,0 @@
class ChangeStateSubmitValidatedToSubmitted < ActiveRecord::Migration
def change
Dossier.where(state: 'submit_validated').update_all(state: 'submitted')
end
end

View file

@ -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

View file

@ -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

View file

@ -1,5 +0,0 @@
class RenameTypeDeChampsToTypeDeChamp < ActiveRecord::Migration
def change
rename_table :types_de_champs, :types_de_champ
end
end

View file

@ -1,5 +0,0 @@
class RenameTypeDeChampsIdToTypeDeChampIdOnChamp < ActiveRecord::Migration
def change
rename_column :champs, :type_de_champs_id, :type_de_champ_id
end
end

View file

@ -1,5 +0,0 @@
class CreateReferenceAdmninistrateurToProcedure < ActiveRecord::Migration
def change
add_reference :procedures, :administrateur, references: :procedures
end
end

View file

@ -1,5 +0,0 @@
class CreateReferenceAdmninistrateurToGestionnaire < ActiveRecord::Migration
def change
add_reference :gestionnaires, :administrateur, references: :gestionnaires
end
end

View file

@ -1,5 +0,0 @@
class AddJsonLatLngsToDossier < ActiveRecord::Migration
def change
add_column :dossiers, :json_latlngs, :text
end
end

View file

@ -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

View file

@ -1,5 +0,0 @@
class RenameTypeChampsIntoTypeChamp < ActiveRecord::Migration
def change
rename_column :types_de_champ, :type_champs, :type_champ
end
end

View file

@ -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

View file

@ -1,5 +0,0 @@
class AddArchivedToProcedure < ActiveRecord::Migration
def change
add_column :procedures, :archived, :boolean, default: false
end
end

View file

@ -1,5 +0,0 @@
class AddArchivedToDossier < ActiveRecord::Migration
def change
add_column :dossiers, :archived, :boolean, default: false
end
end

View file

@ -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

View file

@ -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

View file

@ -1,5 +0,0 @@
class AddEuroFlagToProcedure < ActiveRecord::Migration
def change
add_column :procedures, :euro_flag, :boolean, default: false
end
end

View file

@ -1,5 +0,0 @@
class AddLogoToProcedure < ActiveRecord::Migration
def change
add_column :procedures, :logo, :string
end
end

View file

@ -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

View file

@ -1,5 +0,0 @@
class AddAPITokenToAdministrateur < ActiveRecord::Migration
def change
add_column :administrateurs, :api_token, :string
end
end

View file

@ -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

View file

@ -1,5 +0,0 @@
class ChangeTypeOfLogedInWithFranceConnectToUser < ActiveRecord::Migration
def change
change_column :users, :loged_in_with_france_connect, :string
end
end

View file

@ -1,5 +0,0 @@
class AddOpenidToUser < ActiveRecord::Migration
def change
add_column :users, :france_connect_particulier_id, :string
end
end

View file

@ -1,5 +0,0 @@
class AddMandataireSocialToDossier < ActiveRecord::Migration
def change
add_column :dossiers, :mandataire_social, :boolean, default: false
end
end

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -1,5 +0,0 @@
class AddEmailToFranceConnectInformation < ActiveRecord::Migration
def change
add_column :france_connect_informations, :email_france_connect, :string
end
end

View file

@ -1,5 +0,0 @@
class AddCerfaFlagToProcedure < ActiveRecord::Migration
def change
add_column :procedures, :cerfa_flag, :boolean, :default => false
end
end

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -1,5 +0,0 @@
class AddProcedureFilterToGestionnaire < ActiveRecord::Migration
def change
add_column :gestionnaires, :procedure_filter, :integer, array: true, default: []
end
end

View file

@ -1,5 +0,0 @@
class AddCreatedAtToCerfa < ActiveRecord::Migration
def change
add_column :cerfas, :created_at, :datetime
end
end

View file

@ -1,5 +0,0 @@
class AddCreatedAtToPieceJustificative < ActiveRecord::Migration
def change
add_column :pieces_justificatives, :created_at, :datetime
end
end

View file

@ -1,5 +0,0 @@
class AddMandatoryToTypeDeChamps < ActiveRecord::Migration
def change
add_column :types_de_champ, :mandatory, :boolean, default: false
end
end

View file

@ -1,8 +0,0 @@
class DBremovePieceJustificativeEmpty < ActiveRecord::Migration
class PieceJustificative < ApplicationRecord
end
def change
PieceJustificative.where(content: nil).delete_all
end
end

View file

@ -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

View file

@ -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

View file

@ -1,5 +0,0 @@
class AddPieceJustificativeReferenceToCommentaire < ActiveRecord::Migration
def change
add_reference :commentaires, :piece_justificative, references: :piece_justificatives
end
end

View file

@ -1,5 +0,0 @@
class AddOriginalFilenameToPiecesJustificatives < ActiveRecord::Migration
def change
add_column :pieces_justificatives, :original_filename, :string
end
end

View file

@ -1,5 +0,0 @@
class AddOriginalFilenameToCerfas < ActiveRecord::Migration
def change
add_column :cerfas, :original_filename, :string
end
end

Some files were not shown because too many files have changed in this diff Show more