maxrossello / redmine_app_timesheets

A true timesheet plugin using orders, not bound to timelogs over issues
GNU General Public License v2.0
32 stars 10 forks source link

Unable to install plugin #7

Closed druidPollux closed 10 years ago

druidPollux commented 10 years ago

Wil running the command: bundle exec rake redmine:plugins RAILS_ENV=production NAME=redmine_app_timesheets

The following error is reported: Couldn't find Project with id=0

Here is the log:

* Invoke redmine:plugins (first_time) * Execute redmine:plugins * Invoke redmine:plugins:migrate (first_time) * Invoke environment (first_time) * Execute environment * Execute redmine:plugins:migrate Migrating redmine_app_timesheets (Redmine Timesheets Application)... == VersionInTimesheet: migrating ============================================= -- add_column(:versions, :in_timesheet, :boolean, {:default=>false, :null=>false}) -> 0.1730s == VersionInTimesheet: migrated (0.1750s) ====================================

== TimeEntriesInTimesheet: migrating ========================================= -- add_column(:time_entries, :in_timesheet, :boolean, {:default=>false, :null=>false}) -> 0.1610s == TimeEntriesInTimesheet: migrated (0.1640s) ================================

== TimeEntriesVersion: migrating ============================================= -- add_column(:time_entries, :fixed_version_id, :integer) -> 0.1380s == TimeEntriesVersion: migrated (0.1410s) ====================================

== Activities: migrating ===================================================== -- create_table(:ts_activities) -> 0.0590s -- add_index(:ts_activities, :order_id) -> 0.0930s == Activities: migrated (0.1590s) ============================================

== RevertTimeEntriesInTimesheet: migrating =================================== == RevertTimeEntriesInTimesheet: migrated (0.0700s) ==========================

== RemoveInTimesheet: migrating ============================================== -- remove_column(:time_entries, :in_timesheet) -> 0.1210s -- rename_column(:time_entries, :fixed_version_id, :order_id) -> 0.1390s == RemoveInTimesheet: migrated (0.2650s) =====================================

== DisjointActivity: migrating =============================================== -- add_column(:time_entries, :order_activity_id, :integer) -> 0.1340s == DisjointActivity: migrated (0.1390s) ======================================

== TsPermissions: migrating ================================================== -- create_table(:ts_permissions) -> 0.0680s -- add_index(:ts_permissions, [:user_id, :order_id]) -> 0.0890s rake aborted! An error has occurred, all later migrations canceled:

Couldn't find Project with id=0 E:/intranet/ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.2.16/lib/active_record/relation/findermethods.rb:344:in `find one' E:/intranet/ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.2.16/lib/active_record/relation/findermethods.rb:315:in`find with_ids' E:/intranet/ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.2.16/lib/active_record/relation/finder_methods.rb:107:in `find'

E:in find' E:/intranet/apps/redmine/htdocs/app/models/project.rb:285:infind' E:/intranet/apps/redmine/htdocs/plugins/redmine_app_timesheets/db/migrate/008_ts_permissions.rb:10:in up' E:/intranet/ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.2.16/lib/active_record/migration.rb:410:inblock (2 levels) in migrate' E:/intranet/ruby/lib/ruby/1.9.1/benchmark.rb:280:in measure' E:/intranet/ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.2.16/lib/active_record/migration.rb:410:inblock in migrate' E:/intranet/ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.2.16/lib/active_record/connectionadapters/abstract/connection pool.rb:129:in with_connection' E:/intranet/ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.2.16/lib/active_record/migration.rb:389:inmigrate' E:in migrate' E:/intranet/ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.2.16/lib/active_record/migration.rb:720:inblock (2 levels) in migrate' E:/intranet/ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.2.16/lib/active_record/migration.rb:777:in call' E:/intranet/ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.2.16/lib/active_record/migration.rb:777:inddl_transaction' E:/intranet/ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.2.16/lib/active_record/migration.rb:719:in block in migrate' E:/intranet/ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.2.16/lib/active_record/migration.rb:700:ineach' E:/intranet/ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.2.16/lib/active_record/migration.rb:700:in migrate' E:/intranet/ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.2.16/lib/active_record/migration.rb:570:inup' E:/intranet/ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.2.16/lib/active_record/migration.rb:551:in migrate' E:/intranet/apps/redmine/htdocs/lib/redmine/plugin.rb:452:inmigrate_plugin' E:/intranet/apps/redmine/htdocs/lib/redmine/plugin.rb:424:in migrate' E:/intranet/apps/redmine/htdocs/lib/redmine/plugin.rb:435:inmigrate' E:/intranet/apps/redmine/htdocs/lib/tasks/redmine.rake:117:in block (3 levels) in <top (required)>' E:/intranet/ruby/lib/ruby/1.9.1/rake/task.rb:205:incall' E:/intranet/ruby/lib/ruby/1.9.1/rake/task.rb:205:in block in execute' E:/intranet/ruby/lib/ruby/1.9.1/rake/task.rb:200:ineach' E:/intranet/ruby/lib/ruby/1.9.1/rake/task.rb:200:in execute' E:/intranet/ruby/lib/ruby/1.9.1/rake/task.rb:158:inblock in invoke_with_call_chain' E:/intranet/ruby/lib/ruby/1.9.1/monitor.rb:211:in mon_synchronize' E:/intranet/ruby/lib/ruby/1.9.1/rake/task.rb:151:ininvoke_with_call_chain' E:/intranet/ruby/lib/ruby/1.9.1/rake/task.rb:144:in invoke' E:/intranet/apps/redmine/htdocs/lib/tasks/redmine.rake:52:inblock (2 levels) in <top (required)>' E:/intranet/ruby/lib/ruby/1.9.1/rake/task.rb:205:in call' E:/intranet/ruby/lib/ruby/1.9.1/rake/task.rb:205:inblock in execute' E:/intranet/ruby/lib/ruby/1.9.1/rake/task.rb:200:in each' E:/intranet/ruby/lib/ruby/1.9.1/rake/task.rb:200:inexecute' E:/intranet/ruby/lib/ruby/1.9.1/rake/task.rb:158:in block in invoke_with_call_chain' E:/intranet/ruby/lib/ruby/1.9.1/monitor.rb:211:inmon_synchronize' E:/intranet/ruby/lib/ruby/1.9.1/rake/task.rb:151:in invoke_with_call_chain' E:/intranet/ruby/lib/ruby/1.9.1/rake/task.rb:144:ininvoke' E:/intranet/ruby/lib/ruby/1.9.1/rake/application.rb:116:in invoke_task' E:/intranet/ruby/lib/ruby/1.9.1/rake/application.rb:94:inblock (2 levels) in top_level' E:/intranet/ruby/lib/ruby/1.9.1/rake/application.rb:94:in each' E:/intranet/ruby/lib/ruby/1.9.1/rake/application.rb:94:inblock in top_level' E:/intranet/ruby/lib/ruby/1.9.1/rake/application.rb:133:in standard_exception_handling' E:/intranet/ruby/lib/ruby/1.9.1/rake/application.rb:88:intop_level' E:/intranet/ruby/lib/ruby/1.9.1/rake/application.rb:66:in block in run' E:/intranet/ruby/lib/ruby/1.9.1/rake/application.rb:133:instandard_exception_handling' E:/intranet/ruby/lib/ruby/1.9.1/rake/application.rb:63:in run' E:/intranet/ruby/bin/rake:32:in

' Tasks: TOP => redmine:plugins:migrate

maxrossello commented 10 years ago

Ok, I guess that the problem is that on clean installs the backing project is not configured.

Can you please try to edit line 10 in db/migrate/008_ts_permissions.rb as follows and tell me how it goes then?

 backing = Project.find(Setting.plugin_redmine_app_timesheets['project'].to_i) rescue nil
maxrossello commented 10 years ago

Sorry, safer as follows:

backing = (Project.find(Setting.plugin_redmine_app_timesheets['project'].to_i) rescue nil)
druidPollux commented 10 years ago

This fix does the job. Thanks !

maxrossello commented 10 years ago

Thank you for testing!