THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
- Backup the database. Login to the Database Backups page for beammetrics and create a backup in case anything goes wrong.
- Connect to the database. From a console, login using gcloud command:
gcloud beta sql beta connect beammetrics --database=beammetrics beammetrics --user=<your_username>
- Verify the data to migrate. Craft a SELECT query for the data you plan to update. For example:
Note that the import scripts will import recent history with the migrated job name from Jenkins; theSELECT *
FROM jenkins_builds jb
WHERE jb.job_name = 'beam_PostCommit_Java_ValidatesRunner_Gearpump_Gradle'
AND NOT EXISTS (
SELECT *
FROM jenkins_builds
WHERE job_name = 'beam_PostCommit_Java_ValidatesRunner_Gearpump'
AND build_id=jb.build_id);
NOT EXISTS
clause above ensures that the duplicate history is not migrated from the previous name (it will be removed later). TheUPDATE
command will fail without this condition. - Update the data. After validating the query targets the intended rows, modify it to update the necessary fields:
UPDATE jenkins_builds jb
SET job_name = 'beam_PostCommit_Java_ValidatesRunner_Gearpump'
WHERE <query-from-above>; - Remove duplicate history. The import script will import recent history with the migrated job name from Jenkins. The final step is to remove the redundant history with the old job name:
DELETE jenkins_builds
WHERE job_name = 'beam_PostCommit_Java_ValidatesRunner_Gearpump_Gradle'
...