计图commit补充

This commit is contained in:
xxq250 2023-04-18 16:56:12 +08:00
parent 17385de870
commit 03a53f56fd
1 changed files with 12 additions and 8 deletions

View File

@ -38,10 +38,12 @@ namespace :commit_log_to_db do
data += "(#{user_id},#{project.id},#{project.repository&.id},'#{project.identifier}','#{project.owner.name}/#{project.identifier}','#{commit_sha}','#{ref}',\"#{commit_message}\",'#{commit_date_str}','#{commit_date_str}'),"
end
data = data[0,data.length-1]
sql_connection = ActiveRecord::Base.connection
sql_connection.begin_db_transaction
sql = "INSERT INTO commit_logs (`user_id`, `project_id`, `repository_id`, `name`, `full_name`, `commit_id`, `ref`, `message`, `created_at`, `updated_at`) VALUES #{data}"
sql_connection.execute(sql)
if data.present?
sql_connection = ActiveRecord::Base.connection
sql_connection.begin_db_transaction
sql = "INSERT INTO commit_logs (`user_id`, `project_id`, `repository_id`, `name`, `full_name`, `commit_id`, `ref`, `message`, `created_at`, `updated_at`) VALUES #{data}"
sql_connection.execute(sql)
end
end
end
@ -74,10 +76,12 @@ namespace :commit_log_to_db do
data += "(#{user_id},#{project.id},#{project.repository&.id},'#{project.identifier}','#{project.owner.name}/#{project.identifier}','#{commit_sha}','#{ref}',\"#{commit_message}\",'#{commit_date_str}','#{commit_date_str}'),"
end
data = data[0,data.length-1]
sql_connection = ActiveRecord::Base.connection
sql_connection.begin_db_transaction
sql = "INSERT INTO commit_logs (`user_id`, `project_id`, `repository_id`, `name`, `full_name`, `commit_id`, `ref`, `message`, `created_at`, `updated_at`) VALUES #{data}"
sql_connection.execute(sql)
if data.present?
sql_connection = ActiveRecord::Base.connection
sql_connection.begin_db_transaction
sql = "INSERT INTO commit_logs (`user_id`, `project_id`, `repository_id`, `name`, `full_name`, `commit_id`, `ref`, `message`, `created_at`, `updated_at`) VALUES #{data}"
sql_connection.execute(sql)
end
end
end