Mailinglist Archive: opensuse-buildservice (312 mails)

< Previous Next >
[opensuse-buildservice] Can't force delete project after upgrade to OBS 1.5
  • From: Luke Imhoff <luke@xxxxxxxx>
  • Date: Mon, 13 Jul 2009 09:16:05 -0500
  • Message-id: <4A5B41A5.7050602@xxxxxxxx>
In the delete branch of SourceController.index_project, which is invoked when deleting a project, if the code enters the force branch, a MySQL InvalidStatement occurs on the last line of the following block:

SourceController < ApplicationController
...
def index_project
...
pro = DbProject.find_by_name project_name
...
#find linking repos
lreps = Array.new
pro.repositories.each do |repo|
repo.linking_repositories.each do |lrep|
lreps << lrep
end
end

if lreps.length > 0
if params[:force] and not params[:force].empty?
#replace links to this projects with links to the "deleted" project
del_repo = DbProject.find_by_name("deleted").repositories[0]
lreps.each do |link_rep|
pe = link_rep.path_elements.find(:first, :include => ["link"], :conditions => ["db_project_id = ?", pro.id])


The error is
ActiveRecord::StatementInvalid (Mysql::Error: Unknown column 'db_project_id' in 'where clause': SELECT * FROM `path_elements` WHERE (`path_elements`.parent_id = 2756 AND (db_project_id = 1871)) ORDER BY position LIMIT 1)


db_project_id is a not a column in path_elements, so somehow a JOIN is not being generated by the ActiveRecord base class for PathElements.

Does anyone know how to fix it so the generated MySQL correctly JOINs in the tables that have db_project_id?
--
To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-buildservice+help@xxxxxxxxxxxx

< Previous Next >
This Thread
Follow Ups