rake commit_log_to_db sql转换

This commit is contained in:
xxq250 2023-04-17 14:01:48 +08:00
parent 0fa0cc492e
commit 15100689c3
1 changed files with 2 additions and 2 deletions

View File

@ -30,7 +30,7 @@ namespace :commit_log_to_db do
commit_date = Time.parse(commit['commit']['author']['date'])
commit_date_str = commit_date.strftime("%a %b %d %H:%M:%S")
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}'),"
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
@ -64,7 +64,7 @@ namespace :commit_log_to_db do
commit_date = Time.parse(commit['commit']['author']['date'])
commit_date_str = commit_date.strftime("%Y-%m-%d %H:%M:%S")
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}'),"
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