golang.org/x/build@v0.0.0-20240506185731-218518f32b70/internal/relui/migrations/20220901160804_create_schedules.up.sql (about)

     1  --  Copyright 2022 The Go Authors. All rights reserved.
     2  --  Use of this source code is governed by a BSD-style
     3  --  license that can be found in the LICENSE file.
     4  
     5  CREATE TABLE schedules
     6  (
     7      id               SERIAL PRIMARY KEY,
     8      workflow_name    text                     NOT NULL,
     9      workflow_params  jsonb,
    10      spec             text                     NOT NULL,
    11      once             timestamp WITH TIME ZONE,
    12      interval_minutes int                      NOT NULL,
    13      created_at       timestamp WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
    14      updated_at       timestamp WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP
    15  );
    16  
    17  ALTER TABLE workflows
    18      ADD COLUMN schedule_id integer REFERENCES schedules (id);
    19  
    20  CREATE INDEX workflows_schedule_id_ix ON workflows (schedule_id) WHERE workflows.schedule_id IS NOT NULL;