db_schema 0.4 → 0.4.1

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
  SHA256:
3
- metadata.gz: 63847549e7e2a6350f2804c5a2a251388f6b65ff206d51fc34403b4a56d883aa
4
- data.tar.gz: a2d2ff387fa992afac8764cd6a0c5dff3b5f34bcd1f632d4fcb3ec216f13360c
3
+ metadata.gz: 2a24b0939afdbb0a33cfc0b34f76a70059a22c995513c1c4fec7111b4b7096b2
4
+ data.tar.gz: 28c50f5ea2b03c1464bcff2dfc95e58569b1a2f08e4193e04336fec57295d600
5
5
  SHA512:
6
- metadata.gz: 8d2793a8eed21c593be07e7c5a067a86e0d2566938f99e410808d3657898b37abaab8e1db1adff8ff8b8c311fb123204b05713f650cf9ff2de882689f2ebabf0
7
- data.tar.gz: c2b2e6dca0d6c7df815bf8e8e060bb3b35727bd02ccd8c18c943c6f7373777d1e77151f0ba87f0f64014affc371848e8e05dfa6fd0a6c9387fc340caa42bfccc
6
+ metadata.gz: c52517e5394f962f6121fd6728a9764055fb1d6ba0dc78817360106f986f2feca1c7e0dd992f7dc4e168112126656934e838132c0a780a4b6de154c4b6d05c73
7
+ data.tar.gz: be7a87847222b9bb7e23b6883f844d0923cc0538dd6c456be6facc6d03d0216b6ac21345089e2d1e910752e3712533ac808b980cadfc9c0339584994394723c4
data/README.md CHANGED
@@ -53,7 +53,7 @@ But you would lose it even with manual migrations.
53
53
  Add these lines to your application's Gemfile:
54
54
 
55
55
  ``` ruby
56
- gem 'db_schema', '~> 0.4.0'
56
+ gem 'db_schema', '~> 0.4.1'
57
57
  gem 'db_schema-reader-postgres', '~> 0.1.1'
58
58
  ```
59
59
 
@@ -230,7 +230,8 @@ Conditional migrations are described [here](https://github.com/db-schema/core/wi
230
230
 
231
231
  ## Known problems and limitations
232
232
 
233
- * primary keys are hardcoded to a single NOT NULL integer field with a postgres sequence attached
233
+ * composite primary keys are not supported
234
+ * auto-incremented integer field can only be created as a primary key
234
235
  * array element type attributes are not supported
235
236
  * precision in all date/time types isn't supported
236
237
  * no support for databases other than PostgreSQL
@@ -44,11 +44,13 @@ module DbSchema
44
44
  def create_table(change)
45
45
  connection.create_table(change.table.name) do
46
46
  change.table.fields.each do |field|
47
- if field.primary_key?
47
+ if field.primary_key? && field.type == :integer
48
48
  primary_key(field.name)
49
49
  else
50
50
  options = Runner.map_options(field.class.type, field.options)
51
51
  column(field.name, field.type.capitalize, options)
52
+
53
+ primary_key([field.name]) if field.primary_key?
52
54
  end
53
55
  end
54
56
 
@@ -81,11 +83,13 @@ module DbSchema
81
83
  change.changes.each do |element|
82
84
  case element
83
85
  when Operations::CreateColumn
84
- if element.primary_key?
86
+ if element.primary_key? && element.type == :integer
85
87
  add_primary_key(element.name)
86
88
  else
87
89
  options = Runner.map_options(element.type, element.options)
88
90
  add_column(element.name, element.type.capitalize, options)
91
+
92
+ add_primary_key([element.name]) if element.primary_key?
89
93
  end
90
94
  when Operations::DropColumn
91
95
  drop_column(element.name)
@@ -1,3 +1,3 @@
1
1
  module DbSchema
2
- VERSION = '0.4'
2
+ VERSION = '0.4.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: db_schema
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.4'
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vsevolod Romashov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-11-01 00:00:00.000000000 Z
11
+ date: 2018-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sequel