Browse Source

Merge branch 'standalone_develop' into trustie_server

pull/330/head
xxq250 3 years ago
parent
commit
5550a81b98
1 changed files with 12 additions and 8 deletions
  1. +12
    -8
      lib/tasks/commit_log_to_db.rake

+ 12
- 8
lib/tasks/commit_log_to_db.rake 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

Loading…
Cancel
Save