https://github.com/sqldef/sqldef-ruby
Ruby interface for sqldef
https://github.com/sqldef/sqldef-ruby
Last synced: 2 months ago
JSON representation
Ruby interface for sqldef
- Host: GitHub
- URL: https://github.com/sqldef/sqldef-ruby
- Owner: sqldef
- License: mit
- Created: 2021-03-13T09:29:05.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-01-11T02:04:45.000Z (over 1 year ago)
- Last Synced: 2025-03-23T03:51:17.616Z (3 months ago)
- Language: Ruby
- Size: 16.6 KB
- Stars: 1
- Watchers: 0
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# sqldef-ruby
Ruby interface to call [sqldef](https://github.com/k0kubun/sqldef).
## Installation
```ruby
gem 'sqldef'
```## Usage
### DownloadYou can download `mysqldef`, `psqldef`, or `sqlite3def`.
```rb
Sqldef.bin = './bin'
Sqldef.download(:psqldef)
````download` is automatically executed by the following methods too.
### Export
You can export the database schema to a file.
```rb
Sqldef.export(
command: :psqldef,
host: host,
port: port,
user: user,
password: password,
database: database,
path: 'db/schema.sql',
)
```### Dry Run
You can show DDLs to be executed.
```rb
Sqldef.dry_run(
command: :psqldef,
host: host,
port: port,
user: user,
password: password,
database: database,
path: 'db/schema.sql',
)
```### Apply
You can run DDLs to match the schema.
```rb
Sqldef.apply(
command: :psqldef,
host: host,
port: port,
user: user,
password: password,
database: database,
path: 'db/schema.sql',
)
```## License
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).