Commit 1de170d4 authored by Andreas Brandl's avatar Andreas Brandl

Merge branch 'make_design_management_versions_created_at_not_null' into 'master'

Make design_management_versions.created_at not null

See merge request gitlab-org/gitlab!20182
parents dcced034 b3eb33ba
---
title: Make design_management_versions.created_at not null
merge_request: 20182
author: Lee Tickett
type: other
# frozen_string_literal: true
class MakeCreatedAtNotNullInDesignManagementVersions < ActiveRecord::Migration[5.2]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
def up
change_column_null :design_management_versions, :created_at, false, Time.now.to_s(:db)
end
def down
change_column_null :design_management_versions, :created_at, true
end
end
......@@ -1446,7 +1446,7 @@ ActiveRecord::Schema.define(version: 2020_03_03_074328) do
create_table "design_management_versions", force: :cascade do |t|
t.binary "sha", null: false
t.bigint "issue_id"
t.datetime_with_timezone "created_at"
t.datetime_with_timezone "created_at", null: false
t.integer "author_id"
t.index ["author_id"], name: "index_design_management_versions_on_author_id", where: "(author_id IS NOT NULL)"
t.index ["issue_id"], name: "index_design_management_versions_on_issue_id"
......
......@@ -20,7 +20,7 @@ describe Gitlab::BackgroundMigration::BackfillVersionDataFromGitaly do
def create_version_with_missing_data(attrs = {})
version = create_version(attrs)
version.update_columns(author_id: nil, created_at: nil)
version.update_columns(author_id: nil)
version
end
......@@ -29,19 +29,17 @@ describe Gitlab::BackgroundMigration::BackfillVersionDataFromGitaly do
commit = issue.project.design_repository.commit(version.sha)
expect(version).to have_attributes(
author_id: nil,
created_at: nil
author_id: nil
)
expect(commit.author.id).to be_present
expect(commit.created_at).to be_present
expect { perform_worker }.to(
change do
version.reload
[version.author_id, version.created_at]
version.author_id
end
.from([nil, nil])
.to([commit.author.id, commit.created_at])
.from(nil)
.to(commit.author.id)
)
end
......@@ -73,7 +71,7 @@ describe Gitlab::BackgroundMigration::BackfillVersionDataFromGitaly do
expect { perform_worker }.not_to(
change do
version.reload
[version.author_id, version.created_at]
version.author_id
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