[Camps-users] Bug: Installing camps using MySQL backend halts on errors [patch included]

Jon Jensen jon at endpoint.com
Tue Feb 17 17:17:49 UTC 2009


On Tue, 17 Feb 2009, Adam Vollrath wrote:

> To reproduce: Install camps on a fresh system, using MySQL as its 
> backend (i.e. using a dsn containing 'mysql' in camp-db-config.)  Part 
> of this install process requires executing schema/mysql.sql to create 
> tables in a new database for use by camps.
>
> Present behavior: The first few lines of this script drop tables that 
> the script will later [re]create.  However if these tables do not yet 
> exist, the mysql client will halt with an error (unless errors are 
> explicitly ignored.)
>
> Desired behavior: Drop tables if they exist, otherwise proceed without 
> error.
>
> The following patch changes this script to produce this desired 
> behavior:

I was going to ask what version of MySQL you're using that doesn't like 
the "IF EXISTS" syntax etc. etc. but looking at the camps source code, I 
think your patch is reversed:

> diff --git a/schema/mysql.sql b/schema/mysql.sql
> index c20ba17..4296b0d 100644
> --- a/schema/mysql.sql
> +++ b/schema/mysql.sql
> @@ -1,8 +1,8 @@
> -DROP TABLE IF EXISTS camp_numbers;
> -DROP TABLE IF EXISTS camps;
> -DROP TABLE IF EXISTS vcs_types;
> -DROP TABLE IF EXISTS camp_users;
> -DROP TABLE IF EXISTS camp_types;
> +DROP TABLE camp_numbers;
> +DROP TABLE camps;
> +DROP TABLE vcs_types;
> +DROP TABLE camp_users;
> +DROP TABLE camp_types;

You want to *add* the "IF EXISTS" checks, right?

Thanks,
Jon

-- 
Jon Jensen
End Point Corporation
http://www.endpoint.com/


More information about the Camps-users mailing list