User story #2253
closed
Automatically update the SQL schema on upgrade from to 2.4 (extra column in policyInstances and groups tables)
Added by Jonathan CLARKE almost 13 years ago.
Updated over 9 years ago.
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
- 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 !
- File deleted (
dbMigration.sql)
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 Groups
Thank 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)
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 Groups
Thank 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.
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.
- Status changed from 2 to In progress
Leeeet's rock ! I'm on it.
- Status changed from In progress to Pending technical review
- % Done changed from 0 to 100
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.
- 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
- 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.
- Project changed from Rudder to 34
- Category deleted (
11)
- Project changed from 34 to Rudder
- Category set to Packaging
Also available in: Atom
PDF