Commit 794f7109 authored by Rémy Coutable's avatar Rémy Coutable

Fix an edge-case with a DATETIME column on MySQL

After a migration spec that would rollback the DB to a state prior to
ee/db/migrate/20170509153720_create_project_mirror_data_ee.rb, the
`project_mirror_data.next_execution_timestamp` column would not be
allowed to be NULL anymore, which contradicts with its definition from
`db/schema.rb` and would lead to further specs to fail.

See https://gitlab.com/gitlab-org/gitlab-ee/-/jobs/217401507 for an
example.

That was only discovered because of bad luck in this MR:
https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/13149?commit_id=588165d03440b139e4241447dbeb8e368044abf6#note_173384953

[run mysql]
Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent 35ee3dd6
......@@ -21,7 +21,7 @@ class CreateProjectMirrorDataEE < ActiveRecord::Migration[4.2]
0 AS retry_count,
CAST(NULL AS #{timestamp}) AS last_update_started_at,
CAST(NULL AS #{timestamp}) AS last_update_scheduled_at,
NOW() AS next_execution_timestamp
CAST(NULL AS #{timestamp}) AS next_execution_timestamp
FROM projects
WHERE mirror IS TRUE
);
......
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