mv-postgresql 2.2.1 → 2.2.2

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +105 -101
  3. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1dae27a076117fbd0f2a4224aa2accb38a902892
4
- data.tar.gz: de145b1c952af7af05c699583264c25f985f38b3
3
+ metadata.gz: dddbb36594274980cdfc7cb8b31a4e59ff652812
4
+ data.tar.gz: e9f56e60870f385f7167ff34cccf5666720a0a37
5
5
  SHA512:
6
- metadata.gz: 30266266f840ccb210b14499e49df7272161269104ea08c7789872623e729fe7b65536a43aa2936e09fd1fd2b8b077354e79e0208025672f1458691d7b6f33c5
7
- data.tar.gz: 3f759049be0c68d21630e3ca137c50ac4f23418cbc595892b1290616e1cb8cb209d5087e040ee0fb6af0e38c733a1e1da3561debde05365ba0713495ec90b1a5
6
+ metadata.gz: 96f1fc27a54382317b2475706d12c619d2b8d6041091f9b678140504114eb172f69477bcddebe1c15b57286acc54ec9ef00f24535189dc7528ec8fc7f8bbed9a
7
+ data.tar.gz: 8340d608c5283a80996c25528da9dd94495f78bba5220f1858a19ca151c8fb5fc2f356da636f5b7aae96d7a5f1e197ef81a7db9d1555c7a48ae648699d259b50
data/README.md CHANGED
@@ -2,9 +2,9 @@
2
2
  [![Coverage Status](https://coveralls.io/repos/vprokopchuk256/mv-postgresql/badge.png?branch=master)](https://coveralls.io/r/vprokopchuk256/mv-postgresql?branch=master)
3
3
  [![Gem Version](https://badge.fury.io/rb/mv-postgresql.svg)](http://badge.fury.io/rb/mv-postgresql)
4
4
 
5
- # `Migration Validators` project. PostgreSQL driver.
5
+ # `Migration Validators` project. PostgreSQL driver.
6
6
 
7
- Define validations directly in DB as PostgreSQL constraints and integrate them into your model transparently. See [mv-core](https://github.com/vprokopchuk256/mv-core) for details. There you will be able to review high level project information. Below you can see details of the migration validations that are supported by PostgreSQL driver.
7
+ Define validations directly in DB as PostgreSQL constraints and integrate them into your model transparently. See [mv-core](https://github.com/vprokopchuk256/mv-core) for details. There you will be able to review high level project information. Below you can see details of the migration validations that are supported by PostgreSQL driver.
8
8
 
9
9
  #Table Of Contents
10
10
  * [Validations](#validations)
@@ -23,10 +23,10 @@ Define validations directly in DB as PostgreSQL constraints and integrate them i
23
23
 
24
24
  ### uniqueness
25
25
 
26
- Examples:
26
+ Examples:
27
27
 
28
28
  validate uniqueness of the column `column_name`:
29
-
29
+
30
30
  ```ruby
31
31
  def up
32
32
  validates :table_name, :column_name, uniqueness: true
@@ -37,11 +37,11 @@ Define validations directly in DB as PostgreSQL constraints and integrate them i
37
37
  end
38
38
  ```
39
39
 
40
- define validation as trigger with specified failure message:
40
+ define validation as trigger with specified failure message:
41
41
 
42
42
  ```ruby
43
43
  def up
44
- validates :table_name, :column_name,
44
+ validates :table_name, :column_name,
45
45
  uniqueness: { message: 'Error message', as: :trigger }
46
46
  end
47
47
 
@@ -50,7 +50,7 @@ Define validations directly in DB as PostgreSQL constraints and integrate them i
50
50
  end
51
51
  ```
52
52
 
53
- define validation as unique index:
53
+ define validation as unique index:
54
54
 
55
55
  ```ruby
56
56
  def up
@@ -62,7 +62,7 @@ Define validations directly in DB as PostgreSQL constraints and integrate them i
62
62
  end
63
63
  ```
64
64
 
65
- all above are available in a create and change table blocks:
65
+ all above are available in a create and change table blocks:
66
66
 
67
67
  ```ruby
68
68
  def change
@@ -96,7 +96,7 @@ Define validations directly in DB as PostgreSQL constraints and integrate them i
96
96
  end
97
97
  ```
98
98
 
99
- Options:
99
+ Options:
100
100
 
101
101
  * `:message` - text of the error message that will be shown if constraint violated. Ignored unless `:as == :trigger`
102
102
  * `:index_name` - name of the index that will be created for validator. Ignored unless `:as == :index`
@@ -109,11 +109,11 @@ Define validations directly in DB as PostgreSQL constraints and integrate them i
109
109
 
110
110
  ### length
111
111
 
112
- Examples:
112
+ Examples:
113
113
 
114
114
  ```ruby
115
115
  def up
116
- validates :table_name, :column_name,
116
+ validates :table_name, :column_name,
117
117
  length: { in: 5..8, message: 'Wrong length message'}
118
118
  end
119
119
 
@@ -126,7 +126,7 @@ allow `NULL`:
126
126
 
127
127
  ```ruby
128
128
  def up
129
- validates :table_name, :column_name,
129
+ validates :table_name, :column_name,
130
130
  length: { is: 3, allow_nil: true}
131
131
  end
132
132
 
@@ -135,14 +135,14 @@ allow `NULL`:
135
135
  end
136
136
  ```
137
137
 
138
- allow blank values:
138
+ allow blank values:
139
139
 
140
140
  ```ruby
141
141
  def up
142
- validates :table_name, :column_name,
143
- length: { maximum: 3,
144
- allow_blank: true,
145
- too_long: 'Value is longer than 3 symbols' }
142
+ validates :table_name, :column_name,
143
+ length: { maximum: 3,
144
+ allow_blank: true,
145
+ too_long: 'Value is longer than 3 symbols' }
146
146
  end
147
147
 
148
148
  def down
@@ -150,14 +150,14 @@ allow `NULL`:
150
150
  end
151
151
  ```
152
152
 
153
- define constraint in trigger:
153
+ define constraint in trigger:
154
154
 
155
155
  ```ruby
156
156
  def up
157
- validates :table_name, :column_name,
158
- length: { maximum: 3,
159
- as: :trigger,
160
- too_long: 'Value is longer than 3 symbols' }
157
+ validates :table_name, :column_name,
158
+ length: { maximum: 3,
159
+ as: :trigger,
160
+ too_long: 'Value is longer than 3 symbols' }
161
161
  end
162
162
 
163
163
  def down
@@ -165,7 +165,7 @@ allow `NULL`:
165
165
  end
166
166
  ```
167
167
 
168
- all above are available in a create and change table blocks:
168
+ all above are available in a create and change table blocks:
169
169
 
170
170
  ```ruby
171
171
  def change
@@ -222,9 +222,9 @@ allow `NULL`:
222
222
 
223
223
  ### inclusion
224
224
 
225
- Examples:
225
+ Examples:
226
226
 
227
- valid values array:
227
+ valid values array:
228
228
 
229
229
  ```ruby
230
230
  def up
@@ -236,12 +236,12 @@ allow `NULL`:
236
236
  end
237
237
  ```
238
238
 
239
- with failure message specified:
239
+ with failure message specified:
240
240
 
241
241
  ```ruby
242
242
  def up
243
- validates :table_name, :column_name,
244
- inclusion: { in: [1, 2, 3],
243
+ validates :table_name, :column_name,
244
+ inclusion: { in: [1, 2, 3],
245
245
  message: "Column value should be equal to 1 or 2 or 3" }
246
246
  end
247
247
 
@@ -254,7 +254,7 @@ allow `NULL`:
254
254
 
255
255
  ```ruby
256
256
  def up
257
- validates :table_name, :column_name,
257
+ validates :table_name, :column_name,
258
258
  inclusion: { in: [1, 2, 3], as: :check }
259
259
  end
260
260
 
@@ -263,13 +263,13 @@ allow `NULL`:
263
263
  end
264
264
  ```
265
265
 
266
- make it in trigger:
266
+ make it in trigger:
267
267
 
268
268
  ```ruby
269
269
  def up
270
- validates :table_name, :column_name,
271
- inclusion: { in: 1..3,
272
- on: :create,
270
+ validates :table_name, :column_name,
271
+ inclusion: { in: 1..3,
272
+ on: :create,
273
273
  as: :trigger }
274
274
  end
275
275
 
@@ -278,7 +278,7 @@ allow `NULL`:
278
278
  end
279
279
  ```
280
280
 
281
- all above are available in a create and change table blocks:
281
+ all above are available in a create and change table blocks:
282
282
 
283
283
  ```ruby
284
284
  def change
@@ -309,7 +309,7 @@ allow `NULL`:
309
309
  create_table :table_name do |t|
310
310
  t.string :str_or_str_1, inclusion: ['str', 'str1']
311
311
  t.string :from_str_to_str_1, inclusion: 'str'..'str1'
312
- t.string :str_or_str_1_in_trigger, inclusion: { in: ['str', 'str1'],
312
+ t.string :str_or_str_1_in_trigger, inclusion: { in: ['str', 'str1'],
313
313
  as: :trigger}
314
314
  end
315
315
  end
@@ -326,14 +326,14 @@ allow `NULL`:
326
326
  * `allow_blank` - ignore validation for blank values. Default value: `false`
327
327
  * `as` - defines the way how constraint will be implemented. Possible values: `[:trigger, :check]` Default value: `:check`
328
328
 
329
-
329
+
330
330
  ### exclusion
331
331
 
332
332
  Examples:
333
333
 
334
- exclude 1, 2, and 3:
335
-
336
- within `create_table` statement:
334
+ exclude 1, 2, and 3:
335
+
336
+ within `create_table` statement:
337
337
 
338
338
  ```ruby
339
339
  def change
@@ -343,7 +343,7 @@ allow `NULL`:
343
343
  end
344
344
  ```
345
345
 
346
- or as standalone statements:
346
+ or as standalone statements:
347
347
 
348
348
  ```ruby
349
349
  def up
@@ -355,13 +355,13 @@ allow `NULL`:
355
355
  end
356
356
  ```
357
357
 
358
- the same with failure message:
358
+ the same with failure message:
359
359
 
360
360
  ```ruby
361
361
  def up
362
- validates :table_name, :column_name,
362
+ validates :table_name, :column_name,
363
363
  exclusion: {
364
- in: [1, 2, 3],
364
+ in: [1, 2, 3],
365
365
  message: "Column 'column_name' should not be equal to 1 or 2 or 3" }
366
366
  end
367
367
 
@@ -370,11 +370,11 @@ allow `NULL`:
370
370
  end
371
371
  ```
372
372
 
373
- as check constraint:
373
+ as check constraint:
374
374
 
375
375
  ```ruby
376
376
  def up
377
- validates :table_name, :column_name,
377
+ validates :table_name, :column_name,
378
378
  exclusion: { in: [1, 2, 3], as: :check }
379
379
  end
380
380
 
@@ -383,13 +383,13 @@ allow `NULL`:
383
383
  end
384
384
  ```
385
385
 
386
- as trigger:
386
+ as trigger:
387
387
 
388
388
  ```ruby
389
389
  def up
390
- validates :table_name, :column_name,
391
- exclusion: { in: 1..3,
392
- on: :create,
390
+ validates :table_name, :column_name,
391
+ exclusion: { in: 1..3,
392
+ on: :create,
393
393
  as: :trigger }
394
394
  end
395
395
 
@@ -398,7 +398,7 @@ allow `NULL`:
398
398
  end
399
399
  ```
400
400
 
401
- all above are available in a create and change table blocks:
401
+ all above are available in a create and change table blocks:
402
402
 
403
403
  ```ruby
404
404
  def change
@@ -429,7 +429,7 @@ allow `NULL`:
429
429
  create_table :table_name do |t|
430
430
  t.string :neither_str_nor_str_1, exclusion: ['str', 'str1']
431
431
  t.string :from_str_to_str_1, exclusion: 'str'..'str1'
432
- t.string :str_or_str_1_in_trigger, exclusion: { in: ['str', 'str1'],
432
+ t.string :str_or_str_1_in_trigger, exclusion: { in: ['str', 'str1'],
433
433
  as: :trigger}
434
434
  end
435
435
  end
@@ -448,7 +448,7 @@ allow `NULL`:
448
448
 
449
449
  ### presence
450
450
 
451
- Examples:
451
+ Examples:
452
452
 
453
453
  ```ruby
454
454
  def up
@@ -460,11 +460,11 @@ allow `NULL`:
460
460
  end
461
461
  ```
462
462
 
463
- with failure message:
463
+ with failure message:
464
464
 
465
465
  ```ruby
466
466
  def up
467
- validates :table_name, :column_name,
467
+ validates :table_name, :column_name,
468
468
  presence: { message: 'value should not be empty' }
469
469
  end
470
470
 
@@ -473,12 +473,12 @@ allow `NULL`:
473
473
  end
474
474
  ```
475
475
 
476
- implemented as trigger:
476
+ implemented as trigger:
477
477
 
478
478
  ```ruby
479
479
  def up
480
- validates :table_name, :column_name,
481
- presence: { message: 'value should not be empty',
480
+ validates :table_name, :column_name,
481
+ presence: { message: 'value should not be empty',
482
482
  as: :trigger }
483
483
  end
484
484
 
@@ -487,13 +487,13 @@ allow `NULL`:
487
487
  end
488
488
  ```
489
489
 
490
- check when record is inserted only:
490
+ check when record is inserted only:
491
491
 
492
492
  ```ruby
493
493
  def up
494
- validates :table_name, :column_name,
495
- presence: { message: 'value should not be empty',
496
- as: :trigger,
494
+ validates :table_name, :column_name,
495
+ presence: { message: 'value should not be empty',
496
+ as: :trigger,
497
497
  on: :create }
498
498
  end
499
499
 
@@ -502,7 +502,7 @@ allow `NULL`:
502
502
  end
503
503
  ```
504
504
 
505
- all above are available in a create and change table blocks:
505
+ all above are available in a create and change table blocks:
506
506
 
507
507
  ```ruby
508
508
  def change
@@ -547,7 +547,7 @@ allow `NULL`:
547
547
 
548
548
  ### absence
549
549
 
550
- Examples:
550
+ Examples:
551
551
 
552
552
  ```ruby
553
553
  def up
@@ -559,11 +559,11 @@ allow `NULL`:
559
559
  end
560
560
  ```
561
561
 
562
- with failure message:
562
+ with failure message:
563
563
 
564
564
  ```ruby
565
565
  def up
566
- validates :table_name, :column_name,
566
+ validates :table_name, :column_name,
567
567
  absence: { message: 'value should be empty' }
568
568
  end
569
569
 
@@ -572,12 +572,12 @@ allow `NULL`:
572
572
  end
573
573
  ```
574
574
 
575
- implemented as trigger:
575
+ implemented as trigger:
576
576
 
577
577
  ```ruby
578
578
  def up
579
- validates :table_name, :column_name,
580
- absence: { message: 'value should be empty',
579
+ validates :table_name, :column_name,
580
+ absence: { message: 'value should be empty',
581
581
  as: :trigger }
582
582
  end
583
583
 
@@ -586,13 +586,13 @@ allow `NULL`:
586
586
  end
587
587
  ```
588
588
 
589
- check when record is inserted only:
589
+ check when record is inserted only:
590
590
 
591
591
  ```ruby
592
592
  def up
593
- validates :table_name, :column_name,
594
- absence: { message: 'value should be empty',
595
- as: :trigger,
593
+ validates :table_name, :column_name,
594
+ absence: { message: 'value should be empty',
595
+ as: :trigger,
596
596
  on: :create }
597
597
  end
598
598
 
@@ -601,7 +601,7 @@ allow `NULL`:
601
601
  end
602
602
  ```
603
603
 
604
- all above are available in a create and change table blocks:
604
+ all above are available in a create and change table blocks:
605
605
 
606
606
  ```ruby
607
607
  def change
@@ -648,9 +648,9 @@ allow `NULL`:
648
648
 
649
649
  ### format
650
650
 
651
- Examples:
651
+ Examples:
652
652
 
653
- allows only values that contains 'word' inside:
653
+ allows only values that contains 'word' inside:
654
654
 
655
655
  ```ruby
656
656
  def up
@@ -662,12 +662,12 @@ allow `NULL`:
662
662
  end
663
663
  ```
664
664
 
665
- with failure message:
665
+ with failure message:
666
666
 
667
667
  ```ruby
668
668
  def up
669
- validates :table_name, :column_name,
670
- format: { with: /word/,
669
+ validates :table_name, :column_name,
670
+ format: { with: /word/,
671
671
  message: 'Column_name value should contain start word' }
672
672
  end
673
673
 
@@ -680,9 +680,9 @@ allow `NULL`:
680
680
 
681
681
  ```ruby
682
682
  def up
683
- validates :table_name, :column_name,
684
- format: { with: /word/,
685
- message: 'Column_name value should contain start word',
683
+ validates :table_name, :column_name,
684
+ format: { with: /word/,
685
+ message: 'Column_name value should contain start word',
686
686
  as: :trigger }
687
687
  end
688
688
 
@@ -691,7 +691,7 @@ allow `NULL`:
691
691
  end
692
692
  ```
693
693
 
694
- all above are available in a create and change table blocks:
694
+ all above are available in a create and change table blocks:
695
695
 
696
696
  ```ruby
697
697
  def change
@@ -720,8 +720,8 @@ allow `NULL`:
720
720
  ```ruby
721
721
  def change
722
722
  create_table :table_name do |t|
723
- t.string :contains_word, format: /word/
724
- t.string :contains_word_in_trigger, format: { with: /word/,
723
+ t.string :contains_word, format: /word/
724
+ t.string :contains_word_in_trigger, format: { with: /word/,
725
725
  as: :trigger }
726
726
  end
727
727
  end
@@ -738,17 +738,17 @@ allow `NULL`:
738
738
  * `allow_blank` - ignore validation for blank values. Default value: `false`
739
739
  * `as` - defines the way how constraint will be implemented. Possible values: `[:trigger, :check]` Default value: `:check`
740
740
 
741
- ### custom
741
+ ### custom
742
742
 
743
743
  (version >= 2.1 is required)
744
744
 
745
- Examples:
745
+ Examples:
746
746
 
747
- allows only values that contains 'word' inside:
747
+ allows only values that contains 'word' inside:
748
748
 
749
749
  ```ruby
750
750
  def up
751
- validates :table_name, :column_name,
751
+ validates :table_name, :column_name,
752
752
  custom: { statement: "TRIM({column_name}) ~ 'word'" }
753
753
  end
754
754
 
@@ -757,12 +757,12 @@ allow `NULL`:
757
757
  end
758
758
  ```
759
759
 
760
- with failure message:
760
+ with failure message:
761
761
 
762
762
  ```ruby
763
763
  def up
764
- validates :table_name, :column_name,
765
- custom: { statement: "TRIM({column_name}) ~ 'word'",
764
+ validates :table_name, :column_name,
765
+ custom: { statement: "TRIM({column_name}) ~ 'word'",
766
766
  message: 'Column_name value should contain start word' }
767
767
  end
768
768
 
@@ -775,9 +775,9 @@ allow `NULL`:
775
775
 
776
776
  ```ruby
777
777
  def up
778
- validates :table_name, :column_name,
779
- custom: { statement: "TRIM({column_name}) ~ 'word'",
780
- message: 'Column_name value should contain start word',
778
+ validates :table_name, :column_name,
779
+ custom: { statement: "TRIM({column_name}) ~ 'word'",
780
+ message: 'Column_name value should contain start word',
781
781
  as: :trigger }
782
782
  end
783
783
 
@@ -786,12 +786,12 @@ allow `NULL`:
786
786
  end
787
787
  ```
788
788
 
789
- all above are available in a create and change table blocks:
789
+ all above are available in a create and change table blocks:
790
790
 
791
791
  ```ruby
792
792
  def change
793
793
  create_table :table_name do |t|
794
- t.string :column_name,
794
+ t.string :column_name,
795
795
  validates: { custom: { statement: "TRIM({column_name}) ~ 'word'"} }
796
796
  end
797
797
  end
@@ -800,7 +800,7 @@ allow `NULL`:
800
800
  ```ruby
801
801
  def up
802
802
  change :table_name do |t|
803
- t.change :column_name, :string,
803
+ t.change :column_name, :string,
804
804
  validates: { custom: { statement: "TRIM({column_name}) ~ 'word'"} }
805
805
  end
806
806
  end
@@ -818,10 +818,10 @@ allow `NULL`:
818
818
  def change
819
819
  create_table :table_name do |t|
820
820
  t.string :contains_word, custom: "TRIM({contains_word}) ~ 'word'"
821
- t.string :contains_word_synonym,
821
+ t.string :contains_word_synonym,
822
822
  validates: "TRIM({contains_word_synonym}) ~ 'word'"
823
- t.string :contains_word_in_trigger,
824
- custom: { statement: "TRIM({contains_word_in_trigger}) ~ 'word'",
823
+ t.string :contains_word_in_trigger,
824
+ custom: { statement: "TRIM({contains_word_in_trigger}) ~ 'word'",
825
825
  as: :trigger }
826
826
  end
827
827
  end
@@ -846,7 +846,7 @@ allow `NULL`:
846
846
 
847
847
  **(2.1.0)** (22 Jan, 2015)
848
848
 
849
- * Custom validation
849
+ * Custom validation
850
850
 
851
851
  **(2.2.0)** (28 Jan, 2015)
852
852
 
@@ -856,6 +856,10 @@ allow `NULL`:
856
856
 
857
857
  * Made it possible to use several mv-* drivers in the same project
858
858
 
859
+ **(2.2.2)** (20 Jul, 2015)
860
+
861
+ * Fix issue with invalid parameters number in `add_column` and `change_column` methods
862
+
859
863
  ## Contributing
860
864
 
861
865
  * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mv-postgresql
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 2.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Valeriy Prokopchuk
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-29 00:00:00.000000000 Z
11
+ date: 2015-07-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - ~>
46
46
  - !ruby/object:Gem::Version
47
- version: '2.2'
47
+ version: 2.2.1
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.2'
54
+ version: 2.2.1
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: jeweler
57
57
  requirement: !ruby/object:Gem::Requirement