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 +4 -4
- data/README.md +3 -2
- data/lib/db_schema/runner.rb +6 -2
- data/lib/db_schema/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2a24b0939afdbb0a33cfc0b34f76a70059a22c995513c1c4fec7111b4b7096b2
|
4
|
+
data.tar.gz: 28c50f5ea2b03c1464bcff2dfc95e58569b1a2f08e4193e04336fec57295d600
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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
|
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
|
data/lib/db_schema/runner.rb
CHANGED
@@ -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)
|
data/lib/db_schema/version.rb
CHANGED
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:
|
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-
|
11
|
+
date: 2018-11-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sequel
|