User story #2253
closedAutomatically update the SQL schema on upgrade from to 2.4 (extra column in policyInstances and groups tables)
Description
After #2012 and #2143 we will need to add two new columns to SQL tables that historize group and PT names.
This will need to be implemented in the migration script, in particular:
- Check if column for group type exists, and add if not
- Check if column for PT name exists and if not:
- Add the column
- Run a script to fetch all existing lines in the table and add in the PT name, after searching for it in the /var/rudder/configuration-rules/policy-templates repository
Files
Updated by Nicolas CHARLES almost 13 years ago
- File dbMigration.sql added
Here is the DB migration script (it will also be on github)
It creates two columns :
- PolicyTemplateHumanName in the table PolicyInstances
- GroupStatus in the table Groups
Thank you !
Updated by Nicolas CHARLES almost 13 years ago
- File dbMigration.sql dbMigration.sql added
Updated by Nicolas CHARLES almost 13 years ago
Nicolas CHARLES wrote:
Here is the DB migration script (it will also be on github)
It creates two columns :
- PolicyTemplateHumanName in the table PolicyInstances
- GroupStatus in the table GroupsThank you !
And you should make a script that would set the value of the PolicyTemplateHumanName based on the value of the policyPackageName and policyPackageVersion (note that all these names might change)
Updated by Jonathan CLARKE almost 13 years ago
Nicolas CHARLES wrote:
Here is the DB migration script (it will also be on github)
It creates two columns :
- PolicyTemplateHumanName in the table PolicyInstances
- GroupStatus in the table GroupsThank you !
Thanks, but we really need it in a git repo to be able to use it. The packaging always copies files from their original git location, instead of duplicating them.
Updated by Jonathan CLARKE almost 13 years ago
- File rudder-upgrade-database-2.3-2.4-PT-names.pl rudder-upgrade-database-2.3-2.4-PT-names.pl added
- Assignee changed from Jonathan CLARKE to Matthieu CERDA
Matthieu, I'm handing this over to you. Attached is the embryon of a script that I started - it may or may not be useful to you.
Updated by Matthieu CERDA almost 13 years ago
- Status changed from 2 to In progress
Leeeet's rock ! I'm on it.
Updated by Matthieu CERDA almost 13 years ago
- Status changed from In progress to Pending technical review
- % Done changed from 0 to 100
Applied in changeset 0044ce7557b15f5300900b7dc0522d571fc5a34a.
Updated by Matthieu CERDA almost 13 years ago
As discussed between NCH, JCL and MCE, a perl script iterating through the PTs to get their real name to store them in the table would have a too serious impact on the machine (DBI and XPath dependencies especially), so the idea has been forfeited. A plain SQL script initializing the PolicyTemplateHumanName to the PT name already present on the SQL table has been preferred.
Updated by Jonathan CLARKE almost 13 years ago
- Subject changed from Migration script to add columns to SQL tables policyInstances and groups and fill them to Automatically update the SQL schema on upgrade from to 2.4 (igration script to add columns to SQL tables policyInstances and groups and fill them
- Status changed from Pending technical review to 10
Updated by Jonathan CLARKE almost 13 years ago
- Subject changed from Automatically update the SQL schema on upgrade from to 2.4 (igration script to add columns to SQL tables policyInstances and groups and fill them to Automatically update the SQL schema on upgrade from to 2.4 (extra column in policyInstances and groups tables)
- Status changed from 10 to Released
Latest modifications look good.
Updated by Nicolas PERRON almost 12 years ago
- Project changed from Rudder to 34
- Category deleted (
11)
Updated by Benoît PECCATTE almost 10 years ago
- Project changed from 34 to Rudder
- Category set to Packaging