Skip to content

Commit ac4bdc9

Browse files
committed
tweaking docs
1 parent bb073ca commit ac4bdc9

File tree

1 file changed

+21
-15
lines changed

1 file changed

+21
-15
lines changed

README.md

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,29 @@ npm i sqldef
99
```
1010

1111
```js
12-
import sqldef from sqldef
13-
14-
const output = await (sqldef({
15-
type, // the type of your database ("mysql" or "postgres")
16-
database, // the name of your database
17-
user, // the username of your database
18-
password, // the password of your database
19-
host, // the hostname of your database
20-
port, // the port of your database
21-
socket, // the unix socket (for mysql)
22-
file, // the schema file to read/write
23-
dry: true, // dry run - don't do anything to the database
24-
get: true // get the current definition from database
25-
}))
12+
import sqldef from 'sqldef'
13+
14+
const sql1 = `
15+
CREATE TABLE user (
16+
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
17+
name VARCHAR(128) DEFAULT 'konsumer'
18+
) Engine=InnoDB DEFAULT CHARSET=utf8mb4;
19+
`
20+
21+
const sql2 = `
22+
CREATE TABLE user (
23+
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
24+
name VARCHAR(128) DEFAULT 'konsumer',
25+
created_at DATETIME NOT NULL
26+
) Engine=InnoDB DEFAULT CHARSET=utf8mb4;
27+
`
28+
29+
const output = await sqldef('mysql', sql1, sql2)
2630
```
2731

28-
_TODO_: notes about web
32+
_TODO_: notes about web/bun/deno/etc
33+
_TODO_: make node CLI that can actually perform operations on real database
34+
2935

3036
### development
3137

0 commit comments

Comments
 (0)