dbctx 1.4.5 → 1.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -50
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,63 +17,19 @@ dbctx connects to your PostgreSQL database, introspects the entire schema, and g
|
|
|
17
17
|
## Quick Start
|
|
18
18
|
|
|
19
19
|
```sh
|
|
20
|
-
npx dbctx postgres://user:password@localhost:5432/mydb
|
|
20
|
+
npx dbctx@latest postgres://user:password@localhost:5432/mydb
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
That's it. dbctx connects, introspects, and writes a `DB.md` to your working directory.
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
Running against a database produces a `DB.md` like this:
|
|
28
|
-
|
|
29
|
-
```md
|
|
30
|
-
# mydb
|
|
31
|
-
|
|
32
|
-
PostgreSQL 16.2 — system identifier `7312456789012345678`
|
|
33
|
-
|
|
34
|
-
## Tables
|
|
35
|
-
|
|
36
|
-
### users
|
|
37
|
-
|
|
38
|
-
| Column | Type | Nullable | Default |
|
|
39
|
-
|--------------|--------------------------|----------|----------------------|
|
|
40
|
-
| id | uuid | NO | gen_random_uuid() |
|
|
41
|
-
| email | character varying(255) | NO | |
|
|
42
|
-
| display_name | text | YES | |
|
|
43
|
-
| created_at | timestamp with time zone | NO | now() |
|
|
44
|
-
|
|
45
|
-
**Indexes**
|
|
46
|
-
- `users_pkey` PRIMARY KEY (id)
|
|
47
|
-
- `users_email_key` UNIQUE (email)
|
|
48
|
-
|
|
49
|
-
### orders
|
|
50
|
-
|
|
51
|
-
| Column | Type | Nullable | Default |
|
|
52
|
-
|---------|--------------------------|----------|-------------------|
|
|
53
|
-
| id | uuid | NO | gen_random_uuid() |
|
|
54
|
-
| user_id | uuid | NO | |
|
|
55
|
-
| status | order_status | NO | 'pending' |
|
|
56
|
-
| total | numeric(10,2) | NO | |
|
|
57
|
-
|
|
58
|
-
**Indexes**
|
|
59
|
-
- `orders_pkey` PRIMARY KEY (id)
|
|
60
|
-
- `orders_user_id_idx` (user_id)
|
|
61
|
-
|
|
62
|
-
**References**
|
|
63
|
-
- `orders_user_id_fkey` (user_id) → users (id) ON DELETE CASCADE
|
|
64
|
-
|
|
65
|
-
## Enums
|
|
66
|
-
|
|
67
|
-
### order_status
|
|
68
|
-
`pending`, `confirmed`, `shipped`, `delivered`, `cancelled`
|
|
69
|
-
```
|
|
25
|
+
`pnpx dbctx@latest` and `bunx dbctx@latest` work too.
|
|
70
26
|
|
|
71
27
|
## Connection
|
|
72
28
|
|
|
73
29
|
### Connection String
|
|
74
30
|
|
|
75
31
|
```sh
|
|
76
|
-
npx dbctx postgres://user:password@host:5432/dbname
|
|
32
|
+
npx dbctx@latest postgres://user:password@host:5432/dbname
|
|
77
33
|
```
|
|
78
34
|
|
|
79
35
|
### Environment Variables
|
|
@@ -82,7 +38,7 @@ dbctx reads standard PostgreSQL environment variables:
|
|
|
82
38
|
|
|
83
39
|
```sh
|
|
84
40
|
export DATABASE_URL=postgres://user:password@host:5432/dbname
|
|
85
|
-
npx dbctx
|
|
41
|
+
npx dbctx@latest
|
|
86
42
|
```
|
|
87
43
|
|
|
88
44
|
Or use individual variables:
|
|
@@ -93,7 +49,7 @@ export PGPORT=5432
|
|
|
93
49
|
export PGDATABASE=mydb
|
|
94
50
|
export PGUSER=postgres
|
|
95
51
|
export PGPASSWORD=secret
|
|
96
|
-
npx dbctx
|
|
52
|
+
npx dbctx@latest
|
|
97
53
|
```
|
|
98
54
|
|
|
99
55
|
### CLI Flags
|
|
@@ -112,7 +68,7 @@ If no password is provided, dbctx prompts interactively in the terminal.
|
|
|
112
68
|
Connect through a bastion or jump server:
|
|
113
69
|
|
|
114
70
|
```sh
|
|
115
|
-
npx dbctx --ssh user@bastion.example.com postgres://localhost:5432/mydb
|
|
71
|
+
npx dbctx@latest --ssh user@bastion.example.com postgres://localhost:5432/mydb
|
|
116
72
|
```
|
|
117
73
|
|
|
118
74
|
dbctx opens an SSH tunnel and forwards the database connection through it. Your `~/.ssh/config` is automatically parsed for host aliases, key paths, and ports.
|