db_schema 0.5.rc1 → 0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -3
- data/README.md +21 -6
- data/db_schema.gemspec +2 -2
- data/lib/db_schema/version.rb +1 -1
- metadata +12 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20d4ca3e75d7a93117adb61cf0aeab1cb9a8779fe637f14c1c61a844ca7e7f7a
|
4
|
+
data.tar.gz: b560dade34ab4d99b313eb8955880c54ecffc8db89d30d106191fc067862c958
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4cc77851cc3fda8917f3ccd7fd753b211eb2f9368feb261371932b9ce56ee1d328b7e7b4a5a996c1244f971c30cf62a046e3c1ef4996964d0add238e9c5a94f8
|
7
|
+
data.tar.gz: ad7a853c060507b075acc264083bca4b0bb3c4303ecb9ed84b2a6bf24c11773f69aac066575426872b501e34a50d32a0998d59456a5d235f3af976a9429f7c8c
|
data/Gemfile
CHANGED
@@ -1,7 +1,4 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
gem 'db_schema-definitions', github: 'db-schema/definitions', branch: 'primary_keys'
|
4
|
-
gem 'db_schema-reader-postgres', github: 'db-schema/reader-postgres', branch: 'primary_keys'
|
5
|
-
|
6
3
|
# Specify your gem's dependencies in db_schema.gemspec
|
7
4
|
gemspec
|
data/README.md
CHANGED
@@ -53,8 +53,8 @@ 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', '
|
57
|
-
gem 'db_schema-reader-postgres', '
|
56
|
+
gem 'db_schema', '~> 0.5.0'
|
57
|
+
gem 'db_schema-reader-postgres', '~> 0.2.0'
|
58
58
|
```
|
59
59
|
|
60
60
|
And then execute:
|
@@ -72,6 +72,23 @@ $ gem install db_schema db_schema-reader-postgres
|
|
72
72
|
The `db_schema-reader-postgres` [gem](https://github.com/db-schema/reader-postgres) is a PostgreSQL adapter
|
73
73
|
for `DbSchema::Reader` (a module which is responsible for reading the current database schema).
|
74
74
|
|
75
|
+
## Upgrading to 0.5
|
76
|
+
|
77
|
+
Version 0.5 introduced full support for serial fields and primary keys slightly changing the DSL for
|
78
|
+
defining the primary key:
|
79
|
+
|
80
|
+
``` ruby
|
81
|
+
db.table :users do |t|
|
82
|
+
# before 0.5
|
83
|
+
t.primary_key :id
|
84
|
+
# since 0.5
|
85
|
+
t.serial :id, primary_key: true
|
86
|
+
end
|
87
|
+
```
|
88
|
+
|
89
|
+
So if you get an `Index "users_pkey" refers to a missing field "users.id"` error you should change
|
90
|
+
your schema definition to the new syntax.
|
91
|
+
|
75
92
|
## Usage
|
76
93
|
|
77
94
|
First you need to configure DbSchema so it knows how to connect to your database. This should happen
|
@@ -101,14 +118,14 @@ load application_root.join('db/schema.rb')
|
|
101
118
|
This `db/schema.rb` file will contain a description of your database structure
|
102
119
|
(you can choose any filename you want). When you load this file it instantly
|
103
120
|
applies the described structure to your database. Be sure to keep this file
|
104
|
-
under version control as it will be
|
121
|
+
under version control as it will be the single source of truth about
|
105
122
|
the database structure.
|
106
123
|
|
107
124
|
``` ruby
|
108
125
|
# db/schema.rb
|
109
126
|
DbSchema.describe do |db|
|
110
127
|
db.table :users do |t|
|
111
|
-
t.primary_key
|
128
|
+
t.serial :id, primary_key: true
|
112
129
|
t.varchar :email, null: false, unique: true
|
113
130
|
t.varchar :password_digest, length: 40
|
114
131
|
t.timestamptz :created_at
|
@@ -230,8 +247,6 @@ Conditional migrations are described [here](https://github.com/db-schema/core/wi
|
|
230
247
|
|
231
248
|
## Known problems and limitations
|
232
249
|
|
233
|
-
* composite primary keys are not supported
|
234
|
-
* auto-incremented integer field can only be created as a primary key
|
235
250
|
* array element type attributes are not supported
|
236
251
|
* precision in all date/time types isn't supported
|
237
252
|
* no support for databases other than PostgreSQL
|
data/db_schema.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.add_runtime_dependency 'sequel'
|
22
22
|
spec.add_runtime_dependency 'dry-equalizer', '~> 0.2'
|
23
|
-
spec.add_runtime_dependency 'db_schema-definitions', '
|
23
|
+
spec.add_runtime_dependency 'db_schema-definitions', '~> 0.2.0'
|
24
24
|
|
25
25
|
spec.add_development_dependency 'bundler', '~> 1.11'
|
26
26
|
spec.add_development_dependency 'rake', '~> 10.0'
|
@@ -32,5 +32,5 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.add_development_dependency 'terminal-notifier'
|
33
33
|
spec.add_development_dependency 'terminal-notifier-guard'
|
34
34
|
|
35
|
-
spec.add_development_dependency 'db_schema-reader-postgres', '
|
35
|
+
spec.add_development_dependency 'db_schema-reader-postgres', '~> 0.2.0'
|
36
36
|
end
|
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: 0.5
|
4
|
+
version: '0.5'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vsevolod Romashov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-03-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sequel
|
@@ -42,16 +42,16 @@ dependencies:
|
|
42
42
|
name: db_schema-definitions
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.2.
|
47
|
+
version: 0.2.0
|
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: 0.2.
|
54
|
+
version: 0.2.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: bundler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -168,16 +168,16 @@ dependencies:
|
|
168
168
|
name: db_schema-reader-postgres
|
169
169
|
requirement: !ruby/object:Gem::Requirement
|
170
170
|
requirements:
|
171
|
-
- -
|
171
|
+
- - "~>"
|
172
172
|
- !ruby/object:Gem::Version
|
173
|
-
version: 0.2.
|
173
|
+
version: 0.2.0
|
174
174
|
type: :development
|
175
175
|
prerelease: false
|
176
176
|
version_requirements: !ruby/object:Gem::Requirement
|
177
177
|
requirements:
|
178
|
-
- -
|
178
|
+
- - "~>"
|
179
179
|
- !ruby/object:Gem::Version
|
180
|
-
version: 0.2.
|
180
|
+
version: 0.2.0
|
181
181
|
description: A database schema management tool that reads a "single-source-of-truth"
|
182
182
|
schema definition from a ruby file and auto-migrates the database to conform to
|
183
183
|
it.
|
@@ -228,9 +228,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
228
228
|
version: '0'
|
229
229
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
230
230
|
requirements:
|
231
|
-
- - "
|
231
|
+
- - ">="
|
232
232
|
- !ruby/object:Gem::Version
|
233
|
-
version:
|
233
|
+
version: '0'
|
234
234
|
requirements: []
|
235
235
|
rubygems_version: 3.0.1
|
236
236
|
signing_key:
|