Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
OSE
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open-source
OSE
Commits
cee10bc8
Commit
cee10bc8
authored
3 years ago
by
Laurent Lecluse
Browse files
Options
Downloads
Patches
Plain Diff
Migration des indicateurs
parent
5b14029d
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
admin/migration/v18Indicateurs.php
+53
-0
53 additions, 0 deletions
admin/migration/v18Indicateurs.php
with
53 additions
and
0 deletions
admin/migration/v18Indicateurs.php
0 → 100644
+
53
−
0
View file @
cee10bc8
<?php
class
v18Indicateurs
extends
AbstractMigration
{
public
function
description
():
string
{
return
"Migration des indicateurs de OSE 17 vers OSE 18"
;
}
public
function
utile
():
bool
{
return
true
;
return
$this
->
manager
->
hasNew
(
'table'
,
'TYPE_INDICATEUR'
);
}
public
function
before
()
{
$bdd
=
$this
->
manager
->
getBdd
();
$c
=
$this
->
manager
->
getOseAdmin
()
->
getConsole
();
$c
->
begin
(
'Préparation à la mise à jour des indicateurs'
);
$bdd
->
exec
(
'ALTER TABLE INDICATEUR ADD (TYPE_INDICATEUR_ID NUMBER)'
);
$bdd
->
exec
(
'CREATE TABLE TYPE_INDICATEUR (
ID NUMBER NOT NULL ENABLE,
LIBELLE VARCHAR2(60 CHAR) NOT NULL ENABLE,
ORDRE NUMBER DEFAULT 1 NOT NULL ENABLE
)'
);
$indicateurs
=
require
$this
->
manager
->
getOseAdmin
()
->
getOseDir
()
.
'/data/indicateurs.php'
;
foreach
(
$indicateurs
as
$libelle
=>
$type
)
{
$data
=
[
'ID'
=>
$type
[
'id'
],
'LIBELLE'
=>
$libelle
];
$bdd
->
getTable
(
'TYPE_INDICATEUR'
)
->
insert
(
$data
);
foreach
(
$type
[
'indicateurs'
]
as
$numero
=>
$indicateur
)
{
$bdd
->
getTable
(
'INDICATEUR'
)
->
update
([
'TYPE_INDICATEUR_ID'
=>
$type
[
'id'
]],
[
'NUMERO'
=>
$numero
]);
}
}
$bdd
->
exec
(
'DELETE FROM INDICATEUR WHERE TYPE_INDICATEUR_ID IS NULL'
);
$c
->
end
(
'Préparation à la migration des indicateurs terminée'
);
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment