このコミットが含まれているのは:
@@ -50,23 +50,20 @@ class SharedResourceIdAllocator
|
||||
raise
|
||||
end
|
||||
|
||||
# 明示-tic な Id. 指定は許可する.
|
||||
return if record.id.present?
|
||||
|
||||
next_id = record.class.uncached do
|
||||
historical_max = HISTORY_IDS.fetch(space, []).map do |table, column|
|
||||
historical_max = HISTORY_IDS.fetch(space, []).map { |table, column|
|
||||
quoted_table = connection.quote_table_name(table)
|
||||
quoted_column = connection.quote_column_name(column)
|
||||
connection.select_value(
|
||||
"SELECT MAX(#{ quoted_column }) FROM #{ quoted_table }").to_i
|
||||
end.max.to_i
|
||||
connection.select_value("SELECT MAX(#{ quoted_column }) FROM #{ quoted_table }").to_i
|
||||
}.max.to_i
|
||||
|
||||
[next_ids(connection, tables).max, historical_max + 1].max
|
||||
end
|
||||
if record.id.present?
|
||||
if record.id < next_id
|
||||
raise ActiveRecord::RecordNotUnique, 'Shared ID is below the reserved position'
|
||||
end
|
||||
else
|
||||
record.id = next_id
|
||||
end
|
||||
# The INSERT advances InnoDB's persistent counter, including explicit IDs.
|
||||
|
||||
record.id = next_id
|
||||
end
|
||||
|
||||
def self.next_ids connection, tables
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする