paper_trail 5.1.0 → 5.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 83f408e34bbaf733c5fdab5ad37fc8c3718ab7ad
4
- data.tar.gz: b1e73feb664e29d18946f3c526b1bb6b1ccec024
3
+ metadata.gz: e471a732adc2f061cb578d20237b672b93297b8a
4
+ data.tar.gz: 5e05efb3575d7f29cd256a68de86e381e0b6f12c
5
5
  SHA512:
6
- metadata.gz: b61edd25675bb0ea5254640920f04ff23aab1fc9dc729bc2bb27c5f4bd6774fb6e86df50d213d173a2892e7b2ef2e15240745e541d9f4fb0238c4b07574f6e56
7
- data.tar.gz: 8b701f3921a8945fd3e7e55dbda82c7b716711e457f72caf7054dd502fd77a927ef5c5ebcf7d634f9c8465ba0bc8c44cc057220bea24cbaac1f5dbad7f2c9a96
6
+ metadata.gz: 8fa9c2ed5b166efa37dff6b479816ebd9d2c00aed2a4ec2c857626d42ad5be6525bd6d88b80367e0829bcb17f80ed470ff41dc3d7cfeabadc08b0cc8676753ca
7
+ data.tar.gz: 6e56713f695d7eef4dd8b86da138c37f6ab8767d8188e88f4679b8c5efddc0fdbe2caf4e1f2ca9398104d360dc9f08b29c4e7cd3880e58f1aac99bc2e226e2c9
@@ -12,6 +12,23 @@
12
12
 
13
13
  - None
14
14
 
15
+ ## 5.1.1 (2016-05-31)
16
+
17
+ ### Breaking Changes
18
+
19
+ - None
20
+
21
+ ### Added
22
+
23
+ - None
24
+
25
+ ### Fixed
26
+
27
+ - [#813](https://github.com/airblade/paper_trail/pull/813) -
28
+ Warning for paper_trail_on_destroy(:after) for pre-releases of AR 5
29
+ - [#651](https://github.com/airblade/paper_trail/issues/651) -
30
+ Bug with installing PT on MySQL <= 5.6
31
+
15
32
  ## 5.1.0 (2016-05-20)
16
33
 
17
34
  ### Breaking Changes
@@ -17,7 +17,7 @@ class CreateVersions < ActiveRecord::Migration
17
17
 
18
18
  def change
19
19
  create_table :versions, versions_table_options do |t|
20
- t.string :item_type, null: false
20
+ t.string :item_type, item_type_options
21
21
  t.integer :item_id, null: false
22
22
  t.string :event, null: false
23
23
  t.string :whodunnit
@@ -43,6 +43,18 @@ class CreateVersions < ActiveRecord::Migration
43
43
 
44
44
  private
45
45
 
46
+ # MySQL 5.6 utf8mb4 limit is 191 chars for keys used in indexes.
47
+ # See https://github.com/airblade/paper_trail/issues/651
48
+ def item_type_options
49
+ opt = { null: false }
50
+ opt[:limit] = 191 if mysql?
51
+ opt
52
+ end
53
+
54
+ def mysql?
55
+ MYSQL_ADAPTERS.include?(connection.class.name)
56
+ end
57
+
46
58
  # Even modern versions of MySQL still use `latin1` as the default character
47
59
  # encoding. Many users are not aware of this, and run into trouble when they
48
60
  # try to use PaperTrail in apps that otherwise tend to use UTF-8. Postgres, by
@@ -59,7 +71,7 @@ class CreateVersions < ActiveRecord::Migration
59
71
  # - https://dev.mysql.com/doc/refman/5.5/en/charset-unicode-utf8mb4.html
60
72
  #
61
73
  def versions_table_options
62
- if MYSQL_ADAPTERS.include?(connection.class.name)
74
+ if mysql?
63
75
  { options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci" }
64
76
  else
65
77
  {}
@@ -179,8 +179,8 @@ module PaperTrail
179
179
  raise ArgumentError, 'recording order can only be "after" or "before"'
180
180
  end
181
181
 
182
- if recording_order == "after" &&
183
- Gem::Version.new(ActiveRecord::VERSION::STRING) >= Gem::Version.new("5")
182
+ if recording_order.to_s == "after" &&
183
+ Gem::Version.new(ActiveRecord::VERSION::STRING).release >= Gem::Version.new("5")
184
184
  if ::ActiveRecord::Base.belongs_to_required_by_default
185
185
  ::ActiveSupport::Deprecation.warn(
186
186
  "paper_trail_on_destroy(:after) is incompatible with ActiveRecord " +
@@ -3,7 +3,7 @@ module PaperTrail
3
3
  module VERSION
4
4
  MAJOR = 5
5
5
  MINOR = 1
6
- TINY = 0
6
+ TINY = 1
7
7
  PRE = nil
8
8
 
9
9
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".").freeze
@@ -38,7 +38,7 @@ class SetUpTestTables < ActiveRecord::Migration
38
38
  end
39
39
 
40
40
  create_table :versions, versions_table_options do |t|
41
- t.string :item_type, null: false
41
+ t.string :item_type, item_type_options
42
42
  t.integer :item_id, null: false
43
43
  t.string :event, null: false
44
44
  t.string :whodunnit
@@ -323,11 +323,21 @@ class SetUpTestTables < ActiveRecord::Migration
323
323
 
324
324
  private
325
325
 
326
+ def item_type_options
327
+ opt = { null: false }
328
+ opt[:limit] = 191 if mysql?
329
+ opt
330
+ end
331
+
332
+ def mysql?
333
+ MYSQL_ADAPTERS.include?(connection.class.name)
334
+ end
335
+
326
336
  def versions_table_options
327
- opts = { force: true }
328
- if MYSQL_ADAPTERS.include?(connection.class.name)
329
- opts[:options] = "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci"
337
+ if mysql?
338
+ { options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci" }
339
+ else
340
+ {}
330
341
  end
331
- opts
332
342
  end
333
343
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paper_trail
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.1.0
4
+ version: 5.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Stewart
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-05-20 00:00:00.000000000 Z
12
+ date: 2016-05-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord