Commit c2195fcd authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch '294187-dependency-proxy-ttl-status' into 'master'

Add status columns to dependency proxy tables

See merge request gitlab-org/gitlab!69901
parents 23d08807 209658cd
......@@ -8,6 +8,9 @@ class DependencyProxy::Blob < ApplicationRecord
validates :group, presence: true
validates :file, presence: true
validates :file_name, presence: true
validates :status, presence: true
enum status: { default: 0, expired: 1 }
mount_file_store_uploader DependencyProxy::FileUploader
......
......@@ -9,6 +9,9 @@ class DependencyProxy::Manifest < ApplicationRecord
validates :file, presence: true
validates :file_name, presence: true
validates :digest, presence: true
validates :status, presence: true
enum status: { default: 0, expired: 1 }
mount_file_store_uploader DependencyProxy::FileUploader
......
# frozen_string_literal: true
class AddStatusToDependencyProxyManifests < Gitlab::Database::Migration[1.0]
def change
add_column :dependency_proxy_manifests, :status, :smallint, default: 0, null: false
end
end
# frozen_string_literal: true
class AddStatusToDependencyProxyBlobs < Gitlab::Database::Migration[1.0]
def change
add_column :dependency_proxy_blobs, :status, :smallint, default: 0, null: false
end
end
4e9a585d33caed70c3e003e4f0127158ab9c98c790f8131012f052c2bd9cd1f0
\ No newline at end of file
fc70f26e1d691773728e8e2251b23fe39247fc233996c2161143c660a92fe141
\ No newline at end of file
......@@ -13070,7 +13070,8 @@ CREATE TABLE dependency_proxy_blobs (
size bigint,
file_store integer,
file_name character varying NOT NULL,
file text NOT NULL
file text NOT NULL,
status smallint DEFAULT 0 NOT NULL
);
CREATE SEQUENCE dependency_proxy_blobs_id_seq
......@@ -13118,6 +13119,7 @@ CREATE TABLE dependency_proxy_manifests (
file text NOT NULL,
digest text NOT NULL,
content_type text,
status smallint DEFAULT 0 NOT NULL,
CONSTRAINT check_079b293a7b CHECK ((char_length(file) <= 255)),
CONSTRAINT check_167a9a8a91 CHECK ((char_length(content_type) <= 255)),
CONSTRAINT check_c579e3f586 CHECK ((char_length(file_name) <= 255)),
......@@ -6,10 +6,13 @@ RSpec.describe DependencyProxy::Blob, type: :model do
it { is_expected.to belong_to(:group) }
end
it_behaves_like 'having unique enum values'
describe 'validations' do
it { is_expected.to validate_presence_of(:group) }
it { is_expected.to validate_presence_of(:file) }
it { is_expected.to validate_presence_of(:file_name) }
it { is_expected.to validate_presence_of(:status) }
end
describe '.total_size' do
......
......@@ -6,11 +6,14 @@ RSpec.describe DependencyProxy::Manifest, type: :model do
it { is_expected.to belong_to(:group) }
end
it_behaves_like 'having unique enum values'
describe 'validations' do
it { is_expected.to validate_presence_of(:group) }
it { is_expected.to validate_presence_of(:file) }
it { is_expected.to validate_presence_of(:file_name) }
it { is_expected.to validate_presence_of(:digest) }
it { is_expected.to validate_presence_of(:status) }
end
describe 'file is being stored' do
......
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