draft_box 0.0.2 → 0.0.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 810d24fb1ae9b877a1de545a4b91ae5a8e501f2817d823ba799afbb609b9c861
4
- data.tar.gz: 8d347ecc7d1662422f7ea02ec74afca947a82c77738e4214ef5c124306f654d0
3
+ metadata.gz: 1dc9cf8a9519b398b986ab18e390772663f053ce25c6869eda6a6b7fbbeb72be
4
+ data.tar.gz: 80243f6424c99fc312cb7d497b46d1b5dfa3b571683f0693901ae76b86ad49ef
5
5
  SHA512:
6
- metadata.gz: cdc8bedba1bcd7818f959db5cd49a7008fcbfc8488e9ffa1609e5a1f7bc36f4f9b4e56bf0b1531b0b3a854944b8fae90e7ecca3da26299195fb1e0c010a70657
7
- data.tar.gz: e659f0b821bd207e1e8f11865cbef280a8fa5d6d7386bb8a5002acb641d08ea6710b122215a8922aa825905680a04a80df20985aae3270f1397edbddde8edf70
6
+ metadata.gz: 3ebf36e1a8da2d791fae17a97d38d98eb5550cee8c82fbc1f0d32c65f431777d675d81e08ee91fffc19f31c46f4571f5cade5d75ac04e63c0719c64c0dbb7a62
7
+ data.tar.gz: e6d50e905acef3486de12c3e4c33bbab26fcd5bb91dcafc49ed16d42fb3a9e177270e4b1db8b1b3e86a8a98431b7a48678b15e819752501b9747afe160fd429d
@@ -3,7 +3,7 @@ module DraftBox
3
3
  module_function
4
4
 
5
5
  def to_s
6
- '0.0.2'
6
+ '0.0.3'
7
7
  end
8
8
  end
9
9
  end
@@ -30,7 +30,15 @@ module Generators
30
30
  end
31
31
 
32
32
  def sqlite?
33
- ActiveRecord::Base.configurations.configs_for(env_name: Rails.env, name: "primary").adapter_class.to_s.match?(/sqlite/i)
33
+ db_adapter.match?(/sqlite/i)
34
+ end
35
+
36
+ def mysql?
37
+ db_adapter.match?(/mysql/i)
38
+ end
39
+
40
+ def db_adapter
41
+ ActiveRecord::Base.configurations.configs_for(env_name: Rails.env, name: "primary").adapter_class.to_s
34
42
  end
35
43
  end
36
44
  end
@@ -4,17 +4,21 @@ class CreateDraftBoxEmails < ActiveRecord::Migration<%= migration_version %>
4
4
  t.string :subject
5
5
  t.text :body
6
6
  t.string :from
7
- <% unless sqlite? -%>
8
- t.string :recipients, array: true, default: []
9
- t.string :carbon_copies, array: true, default: []
10
- t.string :blind_copies, array: true, default: []
11
- <% else %>
7
+ <% if mysql? -%>
8
+ t.string :recipients, default: '[]'
9
+ t.string :carbon_copies, default: '[]'
10
+ t.string :blind_copies, default: '[]'
11
+ <% elsif sqlite? %>
12
12
  t.json :recipients, null: false, default: []
13
13
  t.json :carbon_copies, null: false, default: []
14
14
  t.json :blind_copies, null: false, default: []
15
15
  t.check_constraint "JSON_TYPE(recipients) = 'array'", name: 'draft_box_emails_recipients_is_array'
16
16
  t.check_constraint "JSON_TYPE(carbon_copies) = 'array'", name: 'draft_box_emails_carbon_copies_is_array'
17
17
  t.check_constraint "JSON_TYPE(blind_copies) = 'array'", name: 'draft_box_emails_blind_copies_is_array'
18
+ <% else %>
19
+ t.string :recipients, array: true, default: []
20
+ t.string :carbon_copies, array: true, default: []
21
+ t.string :blind_copies, array: true, default: []
18
22
  <% end -%>
19
23
 
20
24
  t.timestamps
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: draft_box
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paweł Dąbrowski