Skip to content

Commit ec21036

Browse files
committed
Update README.md
1 parent c9a94d1 commit ec21036

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

README.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,66 @@ Ruby interface to call [sqldef](https://github.com/k0kubun/sqldef).
88
gem 'sqldef'
99
```
1010

11+
## Usage
12+
### Download
13+
14+
You can download `mysqldef`, `psqldef`, or `sqlite3def`.
15+
16+
```rb
17+
Sqldef.bin = './bin'
18+
Sqldef.download(:psqldef)
19+
```
20+
21+
`download` is automatically executed by following methods too.
22+
23+
### Export
24+
25+
You can export the database schema to a file.
26+
27+
```rb
28+
Sqldef.export(
29+
command: :psqldef,
30+
host: host,
31+
port: port,
32+
user: user,
33+
password: password,
34+
database: database,
35+
path: 'db/schema.sql',
36+
)
37+
```
38+
39+
### Dry Run
40+
41+
You can show DDLs to be executed.
42+
43+
```rb
44+
Sqldef.dry_run(
45+
command: :psqldef,
46+
host: host,
47+
port: port,
48+
user: user,
49+
password: password,
50+
database: database,
51+
path: 'db/schema.sql',
52+
)
53+
```
54+
55+
### Apply
56+
57+
You can run DDLs to match the schema.
58+
59+
```rb
60+
Sqldef.apply(
61+
command: :psqldef,
62+
host: host,
63+
port: port,
64+
user: user,
65+
password: password,
66+
database: database,
67+
path: 'db/schema.sql',
68+
)
69+
```
70+
1171
## License
1272

1373
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).

0 commit comments

Comments
 (0)