Commit d9f8f1d2 authored by Shinya Maeda's avatar Shinya Maeda

Merge branch '207257-specify-asset-types-in-releases-db' into 'master'

Add `link_type` column to `release_links` table

See merge request gitlab-org/gitlab!33156
parents 3f02c9a6 6f984e59
...@@ -14,6 +14,13 @@ module Releases ...@@ -14,6 +14,13 @@ module Releases
scope :sorted, -> { order(created_at: :desc) } scope :sorted, -> { order(created_at: :desc) }
enum link_type: {
other: 0,
runbook: 1,
package: 2,
image: 3
}
def internal? def internal?
url.start_with?(release.project.web_url) url.start_with?(release.project.web_url)
end end
......
---
title: Add link_type column to release_links table
merge_request: 33156
author:
type: changed
# frozen_string_literal: true
class AddLinkTypeToReleaseLinks < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
def up
with_lock_retries do
add_column :release_links, :link_type, :integer, limit: 2, default: 0
end
end
def down
with_lock_retries do
remove_column :release_links, :link_type
end
end
end
...@@ -5730,7 +5730,8 @@ CREATE TABLE public.release_links ( ...@@ -5730,7 +5730,8 @@ CREATE TABLE public.release_links (
name character varying NOT NULL, name character varying NOT NULL,
created_at timestamp with time zone NOT NULL, created_at timestamp with time zone NOT NULL,
updated_at timestamp with time zone NOT NULL, updated_at timestamp with time zone NOT NULL,
filepath character varying(128) filepath character varying(128),
link_type smallint DEFAULT 0
); );
CREATE SEQUENCE public.release_links_id_seq CREATE SEQUENCE public.release_links_id_seq
...@@ -14031,6 +14032,7 @@ COPY "schema_migrations" (version) FROM STDIN; ...@@ -14031,6 +14032,7 @@ COPY "schema_migrations" (version) FROM STDIN;
20200526153844 20200526153844
20200526164946 20200526164946
20200526164947 20200526164947
20200527092027
20200527094322 20200527094322
20200527095401 20200527095401
20200527151413 20200527151413
......
...@@ -144,6 +144,7 @@ Releases::Link: ...@@ -144,6 +144,7 @@ Releases::Link:
- url - url
- name - name
- filepath - filepath
- link_type
- created_at - created_at
- updated_at - updated_at
ProjectMember: ProjectMember:
......
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