hairtrigger 0.2.17 → 0.2.18

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: a9ff019936d101e9c5493c4bdecd2d0791382144
4
- data.tar.gz: fb958cd57f2e1ee9042d4cedc966974514f446ac
3
+ metadata.gz: 3c525b3a5e80e73dfe8dfa9d1b6e8cd3f0c9636b
4
+ data.tar.gz: 4d02307f955177263f83b9412221e3fa2bcab7da
5
5
  SHA512:
6
- metadata.gz: ce30e5aecef79de39e998c07d7d23c4639fb035d5dacf424f8a984e39dbf9f71dfc89aa789d21bdbf935eca7d72ee6b9d46158d5d7a94bb93f3cb3ede98bff3d
7
- data.tar.gz: b65f3cd26a71adc564eec7f5c4baf04b80da610cf6c6d96de817265def64b22e78ba16f4ee31a1bb7604bc2ac4f47fdbf9c3353a71e77085c09882b9a5dfca6f
6
+ metadata.gz: 5631a904515f61388c15cdd07dad116796f9dd731a8e20e077251ef9c3432351ae82ee34d4ac8c7dfdbe850f1ef17626393796846dc7033ac8c754f83f392cc6
7
+ data.tar.gz: a90b316838dee6303756ded7833f21905f716699633aba8c50f8769af2f84b3d1fee286870fd8d3f116f7dd043ed64fcb797d3199d2df7de3ab3b6cad4987c9f
data/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
  # HairTrigger
