activerecord-postgresql-extensions 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c65ffc95f16b554687be6eb67df6ddffc03c6283
4
+ data.tar.gz: 658228acaf0587e77eefc4d67eb31c4138bc65b2
5
+ SHA512:
6
+ metadata.gz: 1c235b23d95dee1557b29fb8b7c10ab930284434f89b0d43fc742b7994460b7874d1e1eb4b58ce39efdf0504578e797e22c0b25eacf1f122743d470992720c74
7
+ data.tar.gz: 0405416cfeb48626e6f26580649858938fcd3636c5853e43385f3d28b08220d18508d546e170739835fd781abfdd0f37bf68ccd5dfcc56c54a24363b25bde53b
data/Gemfile CHANGED
@@ -15,11 +15,6 @@ gem "minitest-reporters"
15
15
  gem "guard-minitest"
16
16
  gem "simplecov"
17
17
 
18
- if RbConfig::CONFIG['host_os'] =~ /^darwin/
19
- gem "rb-fsevent"
20
- gem "growl"
21
- end
22
-
23
18
  if File.exists?('Gemfile.local')
24
19
  instance_eval File.read('Gemfile.local')
25
20
  end
@@ -499,7 +499,12 @@ module ActiveRecord
499
499
  quoted_table_name = quote_table_name(table)
500
500
  triggers = if triggers.present?
501
501
  triggers.collect { |trigger|
502
- quote_generic(trigger)
502
+ case trigger
503
+ when :all, :user
504
+ trigger.to_s.upcase
505
+ else
506
+ quote_generic(trigger)
507
+ end
503
508
  }
504
509
  else
505
510
  'ALL'
@@ -511,12 +516,19 @@ module ActiveRecord
511
516
  end
512
517
 
513
518
  # Disable triggers. If no triggers are specified, all triggers will
514
- # be disabled.
519
+ # be disabled. You can specify <tt>ALL</tt> or <tt>USER</tt> triggers
520
+ # by using the symbols <tt>:all</tt> or <tt>:user</tt>. If you have
521
+ # actual triggers named "all" or "user", use Strings instead of Symbols.
515
522
  def disable_triggers(table, *triggers)
516
523
  quoted_table_name = quote_table_name(table)
517
524
  triggers = if triggers.present?
518
525
  triggers.collect { |trigger|
519
- quote_generic(trigger)
526
+ case trigger
527
+ when :all, :user
528
+ trigger.to_s.upcase
529
+ else
530
+ quote_generic(trigger)
531
+ end
520
532
  }
521
533
  else
522
534
  'ALL'
@@ -528,7 +540,10 @@ module ActiveRecord
528
540
  end
529
541
 
530
542
  # Temporarily disable triggers. If no triggers are specified, all
531
- # triggers will be disabled.
543
+ # triggers will be disabled. You can specify <tt>ALL</tt> or
544
+ # <tt>USER</tt> triggers by using the symbols <tt>:all</tt> or
545
+ # <tt>:user</tt>. If you have actual triggers named "all" or "user", use
546
+ # Strings instead of Symbols.
532
547
  def without_triggers(table, *triggers)
533
548
  disable_triggers(table, *triggers)
534
549
  yield
@@ -17,19 +17,26 @@ module ActiveRecord
17
17
  class Base
18
18
  class << self
19
19
  # Enable triggers. If no triggers are specified, all triggers will
20
- # be enabled.
20
+ # be enabled. You can specify <tt>ALL</tt> or <tt>USER</tt> triggers
21
+ # by using the symbols <tt>:all</tt> or <tt>:user</tt>. If you have
22
+ # actual triggers named "all" or "user", use Strings instead of Symbols.
21
23
  def enable_triggers(*triggers)
22
24
  self.connection.enable_triggers(self.table_name, *triggers)
23
25
  end
24
26
 
25
27
  # Disable triggers. If no triggers are specified, all triggers will
26
- # be disabled.
28
+ # be disabled. You can specify <tt>ALL</tt> or <tt>USER</tt> triggers
29
+ # by using the symbols <tt>:all</tt> or <tt>:user</tt>. If you have
30
+ # actual triggers named "all" or "user", use Strings instead of Symbols.
27
31
  def disable_triggers(*triggers)
28
32
  self.connection.disable_triggers(self.table_name, *triggers)
