diff options
author | Andreas Brandl <abrandl@gitlab.com> | 2019-06-26 12:06:23 +0000 |
---|---|---|
committer | Andreas Brandl <abrandl@gitlab.com> | 2019-06-26 12:06:23 +0000 |
commit | 069cd1ca7e6204e9441ca7b9f7f45831dfd786f4 (patch) | |
tree | 3d771164b2693eb12141bc69cc372b9ba8561f64 /app/models | |
parent | beb1c9aa85ee24183edc5c8eb7958eaa67406712 (diff) | |
parent | bde41ee866d0fe0b1bb5ece1130fb6e24d95ad17 (diff) | |
download | gitlab-ce-069cd1ca7e6204e9441ca7b9f7f45831dfd786f4.tar.gz |
Merge branch '62214-migrations-and-models' into 'master'
Step 1 of !28996: Adds models and migrations for Namespaces statistics
See merge request gitlab-org/gitlab-ce!29570
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/namespace.rb | 2 | ||||
-rw-r--r-- | app/models/namespace/aggregation_schedule.rb | 7 | ||||
-rw-r--r-- | app/models/namespace/root_storage_statistics.rb | 10 |
3 files changed, 19 insertions, 0 deletions
diff --git a/app/models/namespace.rb b/app/models/namespace.rb index 3c270c7396a..f9b53b2b70a 100644 --- a/app/models/namespace.rb +++ b/app/models/namespace.rb @@ -35,6 +35,8 @@ class Namespace < ApplicationRecord belongs_to :parent, class_name: "Namespace" has_many :children, class_name: "Namespace", foreign_key: :parent_id has_one :chat_team, dependent: :destroy # rubocop:disable Cop/ActiveRecordDependent + has_one :root_storage_statistics, class_name: 'Namespace::RootStorageStatistics' + has_one :aggregation_schedule, class_name: 'Namespace::AggregationSchedule' validates :owner, presence: true, unless: ->(n) { n.type == "Group" } validates :name, diff --git a/app/models/namespace/aggregation_schedule.rb b/app/models/namespace/aggregation_schedule.rb new file mode 100644 index 00000000000..43afd0b954c --- /dev/null +++ b/app/models/namespace/aggregation_schedule.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class Namespace::AggregationSchedule < ApplicationRecord + self.primary_key = :namespace_id + + belongs_to :namespace +end diff --git a/app/models/namespace/root_storage_statistics.rb b/app/models/namespace/root_storage_statistics.rb new file mode 100644 index 00000000000..de28eb6b37f --- /dev/null +++ b/app/models/namespace/root_storage_statistics.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +class Namespace::RootStorageStatistics < ApplicationRecord + self.primary_key = :namespace_id + + belongs_to :namespace + has_one :route, through: :namespace + + delegate :all_projects, to: :namespace +end |