Commit 7276b91a authored by Alper Akgun's avatar Alper Akgun

Merge branch 'track-created-at-on-ci-minutes-records' into 'master'

Track created_at on CI minutes records

See merge request gitlab-org/gitlab!74533
parents 1b857a51 bf88bdf1
# frozen_string_literal: true
class AddCreatedAtToNamespaceMonthlyUsages < Gitlab::Database::Migration[1.0]
disable_ddl_transaction!
def up
with_lock_retries do
add_column :ci_namespace_monthly_usages, :created_at, :datetime_with_timezone
end
end
def down
with_lock_retries do
remove_column :ci_namespace_monthly_usages, :created_at
end
end
end
# frozen_string_literal: true
class AddCreatedAtToProjectMonthlyUsage < Gitlab::Database::Migration[1.0]
disable_ddl_transaction!
def up
with_lock_retries do
add_column :ci_project_monthly_usages, :created_at, :datetime_with_timezone
end
end
def down
with_lock_retries do
remove_column :ci_project_monthly_usages, :created_at
end
end
end
2b6bc8067402744b79eee06022cf3c91ba7ffd519df83aae4067600a6bbf43ad
\ No newline at end of file
ad65e6deb885397dc91f33dc117a50e9a1b6d60f4caed8c5b77d474ec0340995
\ No newline at end of file
...@@ -11748,6 +11748,7 @@ CREATE TABLE ci_namespace_monthly_usages ( ...@@ -11748,6 +11748,7 @@ CREATE TABLE ci_namespace_monthly_usages (
amount_used numeric(18,2) DEFAULT 0.0 NOT NULL, amount_used numeric(18,2) DEFAULT 0.0 NOT NULL,
notification_level smallint DEFAULT 100 NOT NULL, notification_level smallint DEFAULT 100 NOT NULL,
shared_runners_duration integer DEFAULT 0 NOT NULL, shared_runners_duration integer DEFAULT 0 NOT NULL,
created_at timestamp with time zone,
CONSTRAINT ci_namespace_monthly_usages_year_month_constraint CHECK ((date = date_trunc('month'::text, (date)::timestamp with time zone))) CONSTRAINT ci_namespace_monthly_usages_year_month_constraint CHECK ((date = date_trunc('month'::text, (date)::timestamp with time zone)))
); );
...@@ -11993,6 +11994,7 @@ CREATE TABLE ci_project_monthly_usages ( ...@@ -11993,6 +11994,7 @@ CREATE TABLE ci_project_monthly_usages (
date date NOT NULL, date date NOT NULL,
amount_used numeric(18,2) DEFAULT 0.0 NOT NULL, amount_used numeric(18,2) DEFAULT 0.0 NOT NULL,
shared_runners_duration integer DEFAULT 0 NOT NULL, shared_runners_duration integer DEFAULT 0 NOT NULL,
created_at timestamp with time zone,
CONSTRAINT ci_project_monthly_usages_year_month_constraint CHECK ((date = date_trunc('month'::text, (date)::timestamp with time zone))) CONSTRAINT ci_project_monthly_usages_year_month_constraint CHECK ((date = date_trunc('month'::text, (date)::timestamp with time zone)))
); );
...@@ -40,6 +40,7 @@ RSpec.describe Ci::Minutes::NamespaceMonthlyUsage do ...@@ -40,6 +40,7 @@ RSpec.describe Ci::Minutes::NamespaceMonthlyUsage do
expect(subject.namespace).to eq(namespace) expect(subject.namespace).to eq(namespace)
expect(subject.date).to eq(described_class.beginning_of_month) expect(subject.date).to eq(described_class.beginning_of_month)
expect(subject.notification_level).to eq(::Ci::Minutes::Notification::PERCENTAGES.fetch(:not_set)) expect(subject.notification_level).to eq(::Ci::Minutes::Notification::PERCENTAGES.fetch(:not_set))
expect(subject.created_at).to eq(Time.current)
end end
end end
end end
......
...@@ -32,6 +32,7 @@ RSpec.describe Ci::Minutes::ProjectMonthlyUsage do ...@@ -32,6 +32,7 @@ RSpec.describe Ci::Minutes::ProjectMonthlyUsage do
expect(subject.amount_used).to eq(0) expect(subject.amount_used).to eq(0)
expect(subject.project).to eq(project) expect(subject.project).to eq(project)
expect(subject.date).to eq(described_class.beginning_of_month) expect(subject.date).to eq(described_class.beginning_of_month)
expect(subject.created_at).to eq(Time.current)
end end
end end
end end
......
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