29
33
  end
30
34
 
31
35
  # Temporarily disable triggers. If no triggers are specified, all
32
- # triggers will be disabled.
36
+ # triggers will be disabled. You can specify <tt>ALL</tt> or
37
+ # <tt>USER</tt> triggers by using the symbols <tt>:all</tt> or
38
+ # <tt>:user</tt>. If you have actual triggers named "all" or "user",
39
+ # use Strings instead of Symbols.
33
40
  def without_triggers(*triggers)
34
41
  self.connection.without_triggers(self.table_name, *triggers) do
35
42
  yield
@@ -1,7 +1,7 @@
1
1
 
2
2
  module ActiveRecord
3
3
  module PostgreSQLExtensions
4
- VERSION = "0.6.0"
4
+ VERSION = "0.7.0"
5
5
  end
6
6
  end
7
7
 
@@ -82,11 +82,19 @@ class AdapterExtensionTests < PostgreSQLExtensionsTestCase
82
82
 
83
83
  def test_enable_triggers
84
84
  ARBC.enable_triggers(:foo)
85
+ ARBC.enable_triggers(:foo, :all)
86
+ ARBC.enable_triggers(:foo, "all")
87
+ ARBC.enable_triggers(:foo, :user)
88
+ ARBC.enable_triggers(:foo, "user")
85
89
  ARBC.enable_triggers(:foo, :bar)
86
90
  ARBC.enable_triggers(:foo, :bar, :baz)
87
91
 
