-
Notifications
You must be signed in to change notification settings - Fork 434
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This model will store bs_requests from a staging workflow that want to be excluded. Co-authored-by: David Kang <dkang@suse.com> Co-authored-by: Moisés Déniz Alemán <mdeniz@suse.com> Co-authored-by: Saray Cabrera Padrón <scabrerapadron@suse.de> Co-authored-by: Ana María Martínez Gómez <ammartinez@suse.de>
- Loading branch information
1 parent
0b8bad4
commit 995715e
Showing
5 changed files
with
43 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
class Staging::RequestExclusion < ApplicationRecord | ||
def self.table_name_prefix | ||
'staging_' | ||
end | ||
|
||
belongs_to :staging_workflow, class_name: 'Staging::Workflow' | ||
belongs_to :bs_request | ||
|
||
validates :staging_workflow, :bs_request, :description, presence: true | ||
validates :bs_request_id, numericality: true, uniqueness: { scope: :staging_workflow_id, message: 'is already excluded' } | ||
validates :description, length: { maximum: 255 } | ||
|
||
delegate :number, to: :bs_request, allow_nil: true | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
src/api/db/migrate/20181030114152_create_staging_request_exclusions.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class CreateStagingRequestExclusions < ActiveRecord::Migration[5.2] | ||
def change | ||
create_table :staging_request_exclusions, id: :integer, options: 'CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC' do |t| | ||
t.references :staging_workflow, index: true, type: :integer, null: false | ||
t.references :bs_request, index: true, type: :integer, null: false | ||
t.string :description | ||
|
||
t.timestamps | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters