mv-sqlite 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 +91 -83
  3. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4c1d336c78c19529b6d63bfcf9e171317a5bcd3f
4
- data.tar.gz: ee3c8e102bfb81520190fa0f122f24623fe45752
3
+ metadata.gz: 51d4641b55199499595f70d9d11d92a4ffdf87d6
4
+ data.tar.gz: 3ab3f39cb1f4676583e50319862e15dcf564a806
5
5
  SHA512:
6
- metadata.gz: cdb0c7946a01247e8218ce9b68fcf4f1fb31ec924e20cbd73a82b4c9832d42b631d9c3d125b85b7ac9117c3b4f246b3d7828cee938c12087b965bca6dd3510c9
7
- data.tar.gz: f14e20bcb40b4241121a06ba7e5c6bfda7bb8c1b0d2ab1189c6b72d6a30cf717c594fb3edd0d72c7a9f5f9c999cc697c2812aeae8700ba6c30ff0aaf78bcfd36
6
+ metadata.gz: 3797e535bfdbb4657be3f10de18e71ed210cfbf552f57a47b6c116942f41a641d4696e2bca5a4d81ca63de670628343b58f89532c13a438a0b5b4119992a6514
7
+ data.tar.gz: 367eec5f94bf1bf72976e7dfd8d4f99e90f6b2159ec233f1320f71b2b9d501e00f8e3e9ef102bf16ddce1d1748392dcaeff2db8d5cddf6a830e063c8b062a3a2
data/README.md CHANGED
@@ -2,9 +2,9 @@
2
2
  [![Coverage Status](https://coveralls.io/repos/vprokopchuk256/mv-sqlite/badge.png?branch=master)](https://coveralls.io/r/vprokopchuk256/mv-sqlite?branch=master)
3
3
  [![Gem Version](https://badge.fury.io/rb/mv-sqlite.svg)](http://badge.fury.io/rb/mv-sqlite)
4
4
 
5
- # `Migration Validators` project. SQLite driver.
5
+ # `Migration Validators` project. SQLite driver.
6
6
 
7
- Define validations directly in DB as SQLite 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 SQLite driver.
7
+ Define validations directly in DB as SQLite 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 SQLite driver.
8
8
 
9
9
  #Table Of Contents
10
10
  * [Validations](#validations)
@@ -41,7 +41,7 @@ Define validations directly in DB as SQLite constraints and integrate them into
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 SQLite constraints and integrate them into
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 SQLite constraints and integrate them into
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 SQLite constraints and integrate them into
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 SQLite constraints and integrate them into
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 SQLite constraints and integrate them into
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 SQLite constraints and integrate them into
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 SQLite constraints and integrate them into
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`
@@ -209,9 +209,9 @@ Define validations directly in DB as SQLite constraints and integrate them into
209
209
 
210
210
  ### inclusion
211
211
 
212
- Examples:
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 SQLite constraints and integrate them into
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 SQLite constraints and integrate them into
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 SQLite constraints and integrate them into
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 SQLite constraints and integrate them into
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 SQLite constraints and integrate them into
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 'column_name' 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 SQLite constraints and integrate them into
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 SQLite constraints and integrate them into
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 SQLite constraints and integrate them into
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 SQLite constraints and integrate them into
379
379
  end
380
380
  ```
381
381
 
382
- with failure message:
382
+ with failure message:
383
383
 
384
384
  ```ruby
385
- def up
386
- validates :table_name, :column_name,
385
+ def up
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 SQLite constraints and integrate them into
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 SQLite constraints and integrate them into
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 SQLite constraints and integrate them into
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 SQLite constraints and integrate them into
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 SQLite constraints and integrate them into
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
- def up
486
- validates :table_name, :column_name,
487
- absence: { message: 'value should be empty',
488
- as: :trigger,
485
+ def up
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 SQLite constraints and integrate them into
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
@@ -539,13 +539,13 @@ Define validations directly in DB as SQLite constraints and integrate them into
539
539
  * `allow_blank` - ignore validation for blank values. Default value: `true`
540
540
  * `as` - defines the way how constraint will be implemented. Possible values: `[:trigger]` Default value: `:trigger`
541
541
 
542
- ### format
542
+ ### format
543
543
 
544
544
  **WARNING** ```SQLite``` does NOT have default ```REGEXP``` implementation. ```mv-sqlite``` contains own implementation that is available with active record connection only. In other words everything should be ok if you access database from withing rails console or rails application or other application that uses ```activerecord``` internally. But not defined function error will be thrown when you access database direclty. You can build ```SQLite``` ```ICU``` extension to enable native ```SQLite``` ```REGEXP```. See details here: http://www.sqlite.org/src/artifact?ci=trunk&filename=ext/icu/README.txt.
545
545
 
546
- Examples:
546
+ Examples:
547
547
 
548
- allows only values that contains 'word' inside:
548
+ allows only values that contains 'word' inside:
549
549
 
550
550
  ```ruby
551
551
  def up
@@ -557,12 +557,12 @@ Define validations directly in DB as SQLite constraints and integrate them into
557
557
  end
558
558
  ```
559
559
 
560
- with failure message:
560
+ with failure message:
561
561
 
562
562
  ```ruby
563
563
  def up
564
- validates :table_name, :column_name,
565
- format: { with: /word/,
564
+ validates :table_name, :column_name,
565
+ format: { with: /word/,
566
566
  message: 'Column_name value should contain start word' }
567
567
  end
568
568
 
@@ -575,9 +575,9 @@ Define validations directly in DB as SQLite constraints and integrate them into
575
575
 
576
576
  ```ruby
577
577
  def up
578
- validates :table_name, :column_name,
579
- format: { with: /word/,
580
- message: 'Column_name value should contain start word',
578
+ validates :table_name, :column_name,
579
+ format: { with: /word/,
580
+ message: 'Column_name value should contain start word',
581
581
  as: :trigger }
582
582
  end
583
583
 
@@ -586,7 +586,7 @@ Define validations directly in DB as SQLite constraints and integrate them into
586
586
  end
587
587
  ```
588
588
 
589
- all above are available in a create and change table blocks:
589
+ all above are available in a create and change table blocks:
590
590
 
591
591
  ```ruby
592
592
  def change
@@ -615,8 +615,8 @@ Define validations directly in DB as SQLite constraints and integrate them into
615
615
  ```ruby
616
616
  def change
617
617
  create_table :table_name do |t|
618
- t.string :contains_word, format: /word/
619
- t.string :contains_word_in_trigger, format: { with: /word/,
618
+ t.string :contains_word, format: /word/
619
+ t.string :contains_word_in_trigger, format: { with: /word/,
620
620
  as: :trigger }
621
621
  end
622
622
  end
@@ -633,17 +633,17 @@ Define validations directly in DB as SQLite constraints and integrate them into
633
633
  * `allow_blank` - ignore validation for blank values. Default value: `false`
634
634
  * `as` - defines the way how constraint will be implemented. Possible values: `[:trigger]` Default value: `:trigger`
635
635
 
636
- ### custom
636
+ ### custom
637
637
 
638
638
  (version >= 2.1 is required)
639
639
 
640
- Examples:
640
+ Examples:
641
641
 
642
- allows only values that equals 'word' when trimmed:
642
+ allows only values that equals 'word' when trimmed:
643
643
 
644
644
  ```ruby
645
645
  def up
646
- validates :table_name, :column_name,
646
+ validates :table_name, :column_name,
647
647
  custom: { statement: "TRIM({column_name}) = 'word'" }
648
648
  end
649
649
 
@@ -652,12 +652,12 @@ Define validations directly in DB as SQLite constraints and integrate them into
652
652
  end
653
653
  ```
654
654
 
655
- with failure message:
655
+ with failure message:
656
656
 
657
657
  ```ruby
658
658
  def up
659
- validates :table_name, :column_name,
660
- custom: { statement: "TRIM({column_name}) = 'word'",
659
+ validates :table_name, :column_name,
660
+ custom: { statement: "TRIM({column_name}) = 'word'",
661
661
  message: 'Column_name value should contain start word' }
662
662
  end
663
663
 
@@ -670,10 +670,10 @@ Define validations directly in DB as SQLite constraints and integrate them into
670
670
 
671
671
  ```ruby
672
672
  def up
673
- validates :table_name, :column_name,
674
- custom: { statement: "TRIM({column_name}) = 'word'",
675
- message: 'Column_name value should contain start word',
676
- as: :trigger,
673
+ validates :table_name, :column_name,
674
+ custom: { statement: "TRIM({column_name}) = 'word'",
675
+ message: 'Column_name value should contain start word',
676
+ as: :trigger,
677
677
  on: :create }
678
678
  end
679
679
 
@@ -682,12 +682,12 @@ Define validations directly in DB as SQLite constraints and integrate them into
682
682
  end
683
683
  ```
684
684
 
685
- all above are available in a create and change table blocks:
685
+ all above are available in a create and change table blocks:
686
686
 
687
687
  ```ruby
688
688
  def change
689
689
  create_table :table_name do |t|
690
- t.string :column_name,
690
+ t.string :column_name,
691
691
  validates: { custom: { statement: "TRIM({column_name}) = 'word'"} }
692
692
  end
693
693
  end
@@ -696,7 +696,7 @@ Define validations directly in DB as SQLite constraints and integrate them into
696
696
  ```ruby
697
697
  def up
698
698
  change :table_name do |t|
699
- t.change :column_name, :string,
699
+ t.change :column_name, :string,
700
700
  validates: { custom: { statement: "TRIM({column_name}) = 'word'"} }
701
701
  end
702
702
  end
@@ -714,14 +714,14 @@ Define validations directly in DB as SQLite constraints and integrate them into
714
714
  def change
715
715
  create_table :table_name do |t|
716
716
  t.string :contains_word, custom: "TRIM({contains_word}) = 'word'"
717
- t.string :contains_word_synonym,
717
+ t.string :contains_word_synonym,
718
718
  validates: "TRIM({contains_word_synonym}) = 'word'"
719
- t.string :contains_word_in_trigger,
719
+ t.string :contains_word_in_trigger,
720
720
  custom: { statement: "TRIM({contains_word_in_trigger}) = 'word'", as: :trigger }
721
721
  end
722
722
  end
723
723
  ```
724
-
724
+
725
725
  Options:
726
726
 
727
727
  * `:message` - message that should be shown if validation failed
@@ -731,7 +731,7 @@ Define validations directly in DB as SQLite constraints and integrate them into
731
731
  * `:allow_nil` - ignore validation for nil values. Default value: false
732
732
  * `:allow_blank` - ignore validation for blank values. Default value: `false`
733
733
  * `:as` - defines the way how constraint will be implemented. Possible values: `[:trigger]`
734
-
734
+
735
735
  ## Version History
736
736
 
737
737
  **(2.0.0)** (17 Jan, 2015)
@@ -740,7 +740,7 @@ Define validations directly in DB as SQLite constraints and integrate them into
740
740
 
741
741
  **(2.1.0)** (22 Jan, 2015)
742
742
 
743
- * Custom validation
743
+ * Custom validation
744
744
 
745
745
  **(2.2.0)** (28 Jan, 2015)
746
746
 
@@ -750,6 +750,14 @@ Define validations directly in DB as SQLite constraints and integrate them into
750
750
 
751
751
  * Made it possible to use several mv-* drivers in the same project
752
752
 
753
+ **(2.2.2)** (1 June, 2015)
754
+
755
+ * Format validation
756
+
757
+ **(2.2.3)** (20 Jul, 2015)
758
+
759
+ * Fix issue with invalid parameters number in `add_column` and `change_column` methods
760
+
753
761
  ## Contributing
754
762
 
755
763
  * 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-sqlite
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-06-01 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