88
92
  assert_equal([
89
93
  %{ALTER TABLE "foo" ENABLE TRIGGER ALL;},
94
+ %{ALTER TABLE "foo" ENABLE TRIGGER ALL;},
95
+ %{ALTER TABLE "foo" ENABLE TRIGGER "all";},
96
+ %{ALTER TABLE "foo" ENABLE TRIGGER USER;},
97
+ %{ALTER TABLE "foo" ENABLE TRIGGER "user";},
90
98
  %{ALTER TABLE "foo" ENABLE TRIGGER "bar";},
91
99
  %{ALTER TABLE "foo" ENABLE TRIGGER "bar";},
92
100
  %{ALTER TABLE "foo" ENABLE TRIGGER "baz";}
@@ -95,11 +103,19 @@ class AdapterExtensionTests < PostgreSQLExtensionsTestCase
95
103
 
96
104
  def test_disable_triggers
97
105
  ARBC.disable_triggers(:foo)
106
+ ARBC.disable_triggers(:foo, :all)
107
+ ARBC.disable_triggers(:foo, "all")
108
+ ARBC.disable_triggers(:foo, :user)
109
+ ARBC.disable_triggers(:foo, "user")
98
110
  ARBC.disable_triggers(:foo, :bar)
99
111
  ARBC.disable_triggers(:foo, :bar, :baz)
100
112
 
101
113
  assert_equal([
102
114
  %{ALTER TABLE "foo" DISABLE TRIGGER ALL;},
115
+ %{ALTER TABLE "foo" DISABLE TRIGGER ALL;},
116
+ %{ALTER TABLE "foo" DISABLE TRIGGER "all";},
117
+ %{ALTER TABLE "foo" DISABLE TRIGGER USER;},
118
+ %{ALTER TABLE "foo" DISABLE TRIGGER "user";},
103
119
  %{ALTER TABLE "foo" DISABLE TRIGGER "bar";},
104
120
  %{ALTER TABLE "foo" DISABLE TRIGGER "bar";},
105
121
  %{ALTER TABLE "foo" DISABLE TRIGGER "baz";}
@@ -5,11 +5,19 @@ require 'test_helper'
5
5
  class TriggerTests < PostgreSQLExtensionsTestCase
6
6
  def test_enable_triggers
7
7
  Foo.enable_triggers
8
+ Foo.enable_triggers(:all)
9
+ Foo.enable_triggers("all")
10
+ Foo.enable_triggers(:user)
11
+ Foo.enable_triggers("user")
8
12
  Foo.enable_triggers(:bar)
9
13
  Foo.enable_triggers(:bar, :baz)
10
14
 
11
15
  assert_equal([
12
16
  %{ALTER TABLE "foos" ENABLE TRIGGER ALL;},
17
+ %{ALTER TABLE "foos" ENABLE TRIGGER ALL;},
18
+ %{ALTER TABLE "foos" ENABLE TRIGGER "all";},
19
+ %{ALTER TABLE "foos" ENABLE TRIGGER USER;},
20
+ %{ALTER TABLE "foos" ENABLE TRIGGER "user";},
13
21
  %{ALTER TABLE "foos" ENABLE TRIGGER "bar";},
14
22
  %{ALTER TABLE "foos" ENABLE TRIGGER "bar";},
15
23
  %{ALTER TABLE "foos" ENABLE TRIGGER "baz";}
@@ -18,11 +26,19 @@ class TriggerTests < PostgreSQLExtensionsTestCase
18
26
 
19
27
  def test_disable_triggers
20
28
  Foo.disable_triggers
29
+ Foo.disable_triggers(:all)
30
+ Foo.disable_triggers("all")
31
+ Foo.disable_triggers(:user)
32
+ Foo.disable_triggers("user")
21
33
  Foo.disable_triggers(:bar)
22
34
  Foo.disable_triggers(:bar, :baz)
23
35
 
24
36
  assert_equal([
25
37
  %{ALTER TABLE "foos" DISABLE TRIGGER ALL;},
38
+ %{ALTER TABLE "foos" DISABLE TRIGGER ALL;},
39
+ %{ALTER TABLE "foos" DISABLE TRIGGER "all";},
40
+ %{ALTER TABLE "foos" DISABLE TRIGGER USER;},
41
+ %{ALTER TABLE "foos" DISABLE TRIGGER "user";},
26
42
  %{ALTER TABLE "foos" DISABLE TRIGGER "bar";},
27
43
  %{ALTER TABLE "foos" DISABLE TRIGGER "bar";},
28
44
  %{ALTER TABLE "foos" DISABLE TRIGGER "baz";}
metadata CHANGED
@@ -1,32 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-postgresql-extensions
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.6.0
4
+ version: 0.7.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - J Smith
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-12-02 00:00:00.000000000 Z
11
+ date: 2014-02-06 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: activerecord
16
- type: :runtime
17
15
  requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
- - - ! '>='
17
+ - - ">="
20
18
  - !ruby/object:Gem::Version
21
19
  version: '2.3'
22
- none: false
20
+ type: :runtime
21
+ prerelease: false
23
22
  version_requirements: !ruby/object:Gem::Requirement
24
23
  requirements:
25
- - - ! '>='
24
+ - - ">="
26
25
  - !ruby/object:Gem::Version
27
26
  version: '2.3'
28
- none: false
29
- prerelease: false
30
27
  description: A whole bunch of extensions the ActiveRecord PostgreSQL adapter.
31
28
  email: code@zoocasa.com
32
29
  executables: []
@@ -34,7 +31,7 @@ extensions: []
34
31
  extra_rdoc_files:
35
32
  - README.rdoc
36
33
  files:
37
- - .gitignore
34
+ - ".gitignore"
38
35
  - Gemfile
39
36
  - Guardfile
40
37
  - MIT-LICENSE
@@ -94,30 +91,26 @@ files:
94
91
  homepage: http://github.com/zoocasa/activerecord-postgresql-extensions
95
92
  licenses:
96
93
  - MIT
94
+ metadata: {}
97
95
  post_install_message:
98
96
  rdoc_options: []
99
97
  require_paths:
100
98
  - lib
101
99
  required_ruby_version: !ruby/object:Gem::Requirement
102
100
  requirements:
103
- - - ! '>='
101
+ - - ">="
104
102
  - !ruby/object:Gem::Version
105
- segments:
106
- - 0
107
- hash: -2185802577024505074
108
103
  version: '0'
109
- none: false
110
104
  required_rubygems_version: !ruby/object:Gem::Requirement
111
105
  requirements:
112
- - - ! '>='
106
+ - - ">="
113
107
  - !ruby/object:Gem::Version
114
108
  version: '0'
115
- none: false
116
109
  requirements: []
117
110
  rubyforge_project:
118
- rubygems_version: 1.8.23
111
+ rubygems_version: 2.2.1
119
112
  signing_key:
120
- specification_version: 3
113
+ specification_version: 4
121
114
  summary: A whole bunch of extensions the ActiveRecord PostgreSQL adapter.
122
115
  test_files:
123
116
  - test/adapter_extensions_tests.rb