go.chromium.org/luci@v0.0.0-20240309015107-7cdc2e660f33/buildbucket/proto/update_tables.sh (about)

     1  #!/bin/sh
     2  # Copyright 2021 The LUCI Authors.
     3  #
     4  # Licensed under the Apache License, Version 2.0 (the "License");
     5  # you may not use this file except in compliance with the License.
     6  # You may obtain a copy of the License at
     7  #
     8  #      http://www.apache.org/licenses/LICENSE-2.0
     9  #
    10  # Unless required by applicable law or agreed to in writing, software
    11  # distributed under the License is distributed on an "AS IS" BASIS,
    12  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  # See the License for the specific language governing permissions and
    14  # limitations under the License.
    15  
    16  set -e
    17  
    18  # This little script is just to remember the incantation to update the bigquery
    19  # schema. If you don't know what this is, you don't need to run it (and likely
    20  # don't have permission to anyhow).
    21  
    22  # Fist, make sure you run up-to-date bqschemaupdater,
    23  # since it's not installed by default in Infra's Go Env.
    24  go install go.chromium.org/luci/tools/cmd/bqschemaupdater
    25  
    26  # Actually update BQ schemas, -dev before prod.
    27  bqschemaupdater -message buildbucket.v2.Build -table cr-buildbucket-dev.raw.completed_builds
    28  bqschemaupdater -message buildbucket.v2.PRPCRequestLog -table cr-buildbucket-dev.sandbox.prpc_request_log -partitioning-field creation_time -partitioning-expiration "720h" # 30d
    29  bqschemaupdater -message buildbucket.v2.Build -table cr-buildbucket.raw.completed_builds
    30  bqschemaupdater -message buildbucket.v2.PRPCRequestLog -table cr-buildbucket.sandbox.prpc_request_log -partitioning-field creation_time -partitioning-expiration "720h" # 30d