Skip to content

Commit 705b3ae

Browse files
committed
release 0.5
1 parent cbbb49e commit 705b3ae

File tree

4 files changed

+24
-12
lines changed

4 files changed

+24
-12
lines changed

Gemfile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
source 'https://rubygems.org'
22

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-
63
# Specify your gem's dependencies in db_schema.gemspec
74
gemspec

README.md

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ But you would lose it even with manual migrations.
5353
Add these lines to your application's Gemfile:
5454

5555
``` ruby
56-
gem 'db_schema', '= 0.5.rc1'
57-
gem 'db_schema-reader-postgres', '= 0.2.rc1'
56+
gem 'db_schema', '~> 0.5.0'
57+
gem 'db_schema-reader-postgres', '~> 0.2.0'
5858
```
5959

6060
And then execute:
@@ -72,6 +72,23 @@ $ gem install db_schema db_schema-reader-postgres
7272
The `db_schema-reader-postgres` [gem](https://github.com/db-schema/reader-postgres) is a PostgreSQL adapter
7373
for `DbSchema::Reader` (a module which is responsible for reading the current database schema).
7474

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+
7592
## Usage
7693

7794
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')
101118
This `db/schema.rb` file will contain a description of your database structure
102119
(you can choose any filename you want). When you load this file it instantly
103120
applies the described structure to your database. Be sure to keep this file
104-
under version control as it will be a single source of truth about
121+
under version control as it will be the single source of truth about
105122
the database structure.
106123

107124
``` ruby
108125
# db/schema.rb
109126
DbSchema.describe do |db|
110127
db.table :users do |t|
111-
t.primary_key :id
128+
t.serial :id, primary_key: true
112129
t.varchar :email, null: false, unique: true
113130
t.varchar :password_digest, length: 40
114131
t.timestamptz :created_at
@@ -230,8 +247,6 @@ Conditional migrations are described [here](https://github.com/db-schema/core/wi
230247

231248
## Known problems and limitations
232249

233-
* composite primary keys are not supported
234-
* auto-incremented integer field can only be created as a primary key
235250
* array element type attributes are not supported
236251
* precision in all date/time types isn't supported
237252
* no support for databases other than PostgreSQL

db_schema.gemspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
2020

2121
spec.add_runtime_dependency 'sequel'
2222
spec.add_runtime_dependency 'dry-equalizer', '~> 0.2'
23-
spec.add_runtime_dependency 'db_schema-definitions', '= 0.2.rc1'
23+
spec.add_runtime_dependency 'db_schema-definitions', '~> 0.2.0'
2424

2525
spec.add_development_dependency 'bundler', '~> 1.11'
2626
spec.add_development_dependency 'rake', '~> 10.0'
@@ -32,5 +32,5 @@ Gem::Specification.new do |spec|
3232
spec.add_development_dependency 'terminal-notifier'
3333
spec.add_development_dependency 'terminal-notifier-guard'
3434

35-
spec.add_development_dependency 'db_schema-reader-postgres', '= 0.2.rc1'
35+
spec.add_development_dependency 'db_schema-reader-postgres', '~> 0.2.0'
3636
end

lib/db_schema/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module DbSchema
2-
VERSION = '0.5.rc1'
2+
VERSION = '0.5'
33
end

0 commit comments

Comments
 (0)