Открыть боковую панель
nt_test132
nt_project_7gohtg18g8li
Коммиты
d9e6bbf7
Коммит
d9e6bbf7
создал
Ноя 15, 2017
по автору
Michael Kozono
Просмотр файлов
Fix migration for pre-Postgres 9.5
владелец
f703b5b8
Изменения
1
Скрыть пробелы
Построчно
Рядом
lib/gitlab/background_migration/prepare_untracked_uploads.rb
Просмотр файла @
d9e6bbf7
...
...
@@ -88,9 +88,14 @@ def insert_file_paths(file_paths)
end
def
insert_file_path
(
file_path
)
if
postgresql_pre_9_5?
# No easy way to do ON CONFLICT DO NOTHING before Postgres 9.5 so just use Rails
return
UntrackedFile
.
where
(
path:
file_path
).
first_or_create
end
table_columns_and_values
=
'untracked_files_for_uploads (path, created_at, updated_at) VALUES (?, ?, ?)'
sql
=
if
Gitlab
::
Database
.
postgresql?
sql
=
if
postgresql?
"INSERT INTO
#{
table_columns_and_values
}
ON CONFLICT DO NOTHING;"
else
"INSERT IGNORE INTO
#{
table_columns_and_values
}
;"
...
...
@@ -101,6 +106,15 @@ def insert_file_path(file_path)
ActiveRecord
::
Base
.
connection
.
execute
(
sql
)
end
def
postgresql?
@postgresql
||=
Gitlab
::
Database
.
postgresql?
end
def
postgresql_pre_9_5?
@postgresql_pre_9_5
||=
postgresql?
&&
ActiveRecord
::
Base
.
connection
.
select_value
(
'SHOW server_version_num'
).
to_i
<
90500
end
def
schedule_populate_untracked_uploads_jobs
bulk_queue_background_migration_jobs_by_range
(
UntrackedFile
,
FOLLOW_UP_MIGRATION
)
end
...
...
Редактирование
Предварительный просмотр
Поддерживает Markdown
0%
Попробовать снова
или
прикрепить новый файл
.
Отмена
You are about to add
0
people
to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Отмена
Пожалуйста,
зарегистрируйтесь
или
войдите
чтобы прокомментировать