mv-mysql 2.2.2 → 2.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +83 -79
  3. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a1cc68c185a5299f5c76cfe82688f2b75567f694
4
- data.tar.gz: c35366ad8e92924a6ed1cbcb95261be155be26fa
3
+ metadata.gz: b8aa8b6e5512b84d4f288704757de8502d7ef854
4
+ data.tar.gz: c008651d92cdd63134677faa774e0c687c1c554e
5
5
  SHA512:
6
- metadata.gz: e6b215675ad6937197abe5806428f214e9cb852a542acc6507d3adc3ca2fd8b352fe0988ff4e868d311b5ab3b2dfc0bff8fe91c0ff260189fb9a5cdd15d5c0ca
7
- data.tar.gz: ebf84711da807433df3bd2f8068eaf4e116565574c6b9d3cf9bbf144ae7a1d99fc2052e607af9f6e52a50403501f59c52d06c42cb1c6bd7d2438aaf793d2c03f
6
+ metadata.gz: ec43831d6a0040556ef11abc1dd8c1d177ff8464c100fb4d468c122dc66b715351928de75a4aa3efc9d91eade2b5942b4a11906f9115c668a59c77c41facab15
7
+ data.tar.gz: 5f293bccb5d619b951c91d82fd1427af36df30ec0d0468b962bdbecc61393cd66b1e28574432c5c351b30f14b621bf2dc8ce88811f5818b7ffb2e3ae91486ba3
data/README.md CHANGED
@@ -2,9 +2,9 @@
2
2
  [![Coverage Status](https://coveralls.io/repos/vprokopchuk256/mv-mysql/badge.png?branch=master)](https://coveralls.io/r/vprokopchuk256/mv-mysql?branch=master)
3
3
  [![Gem Version](https://badge.fury.io/rb/mv-mysql.svg)](http://badge.fury.io/rb/mv-mysql)
4
4
 
5
- # `Migration Validators` project. MySQL driver.
5
+ # `Migration Validators` project. MySQL driver.
6
6
 
7
- Define validations directly in DB as MySQL 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 MySQL driver.
7
+ Define validations directly in DB as MySQL 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 MySQL driver.
8
8
 
9
9
  #Table Of Contents
10
10
  * [Validations](#validations)
@@ -41,7 +41,7 @@ Define validations directly in DB as MySQL constraints and integrate them into y
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 MySQL constraints and integrate them into y
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 MySQL constraints and integrate them into y
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 MySQL constraints and integrate them into y
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,14 +109,14 @@ Define validations directly in DB as MySQL constraints and integrate them into y
109
109
 
110
110
  ### length
111
111
 
112
- Examples:
112
+ Examples:
113
113
 
114
- column value length should be more than 4 symbols and less than 9. Otherwise 'Wrong length message' error will be raised:
114
+ column value length should be more than 4 symbols and less than 9. Otherwise 'Wrong length message' error will be raised:
115
115
 
116
- ```ruby
116
+ ```ruby
117
117
  def up
118
- validates :table_name, :column_name,
119
- length: { in: 5..8,
118
+ validates :table_name, :column_name,
119
+ length: { in: 5..8,
120
120
  message: 'Wrong length message' }
121
121
  end
122
122
 
@@ -129,7 +129,7 @@ Define validations directly in DB as MySQL constraints and integrate them into y
129
129
 
130
130
  ```ruby
131
131
  def up
132
- validates :table_name, :column_name,
132
+ validates :table_name, :column_name,
133
133
  length: { is: 3, allow_nil: true}
134
134
  end
135
135
 
@@ -138,21 +138,21 @@ Define validations directly in DB as MySQL constraints and integrate them into y
138
138
  end
139
139
  ```
140
140
 
141
- allow blank values:
141
+ allow blank values:
142
142
 
143
143
  ```ruby
144
144
  def up
145
- validates :table_name, :column_name,
146
- length: { maximum: 3,
147
- too_long: 'Value is longer than 3 symbols' }
145
+ validates :table_name, :column_name,
146
+ length: { maximum: 3,
147
+ too_long: 'Value is longer than 3 symbols' }
148
148
  end
149
149
 
150
150
  def down
151
151
  validates :table_name, :column_name, length: false
152
152
  end
153
153
  ```
154
-
155
- all above are available in a create and change table blocks:
154
+
155
+ all above are available in a create and change table blocks:
156
156
 
157
157
  ```ruby
158
158
  def change
@@ -200,7 +200,7 @@ Define validations directly in DB as MySQL constraints and integrate them into y
200
200
  * `:message`- message that should be shown if validation failed and specific message is not defined
201
201
  * `:too_long`- message that will be shown if value longer than allowed. Ignored unless maximum value is defined
202
202
  * `:too_short`- message that will be shown if value shorter than allowed. Ignored unless minimum value is defined
203
- * `:on`- validation event. Possible values `[:save, :update, :create]`. Default value: `:save`
203
+ * `:on`- validation event. Possible values `[:save, :update, :create]`. Default value: `:save`
204
204
  * `:create_tigger_name`- Name of the 'before insert' trigger
205
205
  * `:update_tigger_name`- Name of the 'before update' trigger
206
206
  * `:allow_nil`- ignore validation for nil values. Default value: `false`
@@ -211,7 +211,7 @@ Define validations directly in DB as MySQL constraints and integrate them into y
211
211
 
212
212
  Examples:
213
213
 
214
- valid values array:
214
+ valid values array:
215
215
 
216
216
  ```ruby
217
217
  def up
@@ -223,12 +223,12 @@ Define validations directly in DB as MySQL constraints and integrate them into y
223
223
  end
224
224
  ```
225
225
 
226
- with failure message specified:
226
+ with failure message specified:
227
227
 
228
228
  ```ruby
229
229
  def up
230
- validates :table_name, :column_name,
231
- inclusion: { in: [1, 2, 3],
230
+ validates :table_name, :column_name,
231
+ inclusion: { in: [1, 2, 3],
232
232
  message: "Column value should be equal to 1 or 2 or 3" }
233
233
  end
234
234
 
@@ -237,7 +237,7 @@ Define validations directly in DB as MySQL constraints and integrate them into y
237
237
  end
238
238
  ```
239
239
 
240
- all above are available in a create and change table blocks:
240
+ all above are available in a create and change table blocks:
241
241
 
242
242
  ```ruby
243
243
  def change
@@ -268,7 +268,7 @@ Define validations directly in DB as MySQL constraints and integrate them into y
268
268
  create_table :table_name do |t|
269
269
  t.string :str_or_str_1, inclusion: ['str', 'str1']
270
270
  t.string :from_str_to_str_1, inclusion: 'str'..'str1'
271
- t.string :str_or_str_1_in_trigger, inclusion: { in: ['str', 'str1'],
271
+ t.string :str_or_str_1_in_trigger, inclusion: { in: ['str', 'str1'],
272
272
  as: :trigger}
273
273
  end
274
274
  end
@@ -279,18 +279,18 @@ Define validations directly in DB as MySQL constraints and integrate them into y
279
279
  * `:in range` - or array that column value should be contained in.
280
280
  * `:message message` - that should be shown if validation failed
281
281
  * `:on validation` - event. Possible values `[:save, :update, :create]`. Default value: `:save`
282
- * `:create_tigger_name` - Name of the 'before insert' trigger
282
+ * `:create_tigger_name` - Name of the 'before insert' trigger
283
283
  * `:update_tigger_name` - Name of the 'before update' trigger
284
284
  * `:allow_nil` - ignore validation for nil values. Default value: `false`
285
285
  * `:allow_blank` - ignore validation for blank values. Default value: `false`
286
286
  * `:as` - defines the way how constraint will be implemented. Possible values: `[:trigger]`
287
287
 
288
-
288
+
289
289
  ### exclusion
290
290
 
291
291
  Examples:
292
292
 
293
- exclude 1, 2, and 3:
293
+ exclude 1, 2, and 3:
294
294
 
295
295
  ```ruby
296
296
  def up
@@ -302,13 +302,13 @@ Define validations directly in DB as MySQL constraints and integrate them into y
302
302
  end
303
303
  ```
304
304
 
305
- the same with failure message:
305
+ the same with failure message:
306
306
 
307
307
  ```ruby
308
308
  def up
309
- validates :table_name, :column_name,
309
+ validates :table_name, :column_name,
310
310
  exclusion: {
311
- in: [1, 2, 3],
311
+ in: [1, 2, 3],
312
312
  message: "Column value should not be equal to 1 or 2 or 3" }
313
313
  end
314
314
 
@@ -317,7 +317,7 @@ Define validations directly in DB as MySQL constraints and integrate them into y
317
317
  end
318
318
  ```
319
319
 
320
- all above are available in a create and change table blocks:
320
+ all above are available in a create and change table blocks:
321
321
 
322
322
  ```ruby
323
323
  def change
@@ -348,7 +348,7 @@ Define validations directly in DB as MySQL constraints and integrate them into y
348
348
  create_table :table_name do |t|
349
349
  t.string :neither_str_nor_str_1, exclusion: ['str', 'str1']
350
350
  t.string :from_str_to_str_1, exclusion: 'str'..'str1'
351
- t.string :str_or_str_1_in_trigger, exclusion: { in: ['str', 'str1'],
351
+ t.string :str_or_str_1_in_trigger, exclusion: { in: ['str', 'str1'],
352
352
  as: :trigger}
353
353
  end
354
354
  end
@@ -367,7 +367,7 @@ Define validations directly in DB as MySQL constraints and integrate them into y
367
367
 
368
368
  ### presence
369
369
 
370
- Examples:
370
+ Examples:
371
371
 
372
372
  ```ruby
373
373
  def up
@@ -379,11 +379,11 @@ Define validations directly in DB as MySQL constraints and integrate them into y
379
379
  end
380
380
  ```
381
381
 
382
- with failure message:
382
+ with failure message:
383
383
 
384
384
  ```ruby
385
385
  def up
386
- validates :table_name, :column_name,
386
+ validates :table_name, :column_name,
387
387
  presence: { message: 'value should not be empty' }
388
388
  end
389
389
 
@@ -392,13 +392,13 @@ Define validations directly in DB as MySQL constraints and integrate them into y
392
392
  end
393
393
  ```
394
394
 
395
- check when record is inserted only:
395
+ check when record is inserted only:
396
396
 
397
397
  ```ruby
398
398
  def up
399
- validates :table_name, :column_name,
400
- presence: { message: 'value should not be empty',
401
- as: :trigger,
399
+ validates :table_name, :column_name,
400
+ presence: { message: 'value should not be empty',
401
+ as: :trigger,
402
402
  on: :create }
403
403
  end
404
404
 
@@ -407,7 +407,7 @@ Define validations directly in DB as MySQL constraints and integrate them into y
407
407
  end
408
408
  ```
409
409
 
410
- all above are available in a create and change table blocks:
410
+ all above are available in a create and change table blocks:
411
411
 
412
412
  ```ruby
413
413
  def change
@@ -454,7 +454,7 @@ Define validations directly in DB as MySQL constraints and integrate them into y
454
454
 
455
455
  ### absence
456
456
 
457
- Examples:
457
+ Examples:
458
458
 
459
459
  ```ruby
460
460
  def up
@@ -466,11 +466,11 @@ Define validations directly in DB as MySQL constraints and integrate them into y
466
466
  end
467
467
  ```
468
468
 
469
- with failure message:
469
+ with failure message:
470
470
 
471
471
  ```ruby
472
472
  def up
473
- validates :table_name, :column_name,
473
+ validates :table_name, :column_name,
474
474
  absence: { message: 'value should be empty' }
475
475
  end
476
476
 
@@ -479,13 +479,13 @@ Define validations directly in DB as MySQL constraints and integrate them into y
479
479
  end
480
480
  ```
481
481
 
482
- check when record is inserted only:
482
+ check when record is inserted only:
483
483
 
484
484
  ```ruby
485
485
  def up
486
- validates :table_name, :column_name,
487
- absence: { message: 'value should be empty',
488
- as: :trigger,
486
+ validates :table_name, :column_name,
487
+ absence: { message: 'value should be empty',
488
+ as: :trigger,
489
489
  on: :create }
490
490
  end
491
491
 
@@ -494,7 +494,7 @@ Define validations directly in DB as MySQL constraints and integrate them into y
494
494
  end
495
495
  ```
496
496
 
497
- all above are available in a create and change table blocks:
497
+ all above are available in a create and change table blocks:
498
498
 
499
499
  ```ruby
500
500
  def change
@@ -542,9 +542,9 @@ Define validations directly in DB as MySQL constraints and integrate them into y
542
542
 
543
543
  ### format
544
544
 
545
- Examples:
545
+ Examples:
546
546
 
547
- allows only values that contains 'word' inside:
547
+ allows only values that contains 'word' inside:
548
548
 
549
549
  ```ruby
550
550
  def up
@@ -556,12 +556,12 @@ Define validations directly in DB as MySQL constraints and integrate them into y
556
556
  end
557
557
  ```
558
558
 
559
- with failure message:
559
+ with failure message:
560
560
 
561
561
  ```ruby
562
562
  def up
563
- validates :table_name, :column_name,
564
- format: { with: /word/,
563
+ validates :table_name, :column_name,
564
+ format: { with: /word/,
565
565
  message: 'Column_name value should contain start word' }
566
566
  end
567
567
 
@@ -574,9 +574,9 @@ Define validations directly in DB as MySQL constraints and integrate them into y
574
574
 
575
575
  ```ruby
576
576
  def up
577
- validates :table_name, :column_name,
578
- format: { with: /word/,
579
- message: 'Column_name value should contain start word',
577
+ validates :table_name, :column_name,
578
+ format: { with: /word/,
579
+ message: 'Column_name value should contain start word',
580
580
  as: :trigger }
581
581
  end
582
582
 
@@ -585,7 +585,7 @@ Define validations directly in DB as MySQL constraints and integrate them into y
585
585
  end
586
586
  ```
587
587
 
588
- all above are available in a create and change table blocks:
588
+ all above are available in a create and change table blocks:
589
589
 
590
590
  ```ruby
591
591
  def change
@@ -614,8 +614,8 @@ Define validations directly in DB as MySQL constraints and integrate them into y
614
614
  ```ruby
615
615
  def change
616
616
  create_table :table_name do |t|
617
- t.string :contains_word, format: /word/
618
- t.string :contains_word_in_trigger, format: { with: /word/,
617
+ t.string :contains_word, format: /word/
618
+ t.string :contains_word_in_trigger, format: { with: /word/,
619
619
  as: :trigger }
620
620
  end
621
621
  end
@@ -632,17 +632,17 @@ Define validations directly in DB as MySQL constraints and integrate them into y
632
632
  * `allow_blank` - ignore validation for blank values. Default value: `false`
633
633
  * `as` - defines the way how constraint will be implemented. Possible values: `[:trigger]` Default value: `:trigger`
634
634
 
635
- ### custom
635
+ ### custom
636
636
 
637
637
  (version >= 2.1 is required)
638
638
 
639
- Examples:
639
+ Examples:
640
640
 
641
- allows only values that equals 'word' when trimmed:
641
+ allows only values that equals 'word' when trimmed:
642
642
 
643
643
  ```ruby
644
644
  def up
645
- validates :table_name, :column_name,
645
+ validates :table_name, :column_name,
646
646
  custom: { statement: "TRIM({column_name}) = 'word'" }
647
647
  end
648
648
 
@@ -651,12 +651,12 @@ Define validations directly in DB as MySQL constraints and integrate them into y
651
651
  end
652
652
  ```
653
653
 
654
- with failure message:
654
+ with failure message:
655
655
 
656
656
  ```ruby
657
657
  def up
658
- validates :table_name, :column_name,
659
- custom: { statement: "TRIM({column_name}) = 'word'",
658
+ validates :table_name, :column_name,
659
+ custom: { statement: "TRIM({column_name}) = 'word'",
660
660
  message: 'Column_name value should contain start word' }
661
661
  end
662
662
 
@@ -669,10 +669,10 @@ Define validations directly in DB as MySQL constraints and integrate them into y
669
669
 
670
670
  ```ruby
671
671
  def up
672
- validates :table_name, :column_name,
673
- custom: { statement: "TRIM({column_name}) = 'word'",
674
- message: 'Column_name value should contain start word',
675
- as: :trigger,
672
+ validates :table_name, :column_name,
673
+ custom: { statement: "TRIM({column_name}) = 'word'",
674
+ message: 'Column_name value should contain start word',
675
+ as: :trigger,
676
676
  on: :create }
677
677
  end
678
678
 
@@ -681,12 +681,12 @@ Define validations directly in DB as MySQL constraints and integrate them into y
681
681
  end
682
682
  ```
683
683
 
684
- all above are available in a create and change table blocks:
684
+ all above are available in a create and change table blocks:
685
685
 
686
686
  ```ruby
687
687
  def change
688
688
  create_table :table_name do |t|
689
- t.string :column_name,
689
+ t.string :column_name,
690
690
  validates: { custom: { statement: "TRIM({column_name}) = 'word'"} }
691
691
  end
692
692
  end
@@ -695,7 +695,7 @@ Define validations directly in DB as MySQL constraints and integrate them into y
695
695
  ```ruby
696
696
  def up
697
697
  change :table_name do |t|
698
- t.change :column_name, :string,
698
+ t.change :column_name, :string,
699
699
  validates: { custom: { statement: "TRIM({column_name}) = 'word'"} }
700
700
  end
701
701
  end
@@ -713,14 +713,14 @@ Define validations directly in DB as MySQL constraints and integrate them into y
713
713
  def change
714
714
  create_table :table_name do |t|
715
715
  t.string :contains_word, custom: "TRIM({contains_word}) = 'word'"
716
- t.string :contains_word_synonym,
716
+ t.string :contains_word_synonym,
717
717
  validates: "TRIM({contains_word_synonym}) = 'word'"
718
- t.string :contains_word_in_trigger,
718
+ t.string :contains_word_in_trigger,
719
719
  custom: { statement: "TRIM({contains_word_in_trigger}) = 'word'", as: :trigger }
720
720
  end
721
721
  end
722
722
  ```
723
-
723
+
724
724
  Options:
725
725
 
726
726
  * `:message` - message that should be shown if validation failed
@@ -730,7 +730,7 @@ Define validations directly in DB as MySQL constraints and integrate them into y
730
730
  * `:allow_nil` - ignore validation for nil values. Default value: false
731
731
  * `:allow_blank` - ignore validation for blank values. Default value: `false`
732
732
  * `:as` - defines the way how constraint will be implemented. Possible values: `[:trigger]`
733
-
733
+
734
734
  ## Version History
735
735
 
736
736
  **(2.0.0)** (17 Jan, 2015)
@@ -739,7 +739,7 @@ Define validations directly in DB as MySQL constraints and integrate them into y
739
739
 
740
740
  **(2.1.0)** (22 Jan, 2015)
741
741
 
742
- * Custom validation
742
+ * Custom validation
743
743
 
744
744
  **(2.2.0)** (28 Jan, 2015)
745
745
 
@@ -753,6 +753,10 @@ Define validations directly in DB as MySQL constraints and integrate them into y
753
753
 
754
754
  * Made it possible to use several mv-* drivers in the same project
755
755
 
756
+ **(2.2.3)** (20 Jul, 2015)
757
+
758
+ * Fix issue with invalid parameters number in `add_column` and `change_column` methods
759
+
756
760
  ## Contributing
757
761
 
758
762
  * 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-mysql
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.2
4
+ version: 2.2.3
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