2
- [<img src="https://secure.travis-ci.org/jenseng/hair_trigger.png?branch=master" />](http://travis-ci.org/jenseng/hair_trigger)
2
+ [<img src="https://secure.travis-ci.org/jenseng/hair_trigger.svg?branch=master" />](http://travis-ci.org/jenseng/hair_trigger)
3
3
 
4
4
  HairTrigger lets you create and manage database triggers in a concise,
5
5
  db-agnostic, Rails-y way. You declare triggers right in your models in Ruby,
@@ -106,7 +106,7 @@ Example: `trigger.after(:update).nowrap { "tsvector_update_trigger(...)" }`
106
106
 
107
107
  #### declare
108
108
  PostgreSQL-specific option for declaring variables for use in the
109
- trigger function. Declarations should be separate by semicolons, e.g.
109
+ trigger function. Declarations should be separated by semicolons, e.g.
110
110
 
111
111
  ```ruby
112
112
  trigger.after(:insert).declare("user_type text; status text") do
@@ -197,22 +197,22 @@ rolling back.
197
197
 
198
198
  #### Manual triggers and :compatibility
199
199
 
200
- As bugs are fixed and features are implemented in hairtrigger, it's possible
200
+ As bugs are fixed and features are implemented in HairTrigger, it's possible
201
201
  that the generated trigger SQL will change (this has only happened once so
202
- far). If you upgrade to a newer version of hairtrigger, it needs a way of
202
+ far). If you upgrade to a newer version of HairTrigger, it needs a way of
203
203
  knowing which previous version generated the original trigger. You only need
204
204
  to worry about this for manual trigger migrations, as the model ones
205
205
  automatically take care of this. For your manual triggers you can either:
206
206
 
207
207
  * pass `:compatibility => x` to your `create_trigger` statement, where x is
208
- whatever HairTrigger::Builder.compatiblity is (1 for this version).
208
+ whatever HairTrigger::Builder.compatibility is (1 for this version).
209
209
  * set `HairTrigger::Builder.base_compatibility = x` in an initializer, where
210
- x is whatever HairTrigger::Builder.compatiblity is. This is like doing the
210
+ x is whatever HairTrigger::Builder.compatibility is. This is like doing the
211
211
  first option on every `create_trigger`. Note that once the compatibility
212
212
  changes, you'll need to set `:compatibility` on new triggers (unless you
213
213
  just redo all your triggers and bump the `base_compatibility`).
214
214
 
215
- If you upgrade to a newer version of hairtrigger and see that the SQL
215
+ If you upgrade to a newer version of HairTrigger and see that the SQL
216
216
  compatibility has changed, you'll need to set the appropriate compatibility
217
217
  on any new triggers that you create.
218
218
 
@@ -231,7 +231,7 @@ make it trigger-aware. A newly generated schema.rb will contain:
231
231
  As long as you don't delete old migrations and schema.rb prior to running
232
232
  `rake db:schema:dump`, the result should be what you expect (and portable).
233
233
  If you have deleted all trigger migrations, you can regenerate a new
234
- baseline for model triggers via rake db:generate_trigger_migration.
234
+ baseline for model triggers via `rake db:generate_trigger_migration`.
235
235
 
236
236
  ## Testing
237
237
 
@@ -262,7 +262,7 @@ when you attempt to run the migration.
262
262
 
263
263
  Generation warnings are similar but they don't stop the trigger from being
264
264
  generated. If you do something adapter-specific supported by your database,
265
- you will still get a warning ($stderr) that your trigger is not portable. You
265
+ you will still get a warning (to $stderr) that your trigger is not portable. You
266
266
  can silence warnings via `HairTrigger::Builder.show_warnings = false`
267
267
 
268
268
  You can validate your triggers beforehand using the `Builder#validate!` method.
@@ -294,7 +294,7 @@ existing trigger if you wish to redefine it.
294
294
 
295
295
  ## Gotchas
296
296
 
297
- * As is the case with ActiveRecord::Base.update_all or any direct SQL you do,
297
+ * As is the case with `ActiveRecord::Base.update_all` or any direct SQL you do,
298
298
  be careful to reload updated objects from the database. For example, the
299
299
  following code will display the wrong count since we aren't reloading the
300
300
  account:
@@ -1,5 +1,5 @@
1
1
  module HairTrigger
2
- VERSION = "0.2.17"
2
+ VERSION = "0.2.18"
3
3
 
4
4
  def VERSION.<=>(other)
5
5
  split(/\./).map(&:to_i) <=> other.split(/\./).map(&:to_i)
@@ -48,12 +48,12 @@ describe "adapter" do
48
48
  context "mysql" do
49
49
  let(:adapter) { :mysql }
50
50
  it_behaves_like "mysql"
51
- end
51
+ end if ADAPTERS.include? :mysql
52
52
 
53
53
  context "mysql2" do
54
54
  let(:adapter) { :mysql2 }
55
55
  it_behaves_like "mysql"
56
- end
56
+ end if ADAPTERS.include? :mysql2
57
57
 
58
58
  context "postgresql" do
59
59
  let(:adapter) { :postgresql }
@@ -5,11 +5,13 @@ require 'hair_trigger'
5
5
  require 'yaml'
6
6
 
7
7
  CONFIGS = YAML.load_file(File.expand_path(File.dirname(__FILE__) + '/../database.yml'))[ENV["DB_CONFIG"] || "test"]
8
- ADAPTERS = [:mysql, :mysql2, :postgresql, :sqlite3]
8
+ ADAPTERS = [:mysql2, :postgresql, :sqlite3]
9
+ ADAPTERS.unshift :mysql if ActiveRecord::VERSION::STRING < "5"
9
10
 
10
11
  def each_adapter
11
12
  require 'active_record/connection_adapters/postgresql_adapter'
12
- require 'active_record/connection_adapters/mysql_adapter'
13
+ require 'active_record/connection_adapters/mysql_adapter' if ADAPTERS.include? :mysql
14
+ require 'active_record/connection_adapters/mysql2_adapter'
13
15
  require 'active_record/connection_adapters/sqlite3_adapter'
14
16
  require 'mysql2'
15
17
 
@@ -54,7 +56,7 @@ shared_context "hairtrigger utils" do
54
56
  end
55
57
  # Arel has an issue in that it keeps using original connection for quoting,
56
58
  # etc. (which breaks stuff) unless you do this:
57
- Arel::Visitors::ENGINE_VISITORS.delete(ActiveRecord::Base) if defined?(Arel)
59
+ Arel::Visitors::ENGINE_VISITORS.delete(ActiveRecord::Base) if defined?(Arel::Visitors::ENGINE_VISITORS)
58
60
  ActiveRecord::Base.establish_connection(config)
59
61
  ActiveRecord::Base.logger = Logger.new('/dev/null')
60
62
  ActiveRecord::SchemaDumper.previous_schema = nil
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hairtrigger
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.17
4
+ version: 0.2.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Jensen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-16 00:00:00.000000000 Z
11
+ date: 2017-02-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -30,28 +30,28 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '3.7'
33
+ version: '3.8'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '3.7'
40
+ version: '3.8'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: ruby2ruby
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '2.0'
47
+ version: '2.3'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '2.0'
54
+ version: '2.3'
55
55
  description: allows you to declare database triggers in ruby in your models, and then
56
56
  generate appropriate migrations as they change
57
57
  email: jenseng@gmail.com
@@ -106,9 +106,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
106
  version: 1.3.5
107
107
  requirements: []
108
108
  rubyforge_project:
109
- rubygems_version: 2.2.5
109
+ rubygems_version: 2.5.1
110
110
  signing_key:
111
111
  specification_version: 4
112
112
  summary: easy database triggers for active record
113
113
  test_files: []
114
- has_rdoc: