Custom Field Query Error

Added by Paolo Proni about 9 years ago

Hello everybody.

The queries on existing custom fields do not work. In the log, I find this:
ArgumentError (wrong number of arguments (6 for 5)):
app/models/query.rb:424:in `sql_for_field'
app/models/query.rb:424:in `statement'
app/models/query.rb:406:in `each_key'
app/models/query.rb:406:in `statement'
app/models/query.rb:445:in `issue_count'
app/controllers/issues_controller.rb:74:in `index'

I applyed this patch without success: http://www.redmine.org/attachments/4077/custom_field_filter.patch
Actually the patch seems to work in an instance without any previous defined custom fields. Should I do something with the database?

I am using RedMine 1.0.0 RC on Debian 5.4, Ruby 1.8.7, mysql 5.0.5

Thank you in advance for your help

Paolo

Replies (16)

RE: Custom Field Query Error - Added by Felix Schäfer about 9 years ago

Please provide the log entry for the whole request. What custom fields (issues, projects, …?) are you trying to poll?

RE: Custom Field Query Error - Added by Paolo Proni about 9 years ago

The query is about the issues.
Here is a complete log:

Processing IssuesController#index (for 192.168.35.2 at 2010-08-11 18:14:24) [POST]
Parameters: {"group_by"=>"", "set_filter"=>"1", "project_id"=>"sistemistica", "action"=>"index", "authenticity_token"=>"tk9iM6GnR6AB1NpuO8IsoMD2tUeAF5XCQBZg4qKjJ9Y=", "fields"=>["status_id", "cf_5"], "operators"=>{"cf_2"=>"=", "question_assigned_to_id"=>"=", "start_date"=>"<t+", "watcher_id"=>"=", "estimated_hours"=>"=", "created_on"=>">t-", "priority_id"=>"=", "cf_5"=>"=", "question_asked_by_id"=>"=", "done_ratio"=>"=", "updated_on"=>">t-", "subject"=>"~", "assigned_to_id"=>"=", "category_id"=>"=", "tracker_id"=>"=", "due_date"=>"<t+", "author_id"=>"=", "status_id"=>"o", "cf_11"=>"="}, "values"=>{"cf_2"=>[""], "question_assigned_to_id"=>["me"], "start_date"=>[""], "watcher_id"=>["me"], "estimated_hours"=>[""], "created_on"=>[""], "priority_id"=>["3"], "cf_5"=>["1"], "question_asked_by_id"=>["me"], "done_ratio"=>[""], "updated_on"=>[""], "subject"=>[""], "assigned_to_id"=>["me"], "category_id"=>["97"], "tracker_id"=>["1"], "due_date"=>[""], "author_id"=>["me"], "status_id"=>["1"], "cf_11"=>["1"]}, "controller"=>"issues", "query"=>{"column_names"=>["tracker", "status", "priority", "subject", "assigned_to", "updated_on", "category", "fixed_version", "estimated_hours", "done_ratio"]}}

ArgumentError (wrong number of arguments (6 for 5)):
app/models/query.rb:424:in `sql_for_field'
app/models/query.rb:424:in `statement'
app/models/query.rb:406:in `each_key'
app/models/query.rb:406:in `statement'
app/models/query.rb:445:in `issue_count'
app/controllers/issues_controller.rb:74:in `index'
passenger (2.2.11) lib/phusion_passenger/rack/request_handler.rb:92:in `process_request'
passenger (2.2.11) lib/phusion_passenger/abstract_request_handler.rb:207:in `main_loop'
passenger (2.2.11) lib/phusion_passenger/railz/application_spawner.rb:418:in `start_request_handler'
passenger (2.2.11) lib/phusion_passenger/railz/application_spawner.rb:358:in `handle_spawn_application'
passenger (2.2.11) lib/phusion_passenger/utils.rb:184:in `safe_fork'
passenger (2.2.11) lib/phusion_passenger/railz/application_spawner.rb:354:in `handle_spawn_application'
passenger (2.2.11) lib/phusion_passenger/abstract_server.rb:352:in `__send__'
passenger (2.2.11) lib/phusion_passenger/abstract_server.rb:352:in `main_loop'
passenger (2.2.11) lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously'
passenger (2.2.11) lib/phusion_passenger/abstract_server.rb:163:in `start'
passenger (2.2.11) lib/phusion_passenger/railz/application_spawner.rb:213:in `start'
passenger (2.2.11) lib/phusion_passenger/spawn_manager.rb:262:in `spawn_rails_application'
passenger (2.2.11) lib/phusion_passenger/abstract_server_collection.rb:126:in `lookup_or_add'
passenger (2.2.11) lib/phusion_passenger/spawn_manager.rb:256:in `spawn_rails_application'
passenger (2.2.11) lib/phusion_passenger/abstract_server_collection.rb:80:in `synchronize'
passenger (2.2.11) lib/phusion_passenger/abstract_server_collection.rb:79:in `synchronize'
passenger (2.2.11) lib/phusion_passenger/spawn_manager.rb:255:in `spawn_rails_application'
passenger (2.2.11) lib/phusion_passenger/spawn_manager.rb:154:in `spawn_application'
passenger (2.2.11) lib/phusion_passenger/spawn_manager.rb:287:in `handle_spawn_application'
passenger (2.2.11) lib/phusion_passenger/abstract_server.rb:352:in `__send__'
passenger (2.2.11) lib/phusion_passenger/abstract_server.rb:352:in `main_loop'
passenger (2.2.11) lib/phusion_passenger/abstract_server.rb:196:in `start_synchronously'

Rendering /srv/redmine-1.0.0/public/500.html (500 Internal Server Error)

RE: Custom Field Query Error - Added by Felix Schäfer about 9 years ago

Mmh, can't reproduce it, but it's on a redmine that's not at the bleedingiest of edges. Do you have any plugins installed?

RE: Custom Field Query Error - Added by Paolo Proni about 9 years ago

bleedingiest of edges ? Sorry, but I don't understand it.

Anyway thank you very much for your quick answers. We have the last RedMine 1.0 RC but this is the result of several updates. I have installed some plugins:
question, google_calendar, mylyn, schedules, timesheet.

Actually, we have two different instances (in two different computers) and the problem seems fixed in one instance only, using the patch. In the working instance there were no custom fields before.

Is it a problem with the database structure ? Can I send the table structure (without data), or is it too long to be posted?

The troubled instance contains a lot of data now, I don't know what to do, because the queries do not work.

RE: Custom Field Query Error - Added by Paolo Proni about 9 years ago

The table structure is:

-- MySQL dump 10.11
--
-- Host: localhost Database: redmine
-- ------------------------------------------------------
-- Server version 5.0.51a-24+lenny2

/*!40101 SET OLD_CHARACTER_SET_CLIENT=@CHARACTER_SET_CLIENT /;
/
!40101 SET OLD_CHARACTER_SET_RESULTS=@CHARACTER_SET_RESULTS /;
/
!40101 SET OLD_COLLATION_CONNECTION=@COLLATION_CONNECTION /;
/
!40101 SET NAMES utf8 /;
/
!40103 SET OLD_TIME_ZONE=@TIME_ZONE /;
/
!40103 SET TIME_ZONE='+00:00' /;
/
!40014 SET OLD_UNIQUE_CHECKS=@UNIQUE_CHECKS, UNIQUE_CHECKS=0 /;
/
!40014 SET OLD_FOREIGN_KEY_CHECKS=@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 /;
/
!40101 SET OLD_SQL_MODE=@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' /;
/
!40111 SET OLD_SQL_NOTES=@SQL_NOTES, SQL_NOTES=0 */;

--
-- Table structure for table `attachments`
--

DROP TABLE IF EXISTS `attachments`;
SET saved_cs_client = @character_set_client;
SET character_set_client = utf8;
CREATE TABLE `attachments` (
`id` int(11) NOT NULL auto_increment,
`container_id` int(11) NOT NULL default '0',
`container_type` varchar(30) NOT NULL default '',
`filename` varchar(255) NOT NULL default '',
`disk_filename` varchar(255) NOT NULL default '',
`filesize` int(11) NOT NULL default '0',
`content_type` varchar(255) default '',
`digest` varchar(40) NOT NULL default '',
`downloads` int(11) NOT NULL default '0',
`author_id` int(11) NOT NULL default '0',
`created_on` datetime default NULL,
`description` varchar(255) default NULL,
PRIMARY KEY (`id`),
KEY `index_attachments_on_container_id_and_container_type` (`container_id`,`container_type`),
KEY `index_attachments_on_author_id` (`author_id`),
KEY `index_attachments_on_created_on` (`created_on`)
) ENGINE=InnoDB AUTO_INCREMENT=3649 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `auth_sources`
--

DROP TABLE IF EXISTS `auth_sources`;
SET saved_cs_client = @character_set_client;
SET character_set_client = utf8;
CREATE TABLE `auth_sources` (
`id` int(11) NOT NULL auto_increment,
`type` varchar(30) NOT NULL default '',
`name` varchar(60) NOT NULL default '',
`host` varchar(60) default NULL,
`port` int(11) default NULL,
`account` varchar(255) default NULL,
`account_password` varchar(60) default NULL,
`base_dn` varchar(255) default NULL,
`attr_login` varchar(30) default NULL,
`attr_firstname` varchar(30) default NULL,
`attr_lastname` varchar(30) default NULL,
`attr_mail` varchar(30) default NULL,
`onthefly_register` tinyint(1) NOT NULL default '0',
`tls` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `index_auth_sources_on_id_and_type` (`id`,`type`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `boards`
--

DROP TABLE IF EXISTS `boards`;
SET saved_cs_client = @character_set_client;
SET character_set_client = utf8;
CREATE TABLE `boards` (
`id` int(11) NOT NULL auto_increment,
`project_id` int(11) NOT NULL default '0',
`name` varchar(255) NOT NULL default '',
`description` varchar(255) default NULL,
`position` int(11) default '1',
`topics_count` int(11) NOT NULL default '0',
`messages_count` int(11) NOT NULL default '0',
`last_message_id` int(11) default NULL,
PRIMARY KEY (`id`),
KEY `boards_project_id` (`project_id`),
KEY `index_boards_on_last_message_id` (`last_message_id`)
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `changes`
--

DROP TABLE IF EXISTS `changes`;
SET saved_cs_client = @character_set_client;
SET character_set_client = utf8;
CREATE TABLE `changes` (
`id` int(11) NOT NULL auto_increment,
`changeset_id` int(11) NOT NULL default '0',
`action` char(1) NOT NULL default '',
`path` text NOT NULL,
`from_path` text,
`from_revision` varchar(255) default NULL,
`revision` varchar(255) default NULL,
`branch` varchar(255) default NULL,
PRIMARY KEY (`id`),
KEY `changesets_changeset_id` (`changeset_id`)
) ENGINE=InnoDB AUTO_INCREMENT=149230 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `changesets`
--

DROP TABLE IF EXISTS `changesets`;
SET saved_cs_client = @character_set_client;
SET character_set_client = utf8;
CREATE TABLE `changesets` (
`id` int(11) NOT NULL auto_increment,
`repository_id` int(11) NOT NULL default '0',
`revision` varchar(255) NOT NULL default '0',
`committer` varchar(255) default NULL,
`committed_on` datetime NOT NULL default '0000-00-00 00:00:00',
`comments` text,
`commit_date` date default NULL,
`scmid` varchar(255) default NULL,
`user_id` int(11) default NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `changesets_repos_rev` (`repository_id`,`revision`),
KEY `index_changesets_on_user_id` (`user_id`),
KEY `index_changesets_on_repository_id` (`repository_id`),
KEY `index_changesets_on_committed_on` (`committed_on`),
KEY `changesets_repos_scmid` (`repository_id`,`scmid`)
) ENGINE=InnoDB AUTO_INCREMENT=29170 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `changesets_issues`
--

DROP TABLE IF EXISTS `changesets_issues`;
SET saved_cs_client = @character_set_client;
SET character_set_client = utf8;
CREATE TABLE `changesets_issues` (
`changeset_id` int(11) NOT NULL default '0',
`issue_id` int(11) NOT NULL default '0',
UNIQUE KEY `changesets_issues_ids` (`changeset_id`,`issue_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `comments`
--

DROP TABLE IF EXISTS `comments`;
SET saved_cs_client = @character_set_client;
SET character_set_client = utf8;
CREATE TABLE `comments` (
`id` int(11) NOT NULL auto_increment,
`commented_type` varchar(30) NOT NULL default '',
`commented_id` int(11) NOT NULL default '0',
`author_id` int(11) NOT NULL default '0',
`comments` text,
`created_on` datetime NOT NULL default '0000-00-00 00:00:00',
`updated_on` datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (`id`),
KEY `index_comments_on_commented_id_and_commented_type` (`commented_id`,`commented_type`),
KEY `index_comments_on_author_id` (`author_id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `custom_fields`
--

DROP TABLE IF EXISTS `custom_fields`;
SET saved_cs_client = @character_set_client;
SET character_set_client = utf8;
CREATE TABLE `custom_fields` (
`id` int(11) NOT NULL auto_increment,
`type` varchar(30) NOT NULL default '',
`name` varchar(30) NOT NULL default '',
`field_format` varchar(30) NOT NULL default '',
`possible_values` text,
`regexp` varchar(255) default '',
`min_length` int(11) NOT NULL default '0',
`max_length` int(11) NOT NULL default '0',
`is_required` tinyint(1) NOT NULL default '0',
`is_for_all` tinyint(1) NOT NULL default '0',
`is_filter` tinyint(1) NOT NULL default '0',
`position` int(11) default '1',
`searchable` tinyint(1) default '0',
`default_value` text,
`editable` tinyint(1) default '1',
PRIMARY KEY (`id`),
KEY `index_custom_fields_on_id_and_type` (`id`,`type`)
) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `custom_fields_projects`
--

DROP TABLE IF EXISTS `custom_fields_projects`;
SET saved_cs_client = @character_set_client;
SET character_set_client = utf8;
CREATE TABLE `custom_fields_projects` (
`custom_field_id` int(11) NOT NULL default '0',
`project_id` int(11) NOT NULL default '0',
KEY `index_custom_fields_projects_on_custom_field_id_and_project_id` (`custom_field_id`,`project_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `custom_fields_trackers`
--

DROP TABLE IF EXISTS `custom_fields_trackers`;
SET saved_cs_client = @character_set_client;
SET character_set_client = utf8;
CREATE TABLE `custom_fields_trackers` (
`custom_field_id` int(11) NOT NULL default '0',
`tracker_id` int(11) NOT NULL default '0',
KEY `index_custom_fields_trackers_on_custom_field_id_and_tracker_id` (`custom_field_id`,`tracker_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `custom_values`
--

DROP TABLE IF EXISTS `custom_values`;
SET saved_cs_client = @character_set_client;
SET character_set_client = utf8;
CREATE TABLE `custom_values` (
`id` int(11) NOT NULL auto_increment,
`customized_type` varchar(30) NOT NULL default '',
`customized_id` int(11) NOT NULL default '0',
`custom_field_id` int(11) NOT NULL default '0',
`value` text,
PRIMARY KEY (`id`),
KEY `custom_values_customized` (`customized_type`,`customized_id`),
KEY `index_custom_values_on_custom_field_id` (`custom_field_id`)
) ENGINE=InnoDB AUTO_INCREMENT=8027 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `documents`
--

DROP TABLE IF EXISTS `documents`;
SET saved_cs_client = @character_set_client;
SET character_set_client = utf8;
CREATE TABLE `documents` (
`id` int(11) NOT NULL auto_increment,
`project_id` int(11) NOT NULL default '0',
`category_id` int(11) NOT NULL default '0',
`title` varchar(60) NOT NULL default '',
`description` text,
`created_on` datetime default NULL,
PRIMARY KEY (`id`),
KEY `documents_project_id` (`project_id`),
KEY `index_documents_on_category_id` (`category_id`),
KEY `index_documents_on_created_on` (`created_on`)
) ENGINE=InnoDB AUTO_INCREMENT=379 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `enabled_modules`
--

DROP TABLE IF EXISTS `enabled_modules`;
SET saved_cs_client = @character_set_client;
SET character_set_client = utf8;
CREATE TABLE `enabled_modules` (
`id` int(11) NOT NULL auto_increment,
`project_id` int(11) default NULL,
`name` varchar(255) NOT NULL default '',
PRIMARY KEY (`id`),
KEY `enabled_modules_project_id` (`project_id`)
) ENGINE=InnoDB AUTO_INCREMENT=713 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `enumerations`
--

DROP TABLE IF EXISTS `enumerations`;
SET saved_cs_client = @character_set_client;
SET character_set_client = utf8;
CREATE TABLE `enumerations` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(30) NOT NULL default '',
`position` int(11) default '1',
`is_default` tinyint(1) NOT NULL default '0',
`type` varchar(255) default NULL,
`active` tinyint(1) NOT NULL default '1',
`project_id` int(11) default NULL,
`parent_id` int(11) default NULL,
PRIMARY KEY (`id`),
KEY `index_enumerations_on_project_id` (`project_id`),
KEY `index_enumerations_on_id_and_type` (`id`,`type`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `groups_users`
--

DROP TABLE IF EXISTS `groups_users`;
SET saved_cs_client = @character_set_client;
SET character_set_client = utf8;
CREATE TABLE `groups_users` (
`group_id` int(11) NOT NULL,
`user_id` int(11) NOT NULL,
UNIQUE KEY `groups_users_ids` (`group_id`,`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `issue_categories`
--

DROP TABLE IF EXISTS `issue_categories`;
SET saved_cs_client = @character_set_client;
SET character_set_client = utf8;
CREATE TABLE `issue_categories` (
`id` int(11) NOT NULL auto_increment,
`project_id` int(11) NOT NULL default '0',
`name` varchar(30) NOT NULL default '',
`assigned_to_id` int(11) default NULL,
PRIMARY KEY (`id`),
KEY `issue_categories_project_id` (`project_id`),
KEY `index_issue_categories_on_assigned_to_id` (`assigned_to_id`)
) ENGINE=InnoDB AUTO_INCREMENT=201 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `issue_relations`
--

DROP TABLE IF EXISTS `issue_relations`;
SET saved_cs_client = @character_set_client;
SET character_set_client = utf8;
CREATE TABLE `issue_relations` (
`id` int(11) NOT NULL auto_increment,
`issue_from_id` int(11) NOT NULL default '0',
`issue_to_id` int(11) NOT NULL default '0',
`relation_type` varchar(255) NOT NULL default '',
`delay` int(11) default NULL,
PRIMARY KEY (`id`),
KEY `index_issue_relations_on_issue_from_id` (`issue_from_id`),
KEY `index_issue_relations_on_issue_to_id` (`issue_to_id`)
) ENGINE=InnoDB AUTO_INCREMENT=1628 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `issue_statuses`
--

DROP TABLE IF EXISTS `issue_statuses`;
SET saved_cs_client = @character_set_client;
SET character_set_client = utf8;
CREATE TABLE `issue_statuses` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(30) NOT NULL default '',
`is_closed` tinyint(1) NOT NULL default '0',
`is_default` tinyint(1) NOT NULL default '0',
`position` int(11) default '1',
`default_done_ratio` int(11) default NULL,
PRIMARY KEY (`id`),
KEY `index_issue_statuses_on_position` (`position`),
KEY `index_issue_statuses_on_is_closed` (`is_closed`),
KEY `index_issue_statuses_on_is_default` (`is_default`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `issues`
--

DROP TABLE IF EXISTS `issues`;
SET saved_cs_client = @character_set_client;
SET character_set_client = utf8;
CREATE TABLE `issues` (
`id` int(11) NOT NULL auto_increment,
`tracker_id` int(11) NOT NULL default '0',
`project_id` int(11) NOT NULL default '0',
`subject` varchar(255) NOT NULL default '',
`description` text,
`due_date` date default NULL,
`category_id` int(11) default NULL,
`status_id` int(11) NOT NULL default '0',
`assigned_to_id` int(11) default NULL,
`priority_id` int(11) NOT NULL default '0',
`fixed_version_id` int(11) default NULL,
`author_id` int(11) NOT NULL default '0',
`lock_version` int(11) NOT NULL default '0',
`created_on` datetime default NULL,
`updated_on` datetime default NULL,
`start_date` date default NULL,
`done_ratio` int(11) NOT NULL default '0',
`estimated_hours` float default NULL,
`parent_id` int(11) default NULL,
`root_id` int(11) default NULL,
`lft` int(11) default NULL,
`rgt` int(11) default NULL,
PRIMARY KEY (`id`),
KEY `issues_project_id` (`project_id`),
KEY `index_issues_on_status_id` (`status_id`),
KEY `index_issues_on_category_id` (`category_id`),
KEY `index_issues_on_assigned_to_id` (`assigned_to_id`),
KEY `index_issues_on_fixed_version_id` (`fixed_version_id`),
KEY `index_issues_on_tracker_id` (`tracker_id`),
KEY `index_issues_on_priority_id` (`priority_id`),
KEY `index_issues_on_author_id` (`author_id`),
KEY `index_issues_on_created_on` (`created_on`),
KEY `index_issues_on_root_id_and_lft_and_rgt` (`root_id`,`lft`,`rgt`)
) ENGINE=InnoDB AUTO_INCREMENT=6937 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `journal_details`
--

DROP TABLE IF EXISTS `journal_details`;
SET saved_cs_client = @character_set_client;
SET character_set_client = utf8;
CREATE TABLE `journal_details` (
`id` int(11) NOT NULL auto_increment,
`journal_id` int(11) NOT NULL default '0',
`property` varchar(30) NOT NULL default '',
`prop_key` varchar(30) NOT NULL default '',
`old_value` varchar(255) default NULL,
`value` varchar(255) default NULL,
PRIMARY KEY (`id`),
KEY `journal_details_journal_id` (`journal_id`)
) ENGINE=InnoDB AUTO_INCREMENT=34630 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `journals`
--

DROP TABLE IF EXISTS `journals`;
SET saved_cs_client = @character_set_client;
SET character_set_client = utf8;
CREATE TABLE `journals` (
`id` int(11) NOT NULL auto_increment,
`journalized_id` int(11) NOT NULL default '0',
`journalized_type` varchar(30) NOT NULL default '',
`user_id` int(11) NOT NULL default '0',
`notes` text,
`created_on` datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (`id`),
KEY `journals_journalized_id` (`journalized_id`,`journalized_type`),
KEY `index_journals_on_user_id` (`user_id`),
KEY `index_journals_on_journalized_id` (`journalized_id`),
KEY `index_journals_on_created_on` (`created_on`)
) ENGINE=InnoDB AUTO_INCREMENT=26358 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `member_roles`
--

DROP TABLE IF EXISTS `member_roles`;
SET saved_cs_client = @character_set_client;
SET character_set_client = utf8;
CREATE TABLE `member_roles` (
`id` int(11) NOT NULL auto_increment,
`member_id` int(11) NOT NULL,
`role_id` int(11) NOT NULL,
`inherited_from` int(11) default NULL,
PRIMARY KEY (`id`),
KEY `index_member_roles_on_member_id` (`member_id`),
KEY `index_member_roles_on_role_id` (`role_id`)
) ENGINE=InnoDB AUTO_INCREMENT=975 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `members`
--

DROP TABLE IF EXISTS `members`;
SET saved_cs_client = @character_set_client;
SET character_set_client = utf8;
CREATE TABLE `members` (
`id` int(11) NOT NULL auto_increment,
`user_id` int(11) NOT NULL default '0',
`project_id` int(11) NOT NULL default '0',
`created_on` datetime default NULL,
`mail_notification` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `index_members_on_user_id` (`user_id`),
KEY `index_members_on_project_id` (`project_id`)
) ENGINE=InnoDB AUTO_INCREMENT=860 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `messages`
--

DROP TABLE IF EXISTS `messages`;
SET saved_cs_client = @character_set_client;
SET character_set_client = utf8;
CREATE TABLE `messages` (
`id` int(11) NOT NULL auto_increment,
`board_id` int(11) NOT NULL default '0',
`parent_id` int(11) default NULL,
`subject` varchar(255) NOT NULL default '',
`content` text,
`author_id` int(11) default NULL,
`replies_count` int(11) NOT NULL default '0',
`last_reply_id` int(11) default NULL,
`created_on` datetime NOT NULL default '0000-00-00 00:00:00',
`updated_on` datetime NOT NULL default '0000-00-00 00:00:00',
`locked` tinyint(1) default '0',
`sticky` int(11) default '0',
PRIMARY KEY (`id`),
KEY `messages_board_id` (`board_id`),
KEY `messages_parent_id` (`parent_id`),
KEY `index_messages_on_last_reply_id` (`last_reply_id`),
KEY `index_messages_on_author_id` (`author_id`),
KEY `index_messages_on_created_on` (`created_on`)
) ENGINE=InnoDB AUTO_INCREMENT=53 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `news`
--

DROP TABLE IF EXISTS `news`;
SET saved_cs_client = @character_set_client;
SET character_set_client = utf8;
CREATE TABLE `news` (
`id` int(11) NOT NULL auto_increment,
`project_id` int(11) default NULL,
`title` varchar(60) NOT NULL default '',
`summary` varchar(255) default '',
`description` text,
`author_id` int(11) NOT NULL default '0',
`created_on` datetime default NULL,
`comments_count` int(11) NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `news_project_id` (`project_id`),
KEY `index_news_on_author_id` (`author_id`),
KEY `index_news_on_created_on` (`created_on`)
) ENGINE=InnoDB AUTO_INCREMENT=86 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `open_id_authentication_associations`
--

DROP TABLE IF EXISTS `open_id_authentication_associations`;
SET saved_cs_client = @character_set_client;
SET character_set_client = utf8;
CREATE TABLE `open_id_authentication_associations` (
`id` int(11) NOT NULL auto_increment,
`issued` int(11) default NULL,
`lifetime` int(11) default NULL,
`handle` varchar(255) default NULL,
`assoc_type` varchar(255) default NULL,
`server_url` blob,
`secret` blob,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `open_id_authentication_nonces`
--

DROP TABLE IF EXISTS `open_id_authentication_nonces`;
SET saved_cs_client = @character_set_client;
SET character_set_client = utf8;
CREATE TABLE `open_id_authentication_nonces` (
`id` int(11) NOT NULL auto_increment,
`timestamp` int(11) NOT NULL,
`server_url` varchar(255) default NULL,
`salt` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `projects`
--

DROP TABLE IF EXISTS `projects`;
SET saved_cs_client = @character_set_client;
SET character_set_client = utf8;
CREATE TABLE `projects` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(30) NOT NULL default '',
`description` text,
`homepage` varchar(255) default '',
`is_public` tinyint(1) NOT NULL default '1',
`parent_id` int(11) default NULL,
`created_on` datetime default NULL,
`updated_on` datetime default NULL,
`identifier` varchar(20) default NULL,
`status` int(11) NOT NULL default '1',
`lft` int(11) default NULL,
`rgt` int(11) default NULL,
PRIMARY KEY (`id`),
KEY `index_projects_on_lft` (`lft`),
KEY `index_projects_on_rgt` (`rgt`)
) ENGINE=InnoDB AUTO_INCREMENT=78 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `projects_trackers`
--

DROP TABLE IF EXISTS `projects_trackers`;
SET saved_cs_client = @character_set_client;
SET character_set_client = utf8;
CREATE TABLE `projects_trackers` (
`project_id` int(11) NOT NULL default '0',
`tracker_id` int(11) NOT NULL default '0',
UNIQUE KEY `projects_trackers_unique` (`project_id`,`tracker_id`),
KEY `projects_trackers_project_id` (`project_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `queries`
--

DROP TABLE IF EXISTS `queries`;
SET saved_cs_client = @character_set_client;
SET character_set_client = utf8;
CREATE TABLE `queries` (
`id` int(11) NOT NULL auto_increment,
`project_id` int(11) default NULL,
`name` varchar(255) NOT NULL default '',
`filters` text,
`user_id` int(11) NOT NULL default '0',
`is_public` tinyint(1) NOT NULL default '0',
`column_names` text,
`sort_criteria` text,
`group_by` varchar(255) default NULL,
PRIMARY KEY (`id`),
KEY `index_queries_on_project_id` (`project_id`),
KEY `index_queries_on_user_id` (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=161 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `questions`
--

DROP TABLE IF EXISTS `questions`;
SET saved_cs_client = @character_set_client;
SET character_set_client = utf8;
CREATE TABLE `questions` (
`id` int(11) NOT NULL auto_increment,
`journal_id` int(11) default NULL,
`author_id` int(11) default NULL,
`assigned_to_id` int(11) default NULL,
`opened` tinyint(1) default '1',
`issue_id` int(11) default NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=118 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `repositories`
--

DROP TABLE IF EXISTS `repositories`;
SET saved_cs_client = @character_set_client;
SET character_set_client = utf8;
CREATE TABLE `repositories` (
`id` int(11) NOT NULL auto_increment,
`project_id` int(11) NOT NULL default '0',
`url` varchar(255) NOT NULL default '',
`login` varchar(60) default '',
`password` varchar(60) default '',
`root_url` varchar(255) default '',
`type` varchar(255) default NULL,
PRIMARY KEY (`id`),
KEY `index_repositories_on_project_id` (`project_id`)
) ENGINE=InnoDB AUTO_INCREMENT=39 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `roles`
--

DROP TABLE IF EXISTS `roles`;
SET saved_cs_client = @character_set_client;
SET character_set_client = utf8;
CREATE TABLE `roles` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(30) NOT NULL default '',
`position` int(11) default '1',
`assignable` tinyint(1) default '1',
`builtin` int(11) NOT NULL default '0',
`permissions` text,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `schedule_closed_entries`
--

DROP TABLE IF EXISTS `schedule_closed_entries`;
SET saved_cs_client = @character_set_client;
SET character_set_client = utf8;
CREATE TABLE `schedule_closed_entries` (
`id` int(11) NOT NULL auto_increment,
`user_id` int(11) NOT NULL default '0',
`date` date NOT NULL,
`hours` float NOT NULL,
`comment` text,
PRIMARY KEY (`id`),
KEY `schedule_closed_entries_user_id` (`user_id`),
KEY `schedule_closed_entries_date` (`date`)
) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `schedule_defaults`
--

DROP TABLE IF EXISTS `schedule_defaults`;
SET saved_cs_client = @character_set_client;
SET character_set_client = utf8;
CREATE TABLE `schedule_defaults` (
`id` int(11) NOT NULL auto_increment,
`user_id` int(11) NOT NULL default '0',
`weekday_hours` text,
PRIMARY KEY (`id`),
KEY `schedule_defaults_user_id` (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `schedule_entries`
--

DROP TABLE IF EXISTS `schedule_entries`;
SET saved_cs_client = @character_set_client;
SET character_set_client = utf8;
CREATE TABLE `schedule_entries` (
`id` int(11) NOT NULL auto_increment,
`user_id` int(11) NOT NULL default '0',
`project_id` int(11) NOT NULL default '0',
`date` date NOT NULL,
`hours` float NOT NULL,
PRIMARY KEY (`id`),
KEY `schedule_entries_project_id` (`project_id`),
KEY `schedule_entries_user_id` (`user_id`),
KEY `schedule_entries_date` (`date`)
) ENGINE=InnoDB AUTO_INCREMENT=396 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `schema_migrations`
--

DROP TABLE IF EXISTS `schema_migrations`;
SET saved_cs_client = @character_set_client;
SET character_set_client = utf8;
CREATE TABLE `schema_migrations` (
`version` varchar(255) NOT NULL,
UNIQUE KEY `unique_schema_migrations` (`version`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `settings`
--

DROP TABLE IF EXISTS `settings`;
SET saved_cs_client = @character_set_client;
SET character_set_client = utf8;
CREATE TABLE `settings` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(255) NOT NULL default '',
`value` text,
`updated_on` datetime default NULL,
PRIMARY KEY (`id`),
KEY `index_settings_on_name` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=50 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `time_entries`
--

DROP TABLE IF EXISTS `time_entries`;
SET saved_cs_client = @character_set_client;
SET character_set_client = utf8;
CREATE TABLE `time_entries` (
`id` int(11) NOT NULL auto_increment,
`project_id` int(11) NOT NULL default '0',
`user_id` int(11) NOT NULL default '0',
`issue_id` int(11) default NULL,
`hours` float NOT NULL default '0',
`comments` varchar(255) default NULL,
`activity_id` int(11) NOT NULL default '0',
`spent_on` date NOT NULL default '0000-00-00',
`tyear` int(11) NOT NULL default '0',
`tmonth` int(11) NOT NULL default '0',
`tweek` int(11) NOT NULL default '0',
`created_on` datetime NOT NULL default '0000-00-00 00:00:00',
`updated_on` datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (`id`),
KEY `time_entries_project_id` (`project_id`),
KEY `time_entries_issue_id` (`issue_id`),
KEY `index_time_entries_on_activity_id` (`activity_id`),
KEY `index_time_entries_on_user_id` (`user_id`),
KEY `index_time_entries_on_created_on` (`created_on`)
) ENGINE=InnoDB AUTO_INCREMENT=6225 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `tokens`
--

DROP TABLE IF EXISTS `tokens`;
SET saved_cs_client = @character_set_client;
SET character_set_client = utf8;
CREATE TABLE `tokens` (
`id` int(11) NOT NULL auto_increment,
`user_id` int(11) NOT NULL default '0',
`action` varchar(30) NOT NULL default '',
`value` varchar(40) NOT NULL default '',
`created_on` datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (`id`),
KEY `index_tokens_on_user_id` (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=1464 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `trackers`
--

DROP TABLE IF EXISTS `trackers`;
SET saved_cs_client = @character_set_client;
SET character_set_client = utf8;
CREATE TABLE `trackers` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(30) NOT NULL default '',
`is_in_chlog` tinyint(1) NOT NULL default '0',
`position` int(11) default '1',
`is_in_roadmap` tinyint(1) NOT NULL default '1',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `user_preferences`
--

DROP TABLE IF EXISTS `user_preferences`;
SET saved_cs_client = @character_set_client;
SET character_set_client = utf8;
CREATE TABLE `user_preferences` (
`id` int(11) NOT NULL auto_increment,
`user_id` int(11) NOT NULL default '0',
`others` text,
`hide_mail` tinyint(1) default '0',
`time_zone` varchar(255) default NULL,
PRIMARY KEY (`id`),
KEY `index_user_preferences_on_user_id` (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=84 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `users`
--

DROP TABLE IF EXISTS `users`;
SET saved_cs_client = @character_set_client;
SET character_set_client = utf8;
CREATE TABLE `users` (
`id` int(11) NOT NULL auto_increment,
`login` varchar(30) NOT NULL default '',
`hashed_password` varchar(40) NOT NULL default '',
`firstname` varchar(30) NOT NULL default '',
`lastname` varchar(30) NOT NULL default '',
`mail` varchar(60) NOT NULL default '',
`mail_notification` tinyint(1) NOT NULL default '1',
`admin` tinyint(1) NOT NULL default '0',
`status` int(11) NOT NULL default '1',
`last_login_on` datetime default NULL,
`language` varchar(5) default '',
`auth_source_id` int(11) default NULL,
`created_on` datetime default NULL,
`updated_on` datetime default NULL,
`type` varchar(255) default NULL,
`identity_url` varchar(255) default NULL,
PRIMARY KEY (`id`),
KEY `index_users_on_id_and_type` (`id`,`type`),
KEY `index_users_on_auth_source_id` (`auth_source_id`)
) ENGINE=InnoDB AUTO_INCREMENT=89 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `versions`
--

DROP TABLE IF EXISTS `versions`;
SET saved_cs_client = @character_set_client;
SET character_set_client = utf8;
CREATE TABLE `versions` (
`id` int(11) NOT NULL auto_increment,
`project_id` int(11) NOT NULL default '0',
`name` varchar(255) default '',
`description` varchar(255) default '',
`effective_date` date default NULL,
`created_on` datetime default NULL,
`updated_on` datetime default NULL,
`wiki_page_title` varchar(255) default NULL,
`status` varchar(255) default 'open',
`sharing` varchar(255) NOT NULL default 'none',
PRIMARY KEY (`id`),
KEY `versions_project_id` (`project_id`),
KEY `index_versions_on_sharing` (`sharing`)
) ENGINE=InnoDB AUTO_INCREMENT=331 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `watchers`
--

DROP TABLE IF EXISTS `watchers`;
SET saved_cs_client = @character_set_client;
SET character_set_client = utf8;
CREATE TABLE `watchers` (
`id` int(11) NOT NULL auto_increment,
`watchable_type` varchar(255) NOT NULL default '',
`watchable_id` int(11) NOT NULL default '0',
`user_id` int(11) default NULL,
PRIMARY KEY (`id`),
KEY `watchers_user_id_type` (`user_id`,`watchable_type`),
KEY `index_watchers_on_user_id` (`user_id`),
KEY `index_watchers_on_watchable_id_and_watchable_type` (`watchable_id`,`watchable_type`)
) ENGINE=InnoDB AUTO_INCREMENT=1060 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `wiki_content_versions`
--

DROP TABLE IF EXISTS `wiki_content_versions`;
SET saved_cs_client = @character_set_client;
SET character_set_client = utf8;
CREATE TABLE `wiki_content_versions` (
`id` int(11) NOT NULL auto_increment,
`wiki_content_id` int(11) NOT NULL default '0',
`page_id` int(11) NOT NULL default '0',
`author_id` int(11) default NULL,
`data` longblob,
`compression` varchar(6) default '',
`comments` varchar(255) default '',
`updated_on` datetime NOT NULL default '0000-00-00 00:00:00',
`version` int(11) NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `wiki_content_versions_wcid` (`wiki_content_id`),
KEY `index_wiki_content_versions_on_updated_on` (`updated_on`)
) ENGINE=InnoDB AUTO_INCREMENT=6225 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `wiki_contents`
--

DROP TABLE IF EXISTS `wiki_contents`;
SET saved_cs_client = @character_set_client;
SET character_set_client = utf8;
CREATE TABLE `wiki_contents` (
`id` int(11) NOT NULL auto_increment,
`page_id` int(11) NOT NULL default '0',
`author_id` int(11) default NULL,
`text` longtext,
`comments` varchar(255) default '',
`updated_on` datetime NOT NULL default '0000-00-00 00:00:00',
`version` int(11) NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `wiki_contents_page_id` (`page_id`),
KEY `index_wiki_contents_on_author_id` (`author_id`)
) ENGINE=InnoDB AUTO_INCREMENT=701 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `wiki_pages`
--

DROP TABLE IF EXISTS `wiki_pages`;
SET saved_cs_client = @character_set_client;
SET character_set_client = utf8;
CREATE TABLE `wiki_pages` (
`id` int(11) NOT NULL auto_increment,
`wiki_id` int(11) NOT NULL default '0',
`title` varchar(255) NOT NULL default '',
`created_on` datetime NOT NULL default '0000-00-00 00:00:00',
`protected` tinyint(1) NOT NULL default '0',
`parent_id` int(11) default NULL,
PRIMARY KEY (`id`),
KEY `wiki_pages_wiki_id_title` (`wiki_id`,`title`),
KEY `index_wiki_pages_on_wiki_id` (`wiki_id`),
KEY `index_wiki_pages_on_parent_id` (`parent_id`)
) ENGINE=InnoDB AUTO_INCREMENT=701 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `wiki_redirects`
--

DROP TABLE IF EXISTS `wiki_redirects`;
SET saved_cs_client = @character_set_client;
SET character_set_client = utf8;
CREATE TABLE `wiki_redirects` (
`id` int(11) NOT NULL auto_increment,
`wiki_id` int(11) NOT NULL default '0',
`title` varchar(255) default NULL,
`redirects_to` varchar(255) default NULL,
`created_on` datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (`id`),
KEY `wiki_redirects_wiki_id_title` (`wiki_id`,`title`),
KEY `index_wiki_redirects_on_wiki_id` (`wiki_id`)
) ENGINE=InnoDB AUTO_INCREMENT=68 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `wikis`
--

DROP TABLE IF EXISTS `wikis`;
SET saved_cs_client = @character_set_client;
SET character_set_client = utf8;
CREATE TABLE `wikis` (
`id` int(11) NOT NULL auto_increment,
`project_id` int(11) NOT NULL default '0',
`start_page` varchar(255) NOT NULL default '',
`status` int(11) NOT NULL default '1',
PRIMARY KEY (`id`),
KEY `wikis_project_id` (`project_id`)
) ENGINE=InnoDB AUTO_INCREMENT=49 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;

--
-- Table structure for table `workflows`
--

DROP TABLE IF EXISTS `workflows`;
SET saved_cs_client = @character_set_client;
SET character_set_client = utf8;
CREATE TABLE `workflows` (
`id` int(11) NOT NULL auto_increment,
`tracker_id` int(11) NOT NULL default '0',
`old_status_id` int(11) NOT NULL default '0',
`new_status_id` int(11) NOT NULL default '0',
`role_id` int(11) NOT NULL default '0',
PRIMARY KEY (`id`),
KEY `workflows_role_tracker_old_status` (`role_id`,`tracker_id`,`old_status_id`),
KEY `index_workflows_on_old_status_id` (`old_status_id`),
KEY `index_workflows_on_role_id` (`role_id`),
KEY `index_workflows_on_new_status_id` (`new_status_id`)
) ENGINE=InnoDB AUTO_INCREMENT=1451 DEFAULT CHARSET=utf8;
SET character_set_client = @saved_cs_client;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE /;
/
!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS /;
/
!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS /;
/
!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT /;
/
!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS /;
/
!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION /;
/
!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2010-08-12 7:36:38

RE: Custom Field Query Error - Added by Jacky Leung about 9 years ago

Paolo Proni wrote:

bleedingiest of edges ? Sorry, but I don't understand it.

Anyway thank you very much for your quick answers. We have the last RedMine 1.0 RC but this is the result of several updates. I have installed some plugins:
question, google_calendar, mylyn, schedules, timesheet.

Actually, we have two different instances (in two different computers) and the problem seems fixed in one instance only, using the patch. In the working instance there were no custom fields before.

Is it a problem with the database structure ? Can I send the table structure (without data), or is it too long to be posted?

The troubled instance contains a lot of data now, I don't know what to do, because the queries do not work.

Try to search for sql_for_field(), it seem you have somewhere overwrite the function to accept 5 parameters while you are putting in 6 parameters

RE: Custom Field Query Error - Added by Jacky Leung about 9 years ago

Jacky Leung wrote:

Paolo Proni wrote:

bleedingiest of edges ? Sorry, but I don't understand it.

Anyway thank you very much for your quick answers. We have the last RedMine 1.0 RC but this is the result of several updates. I have installed some plugins:
question, google_calendar, mylyn, schedules, timesheet.

Actually, we have two different instances (in two different computers) and the problem seems fixed in one instance only, using the patch. In the working instance there were no custom fields before.

Is it a problem with the database structure ? Can I send the table structure (without data), or is it too long to be posted?

The troubled instance contains a lot of data now, I don't know what to do, because the queries do not work.

Try to search for sql_for_field(), it seem you have somewhere overwrite the function to accept 5 parameters while you are putting in 6 parameters

It is possible you have old version of question plugin, try update your question plugin to newest one

RE: Custom Field Query Error - Added by Paolo Proni about 9 years ago

I see in app/models/query.rb the function sql_for_field() accept 5 parameters, while before the code attempts to pass 6 parameters, with a true constant value as the last parameter.
Now I am checking for the plugin also...

RE: Custom Field Query Error - Added by Paolo Proni about 9 years ago

I have just installed the question plugin, without any success.

RE: Custom Field Query Error - Added by Paolo Proni about 9 years ago

I modified a call in whe query.rb where there were 6 parameters: I simply cut off the last parameter, it was a true constant.
Here is the line:
sql << sql_for_field(field, operator, v, db_table, db_field, true)

Now it seems to work, but I know it is not a clean solution.
Any suggestion is appreciated.

Thank you,
Paolo

RE: Custom Field Query Error - Added by Jacky Leung about 9 years ago

Paolo Proni wrote:

I modified a call in whe query.rb where there were 6 parameters: I simply cut off the last parameter, it was a true constant.
Here is the line:
sql << sql_for_field(field, operator, v, db_table, db_field, true)

Now it seems to work, but I know it is not a clean solution.
Any suggestion is appreciated.

Thank you,
Paolo

Where do you get your redmine from? it seem you have outdated code. the sql_for_field in the latest code accept 6 parameters, and this function start accepting 6 parameters since last year https://github.com/bwc/redmine/commit/e1b828de95ececbe630e74caf3b18e47c669c58d

probably you should get a new fresh copy of redmine from repository again?

RE: Custom Field Query Error - Added by Paolo Proni about 9 years ago

I downloaded RedMine from http://rubyforge.org/frs/?group_id=1850
I did it again and in query.rb I see some call to sql_for_field with 5 parameters and other with 6 parameters.

RE: Custom Field Query Error - Added by Jacky Leung about 9 years ago

Paolo Proni wrote:

I downloaded RedMine from http://rubyforge.org/frs/?group_id=1850
I did it again and in query.rb I see some call to sql_for_field with 5 parameters and other with 6 parameters.

that is because the last parameter has default value. can you copy the function definition for sql_for_field?

RE: Custom Field Query Error - Added by Andrea Saccavini about 9 years ago

I have tha same problem in a new fresh 1.0.2 installation with question plugin.
Applying Paolo's suggestion on query.rb all seems to work fine.
Any idea?

Tks

RE: Custom Field Query Error - Added by Felix Schäfer about 9 years ago

Andrea Saccavini wrote:

I have tha same problem in a new fresh 1.0.2 installation with question plugin.
Applying Paolo's suggestion on query.rb all seems to work fine.
Any idea?

I just checked on trunk and had no problem. Please try on a clean installation without any plugin and open a bug if the problem persists, if not, contact the author of the question plugin and report the bug to him.

RE: Custom Field Query Error - Added by SoftING Administrator over 5 years ago

We have the same problem on redmine 1.2.1 stable over ubuntu LTS 10.04

(1-16/16)