Commit fe7f430 1 parent aa0e6c0 commit fe7f430 Copy full SHA for fe7f430
File tree 3 files changed +18
-4
lines changed
3 files changed +18
-4
lines changed Original file line number Diff line number Diff line change
1
+ ## 0.6.0 (unreleased)
2
+
3
+ - Improved generator for Active Record encryption and MySQL
4
+
1
5
## 0.5.0 (2023-07-02)
2
6
3
7
- Made Active Record and Active Job optional
Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ rails generate authtrail:install --encryption=lockbox
21
21
rails db:migrate
22
22
```
23
23
24
- To use Active Record encryption (Rails 7+, experimental ), run:
24
+ To use Active Record encryption (Rails 7+), run:
25
25
26
26
``` sh
27
27
rails generate authtrail:install --encryption=activerecord
Original file line number Diff line number Diff line change @@ -39,8 +39,11 @@ def identity_column
39
39
when "lockbox"
40
40
"t.text :identity_ciphertext\n t.string :identity_bidx, index: true"
41
41
else
42
- # TODO add limit: 510 for Active Record encryption + MySQL?
43
- "t.string :identity, index: true"
42
+ if encryption == "activerecord" && mysql?
43
+ "t.string :identity, limit: 510, index: true"
44
+ else
45
+ "t.string :identity, index: true"
46
+ end
44
47
end
45
48
end
46
49
@@ -49,7 +52,6 @@ def ip_column
49
52
when "lockbox"
50
53
"t.text :ip_ciphertext\n t.string :ip_bidx, index: true"
51
54
else
52
- # TODO add limit: 510 for Active Record encryption + MySQL?
53
55
"t.string :ip, index: true"
54
56
end
55
57
end
@@ -78,6 +80,14 @@ def lockbox_method
78
80
"has_encrypted"
79
81
end
80
82
end
83
+
84
+ def mysql?
85
+ adapter =~ /mysql|trilogy/i
86
+ end
87
+
88
+ def adapter
89
+ ActiveRecord ::Base . connection_db_config . adapter . to_s
90
+ end
81
91
end
82
92
end
83
93
end
You can’t perform that action at this time.
0 commit comments