pgsqlio 0.2.0 → 0.2.1

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/readme.md +60 -57
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pgsqlio",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Interactive PostgreSQL dump, restore, and cleanup CLI (OpenTUI)",
5
5
  "type": "module",
6
6
  "bin": {
package/readme.md CHANGED
@@ -1,28 +1,37 @@
1
1
  # pgsqlio
2
2
 
3
- Interactive CLI for PostgreSQL dump, restore, cleanup, and dropping databases.
3
+ **Backup and restore PostgreSQL from a terminal menu.**
4
+
5
+ Paste a connection URL. Pick dump, restore, cleanup, or drop. No flags to memorize, no subcommands to look up.
4
6
 
5
7
  ```bash
6
- npx pgsqlio
7
- # or
8
8
  bunx pgsqlio
9
+ # or
10
+ npx pgsqlio
9
11
  ```
10
12
 
11
13
  ![pgsqlio](./assets/cli.png)
12
14
 
13
- Requires [Bun](https://bun.sh) 1.3 (recommended) or Node.js 26.4, plus `pg_dump` and `psql` on your `PATH`.
15
+ You need `pg_dump` and `psql` on your `PATH` (the PostgreSQL client tools), plus [Bun](https://bun.sh) 1.3+ or Node.js 26.4+.
14
16
 
15
17
  ---
16
18
 
17
- ## Quick start
19
+ ## What you can do
18
20
 
19
- ```bash
20
- bunx pgsqlio
21
- ```
21
+ | | |
22
+ | --- | --- |
23
+ | **Dump** | Back up one database or many, into separate files or one combined file |
24
+ | **Restore** | Load a `.sql` backup — wipe first if the target already has tables |
25
+ | **Cleanup** | Empty a database’s `public` schema without dropping the database itself |
26
+ | **Drop** | Pick databases from a list and delete them for good |
22
27
 
23
- You’ll get a terminal UI with sticky branding and a menu. Use ↑/↓ and Enter. Esc goes back. Ctrl+C quits.
28
+ Start `pgsqlio`, then choose from the menu. Arrow keys move, Enter confirms, Esc goes back, Ctrl+C quits.
24
29
 
25
- Connection URLs work with or without a database name:
30
+ ---
31
+
32
+ ## Connection URL
33
+
34
+ Host-only URLs are fine for dump and drop. Cleanup needs a database name on the URL.
26
35
 
27
36
  ```text
28
37
  postgresql://user:password@host:5432
@@ -30,55 +39,49 @@ postgresql://user:password@host:5432/mydb
30
39
  postgresql://postgres@127.0.0.1
31
40
  ```
32
41
 
33
- ---
34
-
35
- ## Commands (interactive menu)
36
-
37
- There are no subcommands — start `pgsqlio` and pick an action.
42
+ If the connection fails, the error stays under the field so you can fix the URL and try again.
38
43
 
39
- ### Dump
44
+ ---
40
45
 
41
- Backup one or more databases.
46
+ ## Dump
42
47
 
43
- 1. Enter connection URL
44
- 2. **All databases** or **Select databases**
45
- 3. If multiple: **Separate files** or **Single file**
46
- 4. Watch per-database progress
48
+ 1. Paste the URL
49
+ 2. Dump **all databases**, or pick from a list
50
+ 3. If you picked more than one: **separate files** or **one combined file**
51
+ 4. Watch each database finish
47
52
 
48
- | Mode | Output |
49
- | -------- | ------------------------------------- |
53
+ | Mode | File you get |
54
+ | --- | --- |
50
55
  | Separate | `backup_<dbname>_YYYYMMDD_HHMMSS.sql` |
51
- | Single | `backup_combined_YYYYMMDD_HHMMSS.sql` |
56
+ | Combined | `backup_combined_YYYYMMDD_HHMMSS.sql` |
52
57
 
53
- Combined files create missing databases on restore and switch with `\connect`. Dumps include `--clean --if-exists`.
58
+ Combined files create missing databases on restore and switch between them with `\connect`. Dumps include `--clean --if-exists`, so restore can replace objects that already exist.
54
59
 
55
60
  ---
56
61
 
57
- ### Restore
58
-
59
- Import a `.sql` backup.
62
+ ## Restore
60
63
 
61
- 1. Enter connection URL
62
- 2. Enter path to the `.sql` file
63
- 3. Choose how to apply:
64
+ 1. Paste the URL
65
+ 2. Enter the path to the `.sql` file
66
+ 3. Choose how to apply it
64
67
 
65
- | Option | When to use |
66
- | ------------------------------ | --------------------------------------------------------- |
67
- | **Wipe schemas, then restore** | Target already has objects / retry after a failed restore |
68
- | **Restore as-is** | Empty databases |
68
+ | Option | Use it when |
69
+ | --- | --- |
70
+ | **Wipe schemas, then restore** | The target already has tables, or a previous restore failed with “already exists” |
71
+ | **Restore as-is** | The databases are empty |
69
72
 
70
- Combined dumps: missing DBs are created automatically, then the file is loaded.
73
+ Combined dumps create any missing databases, then load the file.
71
74
 
72
75
  ---
73
76
 
74
- ### Cleanup
77
+ ## Cleanup
75
78
 
76
- Empty one database’s `public` schema (keeps the database).
79
+ Empties one database’s `public` schema. The database itself stays.
77
80
 
78
- 1. Enter URL **including** `/dbname`
81
+ 1. Paste a URL **with** `/dbname`
79
82
  2. Confirm
80
83
 
81
- Runs:
84
+ This runs:
82
85
 
83
86
  ```sql
84
87
  DROP SCHEMA public CASCADE;
@@ -87,33 +90,33 @@ CREATE SCHEMA public;
87
90
 
88
91
  ---
89
92
 
90
- ### Drop databases
93
+ ## Drop databases
91
94
 
92
- Permanently delete selected databases.
95
+ Permanently deletes the databases you select.
93
96
 
94
- 1. Enter connection URL
95
- 2. Select databases (checkboxes)
97
+ 1. Paste the URL
98
+ 2. Check the databases to drop
96
99
  3. Confirm
97
100
 
98
- Active connections are terminated first. `postgres` and `template*` cannot be dropped.
101
+ Active connections are kicked first so the drop can proceed. `postgres` and `template*` are protected and will not appear in the list.
99
102
 
100
103
  ---
101
104
 
102
105
  ## Keyboard
103
106
 
104
- | Key | Action |
105
- | ------ | ------------------ |
106
- | ↑ / ↓ | Move |
107
- | Enter | Confirm |
108
- | Space | Toggle checkbox |
109
- | a | Select all (lists) |
110
- | Esc | Back |
111
- | Ctrl+C | Quit |
107
+ | Key | Action |
108
+ | --- | --- |
109
+ | ↑ / ↓ | Move |
110
+ | Enter | Confirm |
111
+ | Space | Toggle a checkbox |
112
+ | a | Select all (on lists) |
113
+ | Esc | Back |
114
+ | Ctrl+C | Quit |
112
115
 
113
116
  ---
114
117
 
115
- ## Notes
118
+ ## Good to know
116
119
 
117
- - Use a role with rights to dump, create, and drop as needed.
118
- - Prefer **Wipe schemas, then restore** if you see “already exists” errors.
119
- - Host-only URLs (no `/dbname`) are fine for Dump / Drop; Cleanup needs a specific database in the URL.
120
+ - Use a role that can dump, create, and drop, depending on what you plan to do.
121
+ - Host-only URLs work for dump and drop. Cleanup needs `/dbname` on the URL.
122
+ - Prefer **Wipe schemas, then restore** if restore complains that objects already exist.