Skip to content

Commit

Permalink
Hel 495/auth interaction helios (#336)
Browse files Browse the repository at this point in the history
* (hel-426) Fix taux de caf si pas de données (#330)

* (hel-495) Interconnexion Helios

correction script migration typeORM

* (hel-495) Interconnexion Helios

Modification migration ajout colonne inst_code_geo dans la table institution

* Revert "(hel-495) Interconnexion Helios"

This reverts commit 59474ad.

* (hel-495) Interconnexion Helios

Ajout de la colonne institution.inst_code_geo

* (hel-495) Interconnexion Helios

insertion des institution DNUM (SCN), CAT-AMANIA, et TEST

* (hel-495) modification du gitignore

ajout des clefs de chiffrement et du repertoire de conf vscode

* (hel-495) Interconnexion Helios

suppression de la contrainte d'unicité sur la colonne inst_code_geo
  • Loading branch information
s-ferre-cat authored Jul 6, 2023
1 parent 756f6d0 commit bdffbcf
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,8 @@ reports
!**/.yarn/sdks
!**/.yarn/versions
**/.pnp.*
dnum_ssh_key
sftp_local
sftp_local.pub
ssh_key
**/.vscode/*
4 changes: 3 additions & 1 deletion database/dataSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import { RenommerColonnePassageUrgenceActivitesEntiteJuridique1675867340170 } fr
import { AjouterBlocBudgetFinanceEJ1677495763184 } from "./migrations/1677495763184-AjouterBlocBugetFinanceEJ";
import { AjouteHAD1680014929754 } from "./migrations/1680014929754-AjouteHAD";
import { AjoutCapacitesSanitaireEJ1680076022425 } from "./migrations/1680076022425-AjoutCapacitesSanitaireEJ";
import { AjoutTableUtilisateurRoleEtablissement1686646154737 } from "./migrations/1686646154737-AjoutTableUtilisateurRoleEtablissement";
import { ActivitéMédicoSocialModel } from "./models/ActivitéMédicoSocialModel";
import { ActivitéSanitaireEntitéJuridiqueModel } from "./models/ActivitéSanitaireEntitéJuridiqueModel";
import { ActivitéSanitaireModel } from "./models/ActivitéSanitaireModel";
Expand All @@ -59,6 +58,8 @@ import { RoleModel } from "./models/RoleModel";
import { UtilisateurModel } from "./models/UtilisateurModel";
import { ÉquipementMatérielLourdSanitaireModel } from "./models/ÉquipementMatérielLourdSanitaireModel";
import { ÉtablissementTerritorialIdentitéModel } from "./models/ÉtablissementTerritorialIdentitéModel";
import { AjoutTableUtilisateurRoleEtablissement1686646154737 } from "./migrations/1686646154737-AjoutTableUtilisateurRoleEtablissement";
import { ModificationTableInstitution1688376404752 } from "./migrations/1688376404752-ModificationTableInstitution"

const logger = new ConsoleLogger();
dotEnvConfig();
Expand Down Expand Up @@ -126,6 +127,7 @@ export default new DataSource({
AjoutCapacitesSanitaireEJ1680076022425,
AjouteHAD1680014929754,
AjoutTableUtilisateurRoleEtablissement1686646154737,
ModificationTableInstitution1688376404752,
],
type: "postgres",
url: environmentVariables.DATABASE_URL,
Expand Down
52 changes: 52 additions & 0 deletions database/migrations/1688376404752-ModificationTableInstitution.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { MigrationInterface, QueryRunner } from "typeorm"

export class ModificationTableInstitution1688376404752 implements MigrationInterface {

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`
ALTER TABLE public.institution DROP CONSTRAINT institution_inst_code_key
`);
await queryRunner.query(`
ALTER TABLE public.institution RENAME COLUMN inst_code TO inst_code_geo;
`);
await queryRunner.query(`
ALTER TABLE public.institution ADD COLUMN inst_code character varying(10);
`);
await queryRunner.query(`
ALTER TABLE public.institution ADD CONSTRAINT inst_code_key UNIQUE(inst_code);
`);

await queryRunner.query("update public.institution set inst_code=CONCAT ('ARS_',inst_code_geo);");

await queryRunner.query(`
ALTER TABLE public.institution ALTER COLUMN inst_code_geo set NOT NULL;
`);

await queryRunner.query("insert into public.institution(inst_code, inst_libelle, inst_code_geo) values('SCN', 'DNUM (SCN)', '00');");
await queryRunner.query("insert into public.institution(inst_code, inst_libelle, inst_code_geo) values('CAT', 'CAT-AMANIA', '75');");
await queryRunner.query("insert into public.institution(inst_code, inst_libelle, inst_code_geo) values('TEST', 'TEST', '44');");
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`
ALTER TABLE public.institution DROP CONSTRAINT inst_code_key
`);

await queryRunner.query(`
ALTER TABLE public.institution DROP COLUMN inst_code;
`);

await queryRunner.query(`
ALTER TABLE public.institution RENAME COLUMN inst_code_geo TO inst_code;
`);

await queryRunner.query(`
ALTER TABLE public.institution ADD CONSTRAINT institution_inst_code_key UNIQUE(inst_code);
`);

await queryRunner.query(`
ALTER TABLE public.institution ALTER COLUMN inst_code set NOT NULL;
`);
}

}

0 comments on commit bdffbcf

Please sign in to comment.