Commit f16fa1b2 authored by Stan Hu's avatar Stan Hu

Merge branch 'fix-email-opted-in-at-failures' into 'master'

Change `email_opted_in_at` from `datetime_with_timezone` to `datetime`

Closes #3150

See merge request !2667
parents edf645c2 e320b933
# See http://doc.gitlab.com/ce/development/migration_style_guide.html
# for more information on how to write migrations for GitLab.
class FixEmailOptedInAtOnUsers < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
# Set this constant to true if this migration requires downtime.
DOWNTIME = false
def up
# MySQL makes the first TIMESTAMP column in a table default to
# CURRENT_TIMESTAMP and gives it a NOT NULL constraint
# (https://bugs.mysql.com/bug.php?id=75098). This prevents this value from
# ever being set to NULL. While it's possible to override MySQL's behavior
# in the the migration by adding null: true to add_column, this does not do
# the right thing when the database is initialized from scratch. Using the
# DATETIME type avoids these pitfalls.
remove_column :users, :email_opted_in_at
add_column :users, :email_opted_in_at, :datetime, null: true # rubocop:disable Migration/Datetime
end
def down
remove_column :users, :email_opted_in_at
add_column :users, :email_opted_in_at, :datetime_with_timezone, null: true
end
end
......@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20170808163512) do
ActiveRecord::Schema.define(version: 20170811203342) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
......@@ -1907,7 +1907,7 @@ ActiveRecord::Schema.define(version: 20170808163512) do
t.boolean "email_opted_in"
t.string "email_opted_in_ip"
t.integer "email_opted_in_source_id"
t.datetime_with_timezone "email_opted_in_at"
t.datetime "email_opted_in_at"
end
add_index "users", ["admin"], name: "index_users_on_admin", using: :btree
......
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