postgresql-check 0.0.3 → 0.1.0

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: 5319290d191e9e7d1a0324731ec42fc30804e242
4
- data.tar.gz: 0c8a634a1f57a2073a9b9faebe754a9ef5fd3b3b
3
+ metadata.gz: f1048872dde6eb9e2fe0bdbce34da53c019ecc62
4
+ data.tar.gz: 223f215b01978b726f72d21146cb3c5dcca3ccb8
5
5
  SHA512:
6
- metadata.gz: 9d48891a18596c896cd9527eedc6897508917fbeca7a97a7554630e6471d9a05e5a2666d9f02493bb1e195ed834ab62465780eafad1e9f811c0f757264f391ab
7
- data.tar.gz: e7c412693d21a9a104ece22bb7123e911a273ada58dd4df5fd30dd88ed6bb01b2667519bc31323e691809f8c3d90396de6e4f406c510cc3a1a9be9d7bcd30e7b
6
+ metadata.gz: e09208d765f0717700ca88e88da3d3b5ea17c477e511fccd053ecaecd0d0d77e60c30130c4e3e0f8efe8c173e6d8d518f47a1d94ed8c128b6fa44a133dd679e2
7
+ data.tar.gz: dce6d419be2203db356b60ae728378c868ecd9eaac878a493fef165645ec25360073c6bc2ebf9b01ad2e0f002ef3868fca2d67c0aa33df497db4604db5950ccc
data/README.md CHANGED
@@ -45,7 +45,7 @@ end
45
45
  You can add a check constraint in your migration:
46
46
 
47
47
  ```ruby
48
- add_check :products, 'price > 0', :name => 'price_check'
48
+ add_check :products, 'price > 0', :name => 'products_price_check'
49
49
  ```
50
50
 
51
51
  The code above generates following SQL:
@@ -54,13 +54,12 @@ The code above generates following SQL:
54
54
  ALTER TABLE "products" ADD CONSTRAINT "products_price_check" (price > 0)
55
55
  ```
56
56
 
57
- **NOTE**: `:name` option is mandatory now. Also note that table name auto-included
58
- to constraint name.
57
+ **NOTE**: `:name` option is mandatory now.
59
58
 
60
59
  To remove constraint use `remove_check` method:
61
60
 
62
61
  ```ruby
63
- remove_check :products, :name => 'price_check'
62
+ remove_check :products, :name => 'products_price_check'
64
63
  ```
65
64
 
66
65
  ## Change Table methods
@@ -70,7 +69,7 @@ This gem adds extra methods to `create_table` and `change_table`:
70
69
  ```ruby
71
70
  create_table :products do |t|
72
71
  t.decimal :price, :null => false
73
- t.check 'price > 0', :name => 'price_check'
72
+ t.check 'price > 0', :name => 'products_price_check'
74
73
  end
75
74
  ```
76
75
 
@@ -78,7 +77,7 @@ Remove a check constraint:
78
77
 
79
78
  ```ruby
80
79
  change_table :products do |t|
81
- t.remove_check :name => 'price_check'
80
+ t.remove_check :name => 'products_price_check'
82
81
  end
83
82
  ```
84
83
 
@@ -27,7 +27,7 @@ module Postgresql
27
27
  name = options.fetch(:name) { raise 'add_check, :name option required' }
28
28
 
29
29
  sql = "ALTER TABLE #{quote_table_name(table_name)} " +
30
- "ADD CONSTRAINT #{quote_column_name("#{table_name}_#{name}")} " +
30
+ "ADD CONSTRAINT #{quote_column_name(name)} " +
31
31
  "CHECK (#{condition})"
32
32
 
33
33
  execute(sql)
@@ -49,7 +49,7 @@ module Postgresql
49
49
  name = options.fetch(:name) { raise 'remove_check, :name option required' }
50
50
 
51
51
  sql = "ALTER TABLE #{quote_table_name(table_name)} " +
52
- "DROP CONSTRAINT #{quote_column_name("#{table_name}_#{name}")}"
52
+ "DROP CONSTRAINT #{quote_column_name(name)}"
53
53
 
54
54
  execute(sql)
55
55
  end
@@ -1,5 +1,5 @@
1
1
  module Postgresql
2
2
  module Check
3
- VERSION = '0.0.3'
3
+ VERSION = '0.1.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: postgresql-check
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexei Mikhailov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-26 00:00:00.000000000 Z
11
+ date: 2015-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -94,9 +94,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
94
  version: '0'
95
95
  requirements: []
96
96
  rubyforge_project:
97
- rubygems_version: 2.2.2
97
+ rubygems_version: 2.4.3
98
98
  signing_key:
99
99
  specification_version: 4
100
100
  summary: Adds helpers to migrations and dumps check constraints to schema.rb
101
101
  test_files: []
102
- has_rdoc: