Closed druidPollux closed 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
Sorry, safer as follows:
backing = (Project.find(Setting.plugin_redmine_app_timesheets['project'].to_i) rescue nil)
This fix does the job. Thanks !
Thank you for testing!
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'
Tasks: TOP => redmine:plugins:migrate
find' E:/intranet/apps/redmine/htdocs/app/models/project.rb:285:in
find' E:/intranet/apps/redmine/htdocs/plugins/redmine_app_timesheets/db/migrate/008_ts_permissions.rb:10:inup' E:/intranet/ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.2.16/lib/active_record/migration.rb:410:in
block (2 levels) in migrate' E:/intranet/ruby/lib/ruby/1.9.1/benchmark.rb:280:inmeasure' E:/intranet/ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.2.16/lib/active_record/migration.rb:410:in
block 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:inwith_connection' E:/intranet/ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.2.16/lib/active_record/migration.rb:389:in
migrate' E:inmigrate' E:/intranet/ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.2.16/lib/active_record/migration.rb:720:in
block (2 levels) in migrate' E:/intranet/ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.2.16/lib/active_record/migration.rb:777:incall' E:/intranet/ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.2.16/lib/active_record/migration.rb:777:in
ddl_transaction' E:/intranet/ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.2.16/lib/active_record/migration.rb:719:inblock in migrate' E:/intranet/ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.2.16/lib/active_record/migration.rb:700:in
each' E:/intranet/ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.2.16/lib/active_record/migration.rb:700:inmigrate' E:/intranet/ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.2.16/lib/active_record/migration.rb:570:in
up' E:/intranet/ruby/lib/ruby/gems/1.9.1/gems/activerecord-3.2.16/lib/active_record/migration.rb:551:inmigrate' E:/intranet/apps/redmine/htdocs/lib/redmine/plugin.rb:452:in
migrate_plugin' E:/intranet/apps/redmine/htdocs/lib/redmine/plugin.rb:424:inmigrate' E:/intranet/apps/redmine/htdocs/lib/redmine/plugin.rb:435:in
migrate' E:/intranet/apps/redmine/htdocs/lib/tasks/redmine.rake:117:inblock (3 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/apps/redmine/htdocs/lib/tasks/redmine.rake:52:in
block (2 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/ruby/lib/ruby/1.9.1/rake/application.rb:116:ininvoke_task' E:/intranet/ruby/lib/ruby/1.9.1/rake/application.rb:94:in
block (2 levels) in top_level' E:/intranet/ruby/lib/ruby/1.9.1/rake/application.rb:94:ineach' E:/intranet/ruby/lib/ruby/1.9.1/rake/application.rb:94:in
block in top_level' 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:88:in
top_level' E:/intranet/ruby/lib/ruby/1.9.1/rake/application.rb:66:inblock in run' 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:63:inrun' E:/intranet/ruby/bin/rake:32:in