Log once off jobs and enqueue on db:migrate

This commit is contained in:
Robin Ward
2016-04-07 14:32:31 -04:00
parent 855f72deb6
commit 078b3bc87e
5 changed files with 43 additions and 6 deletions

View File

@@ -7,6 +7,8 @@ end
task 'db:migrate' => ['environment', 'set_locale'] do
SeedFu.seed
Jobs::Onceoff.enqueue_all
SiteSetting.last_vacuum = Time.now.to_i if SiteSetting.last_vacuum == 0
if SiteSetting.vacuum_db_days > 0 &&
@@ -82,7 +84,7 @@ task 'db:rebuild_indexes' => 'environment' do
begin
puts index_name
User.exec_sql("DROP INDEX public.#{index_name}")
rescue ActiveRecord::StatementInvalid => e
rescue ActiveRecord::StatementInvalid
# It's this:
# PG::Error: ERROR: cannot drop index category_users_pkey because constraint category_users_pkey on table category_users requires it
# HINT: You can drop constraint category_users_pkey on table category_users instead.
@@ -94,7 +96,7 @@ task 'db:rebuild_indexes' => 'environment' do
index_definitions[table_name].each do |index_def|
begin
User.exec_sql(index_def)
rescue ActiveRecord::StatementInvalid => e
rescue ActiveRecord::StatementInvalid
# Trying to recreate a primary key
end
end