Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
d2ebc9b9
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d2ebc9b9
编写于
10月 19, 2017
作者:
J
James Edwards-Jones
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Prevent schema.rb reverting from datetime_with_timezone to datetime
上级
7619bdd6
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
34 addition
and
4 deletion
+34
-4
config/initializers/active_record_data_types.rb
config/initializers/active_record_data_types.rb
+5
-0
db/migrate/20171019141859_fix_dev_timezone_schema.rb
db/migrate/20171019141859_fix_dev_timezone_schema.rb
+25
-0
db/schema.rb
db/schema.rb
+4
-4
未找到文件。
config/initializers/active_record_data_types.rb
浏览文件 @
d2ebc9b9
...
...
@@ -79,3 +79,8 @@ elsif Gitlab::Database.mysql?
NATIVE_DATABASE_TYPES
[
:datetime_with_timezone
]
=
{
name:
'timestamp'
}
end
end
# Ensure `datetime_with_timezone` columns are correctly written to schema.rb
if
(
ActiveRecord
::
Base
.
connection
.
active?
rescue
false
)
ActiveRecord
::
Base
.
connection
.
send
:reload_type_map
end
db/migrate/20171019141859_fix_dev_timezone_schema.rb
0 → 100644
浏览文件 @
d2ebc9b9
class
FixDevTimezoneSchema
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
# The this migrations tries to help solve unwanted changes to `schema.rb`
# while developing GitLab. Installations created before we started using
# `datetime_with_timezone` are likely to face this problem. Updating those
# columns to the new type should help fix this.
# Set this constant to true if this migration requires downtime.
DOWNTIME
=
false
TIMEZONE_TABLES
=
%i(appearances ci_group_variables ci_pipeline_schedule_variables events gpg_keys gpg_signatures project_auto_devops)
def
up
return
unless
Rails
.
env
.
development?
||
Rails
.
env
.
test?
TIMEZONE_TABLES
.
each
do
|
table
|
change_column
table
,
:created_at
,
:datetime_with_timezone
change_column
table
,
:updated_at
,
:datetime_with_timezone
end
end
def
down
end
end
db/schema.rb
浏览文件 @
d2ebc9b9
...
...
@@ -649,8 +649,8 @@ ActiveRecord::Schema.define(version: 20171124150326) do
t
.
datetime
"created_at"
t
.
datetime
"updated_at"
t
.
string
"confirmation_token"
t
.
datetime
"confirmed_at"
t
.
datetime
"confirmation_sent_at"
t
.
datetime
_with_timezone
"confirmed_at"
t
.
datetime
_with_timezone
"confirmation_sent_at"
end
add_index
"emails"
,
[
"confirmation_token"
],
name:
"index_emails_on_confirmation_token"
,
unique:
true
,
using: :btree
...
...
@@ -1762,8 +1762,8 @@ ActiveRecord::Schema.define(version: 20171124150326) do
add_index
"user_agent_details"
,
[
"subject_id"
,
"subject_type"
],
name:
"index_user_agent_details_on_subject_id_and_subject_type"
,
using: :btree
create_table
"user_custom_attributes"
,
force: :cascade
do
|
t
|
t
.
datetime
"created_at"
,
null:
false
t
.
datetime
"updated_at"
,
null:
false
t
.
datetime
_with_timezone
"created_at"
,
null:
false
t
.
datetime
_with_timezone
"updated_at"
,
null:
false
t
.
integer
"user_id"
,
null:
false
t
.
string
"key"
,
null:
false
t
.
string
"value"
,
null:
false
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录