github.com/pf-qiu/concourse/v6@v6.7.3-0.20201207032516-1f455d73275f/atc/db/migration/migrations/1579713180_drop_independent_build_inputs_table.down.sql (about)

     1  BEGIN;
     2    CREATE TABLE independent_build_inputs (
     3        id integer NOT NULL,
     4        job_id integer NOT NULL,
     5        input_name text NOT NULL,
     6        first_occurrence boolean NOT NULL,
     7        resource_config_version_id integer NOT NULL REFERENCES resource_config_versions (id) ON DELETE CASCADE,
     8        resource_id integer NOT NULL REFERENCES resources (id) ON DELETE CASCADE
     9    );
    10  
    11    CREATE SEQUENCE independent_build_inputs_id_seq
    12        START WITH 1
    13        INCREMENT BY 1
    14        NO MINVALUE
    15        NO MAXVALUE
    16        CACHE 1;
    17  
    18    ALTER SEQUENCE independent_build_inputs_id_seq OWNED BY independent_build_inputs.id;
    19  
    20    ALTER TABLE ONLY independent_build_inputs ALTER COLUMN id SET DEFAULT nextval('independent_build_inputs_id_seq'::regclass);
    21  
    22    ALTER TABLE ONLY independent_build_inputs
    23        ADD CONSTRAINT independent_build_inputs_pkey PRIMARY KEY (id);
    24  
    25    ALTER TABLE ONLY independent_build_inputs
    26        ADD CONSTRAINT independent_build_inputs_unique_job_id_input_name UNIQUE (job_id, input_name);
    27  
    28    CREATE INDEX independent_build_inputs_resource_config_version_id ON independent_build_inputs (resource_config_version_id);
    29  
    30    CREATE INDEX independent_build_inputs_job_id ON independent_build_inputs USING btree (job_id);
    31  
    32    ALTER TABLE ONLY independent_build_inputs
    33        ADD CONSTRAINT independent_build_inputs_job_id_fkey FOREIGN KEY (job_id) REFERENCES jobs(id) ON DELETE CASCADE;
    34  COMMIT;