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.
- package/package.json +1 -1
- package/readme.md +60 -57
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -1,28 +1,37 @@
|
|
|
1
1
|
# pgsqlio
|
|
2
2
|
|
|
3
|
-
|
|
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
|

|
|
12
14
|
|
|
13
|
-
|
|
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
|
-
##
|
|
19
|
+
## What you can do
|
|
18
20
|
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
|
|
28
|
+
Start `pgsqlio`, then choose from the menu. Arrow keys move, Enter confirms, Esc goes back, Ctrl+C quits.
|
|
24
29
|
|
|
25
|
-
|
|
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
|
-
|
|
44
|
+
---
|
|
40
45
|
|
|
41
|
-
|
|
46
|
+
## Dump
|
|
42
47
|
|
|
43
|
-
1.
|
|
44
|
-
2. **
|
|
45
|
-
3. If
|
|
46
|
-
4. Watch
|
|
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
|
|
49
|
-
|
|
|
53
|
+
| Mode | File you get |
|
|
54
|
+
| --- | --- |
|
|
50
55
|
| Separate | `backup_<dbname>_YYYYMMDD_HHMMSS.sql` |
|
|
51
|
-
|
|
|
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
|
-
|
|
58
|
-
|
|
59
|
-
Import a `.sql` backup.
|
|
62
|
+
## Restore
|
|
60
63
|
|
|
61
|
-
1.
|
|
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
|
|
66
|
-
|
|
|
67
|
-
| **Wipe schemas, then restore** |
|
|
68
|
-
| **Restore as-is**
|
|
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
|
|
73
|
+
Combined dumps create any missing databases, then load the file.
|
|
71
74
|
|
|
72
75
|
---
|
|
73
76
|
|
|
74
|
-
|
|
77
|
+
## Cleanup
|
|
75
78
|
|
|
76
|
-
|
|
79
|
+
Empties one database’s `public` schema. The database itself stays.
|
|
77
80
|
|
|
78
|
-
1.
|
|
81
|
+
1. Paste a URL **with** `/dbname`
|
|
79
82
|
2. Confirm
|
|
80
83
|
|
|
81
|
-
|
|
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
|
-
|
|
93
|
+
## Drop databases
|
|
91
94
|
|
|
92
|
-
Permanently
|
|
95
|
+
Permanently deletes the databases you select.
|
|
93
96
|
|
|
94
|
-
1.
|
|
95
|
-
2.
|
|
97
|
+
1. Paste the URL
|
|
98
|
+
2. Check the databases to drop
|
|
96
99
|
3. Confirm
|
|
97
100
|
|
|
98
|
-
Active connections are
|
|
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
|
|
105
|
-
|
|
|
106
|
-
| ↑ / ↓
|
|
107
|
-
| Enter
|
|
108
|
-
| Space
|
|
109
|
-
| a
|
|
110
|
-
| Esc
|
|
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
|
-
##
|
|
118
|
+
## Good to know
|
|
116
119
|
|
|
117
|
-
- Use a role
|
|
118
|
-
-
|
|
119
|
-
-
|
|
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.
|