Commit aec75eab authored by Grzegorz Bizon's avatar Grzegorz Bizon

Simplify pending builds migration and db structure

Applied 0001-Minor-tweaks-to-ci_pending_builds.patch from @abrandl.
parent d79cf829
......@@ -2,9 +2,9 @@
class AddPendingBuildsTable < ActiveRecord::Migration[6.0]
def up
create_table :ci_pending_builds, id: false, if_not_exists: true do |t|
create_table :ci_pending_builds, id: false do |t|
t.timestamps_with_timezone null: false
t.references :build, primary_key: true, index: { unique: true }, foreign_key: { to_table: :ci_builds, on_delete: :cascade }
t.references :build, primary_key: true, default: nil, index: false, foreign_key: { to_table: :ci_builds, on_delete: :cascade }
t.references :project, index: true, null: false, foreign_key: { on_delete: :cascade }
end
end
......
......@@ -10759,15 +10759,6 @@ CREATE TABLE ci_pending_builds (
project_id bigint NOT NULL
);
CREATE SEQUENCE ci_pending_builds_build_id_seq
START WITH 1
INCREMENT BY 1
NO MINVALUE
NO MAXVALUE
CACHE 1;
ALTER SEQUENCE ci_pending_builds_build_id_seq OWNED BY ci_pending_builds.build_id;
CREATE TABLE ci_pipeline_artifacts (
id bigint NOT NULL,
created_at timestamp with time zone NOT NULL,
......@@ -19484,8 +19475,6 @@ ALTER TABLE ONLY ci_job_variables ALTER COLUMN id SET DEFAULT nextval('ci_job_va
ALTER TABLE ONLY ci_namespace_monthly_usages ALTER COLUMN id SET DEFAULT nextval('ci_namespace_monthly_usages_id_seq'::regclass);
ALTER TABLE ONLY ci_pending_builds ALTER COLUMN build_id SET DEFAULT nextval('ci_pending_builds_build_id_seq'::regclass);
ALTER TABLE ONLY ci_pipeline_artifacts ALTER COLUMN id SET DEFAULT nextval('ci_pipeline_artifacts_id_seq'::regclass);
ALTER TABLE ONLY ci_pipeline_chat_data ALTER COLUMN id SET DEFAULT nextval('ci_pipeline_chat_data_id_seq'::regclass);
......@@ -22546,8 +22535,6 @@ CREATE UNIQUE INDEX index_ci_job_variables_on_key_and_job_id ON ci_job_variables
CREATE UNIQUE INDEX index_ci_namespace_monthly_usages_on_namespace_id_and_date ON ci_namespace_monthly_usages USING btree (namespace_id, date);
CREATE UNIQUE INDEX index_ci_pending_builds_on_build_id ON ci_pending_builds USING btree (build_id);
CREATE INDEX index_ci_pending_builds_on_project_id ON ci_pending_builds USING btree (project_id);
CREATE INDEX index_ci_pipeline_artifacts_failed_verification ON ci_pipeline_artifacts USING btree (verification_retry_at NULLS FIRST) WHERE (verification_state = 3);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment