Skip to content

Commit

Permalink
Rename delayed_job_statuses to job_statuses.
Browse files Browse the repository at this point in the history
  • Loading branch information
ba1ash committed Feb 29, 2024
1 parent a59e01e commit 0294e4b
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 2 deletions.
33 changes: 33 additions & 0 deletions db/migrate/20240229133250_rename_delayed_job_statuses.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2024 the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
# Copyright (C) 2006-2013 Jean-Philippe Lang
# Copyright (C) 2010-2013 the ChiliProject Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See COPYRIGHT and LICENSE files for more details.
#++

class RenameDelayedJobStatuses < ActiveRecord::Migration[7.1]
def change
rename_table :delayed_job_statuses, :job_statuses
end
end
30 changes: 29 additions & 1 deletion modules/job_status/app/models/job_status/status.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,34 @@
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2024 the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
#
# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
# Copyright (C) 2006-2013 Jean-Philippe Lang
# Copyright (C) 2010-2013 the ChiliProject Team
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# See COPYRIGHT and LICENSE files for more details.
#++

module JobStatus
class Status < ApplicationRecord
self.table_name = 'delayed_job_statuses'
self.table_name = 'job_statuses'

belongs_to :user
belongs_to :reference, polymorphic: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def upsert_status(status:, **args)
resource.attributes = build_status_attributes(args.merge(status:))
end

# There is a possible race condition because of unique delayed_job_statuses.job_id
# There is a possible race condition because of unique job_statuses.job_id
# Can't use upsert easily, because before updating we need to know user_id
# to set proper locale. Probably, it is possible to get it from
# a job's payload, then it would be possible to correctly prepare attributes before using upsert.
Expand Down

0 comments on commit 0294e4b

Please sign in to comment.