https://github.com/sqldef/sqldef-rails
Rails integration for sqldef
https://github.com/sqldef/sqldef-rails
Last synced: 8 months ago
JSON representation
Rails integration for sqldef
- Host: GitHub
- URL: https://github.com/sqldef/sqldef-rails
- Owner: sqldef
- License: mit
- Created: 2021-03-13T09:37:31.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-03-09T07:26:53.000Z (almost 4 years ago)
- Last Synced: 2025-03-23T03:51:17.027Z (9 months ago)
- Language: Ruby
- Size: 17.6 KB
- Stars: 12
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# sqldef-rails
Run [sqldef](https://github.com/k0kubun/sqldef) on Rails.
## Installation
```ruby
gem 'sqldef-rails'
```
## Usage
### Configuration
Just configure `config/database.yml` normally.
```yml
default: &default
adapter: postgresql
username: postgres
password:
host: 127.0.0.1
development:
<<: *default
database: sqldef_development
test:
<<: *default
database: sqldef_test
```
### Export
Dump the current schema to `db/schema.sql`.
```bash
bundle exec rake db:schema:dump
```
You may use `bin/rails` instead of `bundle exec rake` too.
### Dry Run
You can show DDLs to be executed to match `db/schema.sql`.
```bash
bundle exec rake db:migrate:status
```
### Aplly
You can run DDLs to match `db/schema.sql`.
```bash
bundle exec rake db:migrate
```
## License
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).