Commit 12d57caf authored by Grzegorz Bizon's avatar Grzegorz Bizon

Merge branch 'dm-project-mirror-data-created-updated-at' into 'master'

Remove project_mirror_data created_at and updated_at columns

Closes gitlab-qa#237

See merge request gitlab-org/gitlab-ee!5629
parents 61bbab8a 2127b937
......@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20180508055821) do
ActiveRecord::Schema.define(version: 20180509091305) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
......@@ -1987,8 +1987,6 @@ ActiveRecord::Schema.define(version: 20180508055821) do
t.datetime "last_update_started_at"
t.datetime "last_update_scheduled_at"
t.datetime "next_execution_timestamp"
t.datetime "created_at"
t.datetime "updated_at"
t.string "status"
t.string "jid"
t.datetime_with_timezone "last_update_at"
......
......@@ -4,6 +4,9 @@ module EE
extend ::Gitlab::Utils::Override
prepended do
include IgnorableColumn
ignore_column :created_at, :updated_at
BACKOFF_PERIOD = 24.seconds
JITTER = 6.seconds
......
......@@ -21,9 +21,7 @@ class CreateProjectMirrorDataEE < ActiveRecord::Migration
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,
NOW() AS created_at,
NOW() AS updated_at
NOW() AS next_execution_timestamp
FROM projects
WHERE mirror IS TRUE
);
......
......@@ -12,17 +12,13 @@ class EnsureProjectMirrorData < ActiveRecord::Migration
retry_count,
last_update_started_at,
last_update_scheduled_at,
next_execution_timestamp,
created_at,
updated_at
next_execution_timestamp
)
SELECT id AS project_id,
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,
NOW() AS created_at,
NOW() as updated_at
NOW() AS next_execution_timestamp
FROM projects
WHERE mirror IS TRUE
AND NOT EXISTS (
......
class RemoveProjectMirrorDataCreatedAtUpdatedAt < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
# Set this constant to true if this migration requires downtime.
DOWNTIME = false
def up
# A project_mirror_data table created in EE would have these columns, but
# one created in CE wouldn't. We don't actually need them, so let's remove them.
remove_column :project_mirror_data, :created_at if column_exists?(:project_mirror_data, :created_at)
remove_column :project_mirror_data, :updated_at if column_exists?(:project_mirror_data, :updated_at)
end
def down
# The columns do not need to be re-added; no application logic ever used them,
# and migrations that did have been modified to no longer do so.
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