Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Backup the database. Login to the Database Backups page for beammetrics and create a backup in case anything goes wrong.

  2. Connect to the database. From a console, login using gcloud command:
    gcloud beta sql connect beammetrics --database=beammetrics --user=<your_username>

  3. Verify the data to migrate. Craft a SELECT query for the data you plan to update. For example:

    SELECT *
    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

      );

    Note that the import scripts will import recent history with the migrated job name from Jenkins; the NOT EXISTS clause above ensures that the duplicate history is not migrated from the previous name (it will be removed later). The UPDATE command will fail without this condition.

  4. 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>;

  5. 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'

...