プロジェクト

全般

プロフィール

Vote #70988

完了

Adding multiple times the same related issue relation is possible

Admin Redmine さんが約4年前に追加. 約4年前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Issues_2
対象バージョン:
開始日:
2011/11/29
期日:
進捗率:

0%

予定工数:
category_id:
2
version_id:
40
issue_org_id:
9685
author_id:
6508
assigned_to_id:
0
comments:
6
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
38
ステータス-->[Closed]

説明

See #4911, I added relation to #7445 twice in a row with Firefox (unstable) just pressing Enter key, maybe longer than normal.


journals

As explained in RoR documentation (both 2.3.x and 3.x, this excerpt is from "3.x'":http://api.rubyonrails.org/classes/ActiveRecord/Validations/ClassMethods.html#method-i-validates_uniqueness_of):
<pre>
Concurrency and integrity

Using this validation method in conjunction with ActiveRecord::Base#save does not guarantee the absence of duplicate record insertions, because uniqueness checks on the application level are inherently prone to race conditions.
(...)
This could even happen if you use transactions with the ‘serializable’ isolation level. The best way to work around this problem is to add a unique index to the database table using (...)#add_index.

(...)
The bundled ActiveRecord::ConnectionAdapters distinguish unique index constraint errors from other types of database errors by throwing an ActiveRecord::RecordNotUnique exception. For other adapters you will have to parse the (database-specific) exception message to detect such a case.
</pre>

A simple migration creating an unique index on @to@ and @from@ @issue_relation@ columns should do the job.

--------------------------------------------------------------------------------
Migration patch attached.
--------------------------------------------------------------------------------
Ok, since there is a migration, moving to major.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
Migration committed with r8041.
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------

Admin Redmine さんが約4年前に更新

  • カテゴリIssues_2 にセット
  • 対象バージョン1.4.0_40 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0