pgpm 0.0.1 → 0.1.0
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/LICENSE +23 -0
- package/README.md +111 -116
- package/commands/add.js +7 -7
- package/commands/admin-users/add.js +8 -8
- package/commands/admin-users/bootstrap.js +7 -7
- package/commands/admin-users/remove.js +7 -7
- package/commands/admin-users.js +5 -5
- package/commands/analyze.js +1 -1
- package/commands/clear.js +3 -3
- package/commands/deploy.js +7 -7
- package/commands/export.js +4 -4
- package/commands/extension.js +3 -3
- package/commands/init/index.js +8 -8
- package/commands/install.js +6 -6
- package/commands/kill.js +6 -6
- package/commands/migrate/init.js +1 -1
- package/commands/migrate.js +1 -1
- package/commands/package.js +4 -4
- package/commands/plan.js +5 -5
- package/commands/remove.js +2 -2
- package/commands/rename.js +1 -1
- package/commands/revert.js +7 -7
- package/commands/tag.js +6 -6
- package/commands/verify.js +7 -7
- package/commands.d.ts +1 -0
- package/commands.js +7 -16
- package/esm/commands/add.js +7 -7
- package/esm/commands/admin-users/add.js +8 -8
- package/esm/commands/admin-users/bootstrap.js +7 -7
- package/esm/commands/admin-users/remove.js +7 -7
- package/esm/commands/admin-users.js +5 -5
- package/esm/commands/analyze.js +1 -1
- package/esm/commands/clear.js +3 -3
- package/esm/commands/deploy.js +7 -7
- package/esm/commands/export.js +4 -4
- package/esm/commands/extension.js +3 -3
- package/esm/commands/init/index.js +8 -8
- package/esm/commands/init/workspace.js +1 -1
- package/esm/commands/install.js +6 -6
- package/esm/commands/kill.js +6 -6
- package/esm/commands/migrate/init.js +1 -1
- package/esm/commands/migrate.js +1 -1
- package/esm/commands/package.js +4 -4
- package/esm/commands/plan.js +5 -5
- package/esm/commands/remove.js +2 -2
- package/esm/commands/rename.js +1 -1
- package/esm/commands/revert.js +7 -7
- package/esm/commands/tag.js +6 -6
- package/esm/commands/verify.js +7 -7
- package/esm/commands.js +5 -15
- package/esm/index.js +36 -10
- package/esm/utils/cli-error.js +1 -1
- package/esm/utils/display.js +13 -13
- package/esm/utils/index.js +3 -0
- package/index.d.ts +20 -0
- package/index.js +70 -10
- package/package.json +15 -18
- package/utils/cli-error.js +1 -1
- package/utils/display.d.ts +1 -1
- package/utils/display.js +13 -13
- package/utils/index.d.ts +3 -0
- package/utils/index.js +3 -0
- package/commands/explorer.d.ts +0 -3
- package/commands/explorer.js +0 -94
- package/commands/server.d.ts +0 -3
- package/commands/server.js +0 -187
- package/dist/README.md +0 -416
- package/dist/package.json +0 -77
- package/esm/commands/explorer.js +0 -92
- package/esm/commands/server.js +0 -185
package/LICENSE
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Dan Lynch <pyramation@gmail.com>
|
|
4
|
+
Copyright (c) 2025 Hyperweb <developers@hyperweb.io>
|
|
5
|
+
Copyright (c) 2020-present, Interweb, Inc.
|
|
6
|
+
|
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
in the Software without restriction, including without limitation the rights
|
|
10
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
furnished to do so, subject to the following conditions:
|
|
13
|
+
|
|
14
|
+
The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
copies or substantial portions of the Software.
|
|
16
|
+
|
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,260 +1,254 @@
|
|
|
1
|
-
#
|
|
1
|
+
# pgpm
|
|
2
2
|
|
|
3
|
-
>
|
|
3
|
+
> PostgreSQL Package Manager - Database migration and package management CLI
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
`pgpm` is a focused command-line tool for PostgreSQL database migrations and package management. It provides the core functionality for managing database schemas, migrations, and module dependencies without the overhead of server or explorer components.
|
|
6
6
|
|
|
7
7
|
## ✨ Features
|
|
8
8
|
|
|
9
|
-
- 🚀 **Database-First Development** - Design your database, get your GraphQL API automatically
|
|
10
|
-
- 🔐 **Built-in Security** - Role-based access control and security policies
|
|
11
9
|
- 📦 **Module System** - Reusable database modules with dependency management
|
|
12
10
|
- 🔄 **Smart Migrations** - Automated migration generation and deployment
|
|
13
|
-
- 🛠️ **Developer Experience** - Hot-reload development server with GraphiQL explorer
|
|
14
11
|
- 🏗️ **Production Ready** - Deployment plans, versioning, and rollback support
|
|
12
|
+
- 🚀 **Database-First Development** - Design your database with SQL migrations
|
|
15
13
|
|
|
16
14
|
## 🚀 Quick Start
|
|
17
15
|
|
|
18
16
|
### Installation
|
|
19
17
|
|
|
20
18
|
```bash
|
|
21
|
-
npm install -g
|
|
19
|
+
npm install -g pgpm
|
|
22
20
|
```
|
|
23
21
|
|
|
24
22
|
### Create Your First Project
|
|
25
23
|
|
|
26
24
|
```bash
|
|
27
25
|
# Initialize a new workspace
|
|
28
|
-
|
|
26
|
+
pgpm init --workspace
|
|
29
27
|
cd my-project
|
|
30
28
|
|
|
31
29
|
# Create your first module
|
|
32
|
-
|
|
30
|
+
pgpm init
|
|
33
31
|
|
|
34
32
|
# Deploy to your database
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
# Start the development server
|
|
38
|
-
lql server
|
|
33
|
+
pgpm deploy --createdb
|
|
39
34
|
```
|
|
40
35
|
|
|
41
|
-
Visit `http://localhost:5555` to explore your GraphQL API!
|
|
42
|
-
|
|
43
|
-
## 📖 Core Concepts
|
|
44
|
-
|
|
45
|
-
### Workspaces and Modules
|
|
46
|
-
|
|
47
|
-
- **Workspace**: A collection of related database modules
|
|
48
|
-
- **Module**: A self-contained database package with migrations, functions, and types
|
|
49
|
-
- **Dependencies**: Modules can depend on other modules, creating reusable building blocks
|
|
50
|
-
|
|
51
|
-
### Database-First Workflow
|
|
52
|
-
|
|
53
|
-
1. **Design** your database schema using SQL migrations
|
|
54
|
-
2. **Deploy** changes with `lql deploy`
|
|
55
|
-
3. **Develop** against the auto-generated GraphQL API
|
|
56
|
-
4. **Version** and **package** your modules for distribution
|
|
57
|
-
|
|
58
36
|
## 🛠️ Commands
|
|
59
37
|
|
|
60
38
|
### Getting Started
|
|
61
39
|
|
|
62
|
-
|
|
40
|
+
- `pgpm init` - Initialize a new workspace or module
|
|
41
|
+
- `pgpm init --workspace` - Initialize a new workspace
|
|
63
42
|
|
|
64
|
-
|
|
43
|
+
### Database Operations
|
|
65
44
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
45
|
+
- `pgpm deploy` - Deploy database changes and migrations
|
|
46
|
+
- `pgpm verify` - Verify database state matches expected migrations
|
|
47
|
+
- `pgpm revert` - Safely revert database changes
|
|
69
48
|
|
|
70
|
-
|
|
71
|
-
lql init
|
|
49
|
+
### Migration Management
|
|
72
50
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
51
|
+
- `pgpm migrate` - Comprehensive migration management
|
|
52
|
+
- `pgpm migrate init` - Initialize migration tracking
|
|
53
|
+
- `pgpm migrate status` - Check migration status
|
|
54
|
+
- `pgpm migrate list` - List all changes
|
|
55
|
+
- `pgpm migrate deps` - Show change dependencies
|
|
76
56
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
57
|
+
### Module Management
|
|
58
|
+
|
|
59
|
+
- `pgpm install` - Install database modules as dependencies
|
|
60
|
+
- `pgpm extension` - Interactively manage module dependencies
|
|
61
|
+
- `pgpm tag` - Version your changes with tags
|
|
62
|
+
|
|
63
|
+
### Packaging and Distribution
|
|
81
64
|
|
|
82
|
-
|
|
65
|
+
- `pgpm plan` - Generate deployment plans for your modules
|
|
66
|
+
- `pgpm package` - Package your module for distribution
|
|
83
67
|
|
|
84
|
-
|
|
85
|
-
- `--repo <repo>` - Use templates from GitHub repository (e.g., `owner/repo`)
|
|
86
|
-
- `--template-path <path>` - Use templates from local path
|
|
87
|
-
- `--from-branch <branch>` - Specify branch when using `--repo` (default: `main`)
|
|
68
|
+
### Utilities
|
|
88
69
|
|
|
89
|
-
|
|
70
|
+
- `pgpm add` - Add a new database change
|
|
71
|
+
- `pgpm remove` - Remove a database change
|
|
72
|
+
- `pgpm export` - Export migrations from existing databases
|
|
73
|
+
- `pgpm clear` - Clear database state
|
|
74
|
+
- `pgpm kill` - Clean up database connections
|
|
75
|
+
- `pgpm analyze` - Analyze database structure
|
|
76
|
+
- `pgpm rename` - Rename database changes
|
|
77
|
+
- `pgpm admin-users` - Manage admin users
|
|
90
78
|
|
|
91
|
-
|
|
79
|
+
## 💡 Common Workflows
|
|
92
80
|
|
|
93
|
-
|
|
81
|
+
### Starting a New Project
|
|
94
82
|
|
|
95
83
|
```bash
|
|
96
|
-
#
|
|
97
|
-
|
|
84
|
+
# 1. Create workspace
|
|
85
|
+
pgpm init --workspace
|
|
86
|
+
cd my-app
|
|
98
87
|
|
|
99
|
-
#
|
|
100
|
-
|
|
101
|
-
```
|
|
88
|
+
# 2. Create your first module
|
|
89
|
+
pgpm init
|
|
102
90
|
|
|
103
|
-
|
|
91
|
+
# 3. Add some SQL migrations to sql/ directory
|
|
92
|
+
# 4. Deploy to database
|
|
93
|
+
pgpm deploy --createdb
|
|
94
|
+
```
|
|
104
95
|
|
|
105
|
-
|
|
96
|
+
### Working with Existing Projects
|
|
106
97
|
|
|
107
98
|
```bash
|
|
108
|
-
#
|
|
109
|
-
|
|
99
|
+
# 1. Clone and enter project
|
|
100
|
+
git clone <repo> && cd <project>
|
|
110
101
|
|
|
111
|
-
#
|
|
112
|
-
|
|
102
|
+
# 2. Install dependencies
|
|
103
|
+
pgpm install
|
|
104
|
+
|
|
105
|
+
# 3. Deploy to local database
|
|
106
|
+
pgpm deploy --createdb
|
|
113
107
|
```
|
|
114
108
|
|
|
115
109
|
### Database Operations
|
|
116
110
|
|
|
117
|
-
#### `
|
|
111
|
+
#### `pgpm deploy`
|
|
118
112
|
|
|
119
113
|
Deploy your database changes and migrations.
|
|
120
114
|
|
|
121
115
|
```bash
|
|
122
116
|
# Deploy to selected database
|
|
123
|
-
|
|
117
|
+
pgpm deploy
|
|
124
118
|
|
|
125
119
|
# Create database if it doesn't exist
|
|
126
|
-
|
|
120
|
+
pgpm deploy --createdb
|
|
127
121
|
|
|
128
122
|
# Deploy specific package to a tag
|
|
129
|
-
|
|
123
|
+
pgpm deploy --package mypackage --to @v1.0.0
|
|
130
124
|
|
|
131
125
|
# Fast deployment without transactions
|
|
132
|
-
|
|
126
|
+
pgpm deploy --fast --no-tx
|
|
133
127
|
```
|
|
134
128
|
|
|
135
|
-
#### `
|
|
129
|
+
#### `pgpm verify`
|
|
136
130
|
|
|
137
131
|
Verify your database state matches expected migrations.
|
|
138
132
|
|
|
139
133
|
```bash
|
|
140
134
|
# Verify current state
|
|
141
|
-
|
|
135
|
+
pgpm verify
|
|
142
136
|
|
|
143
137
|
# Verify specific package
|
|
144
|
-
|
|
138
|
+
pgpm verify --package mypackage
|
|
145
139
|
```
|
|
146
140
|
|
|
147
|
-
#### `
|
|
141
|
+
#### `pgpm revert`
|
|
148
142
|
|
|
149
143
|
Safely revert database changes.
|
|
150
144
|
|
|
151
145
|
```bash
|
|
152
146
|
# Revert latest changes
|
|
153
|
-
|
|
147
|
+
pgpm revert
|
|
154
148
|
|
|
155
149
|
# Revert to specific tag
|
|
156
|
-
|
|
150
|
+
pgpm revert --to @v1.0.0
|
|
157
151
|
```
|
|
158
152
|
|
|
159
153
|
### Migration Management
|
|
160
154
|
|
|
161
|
-
#### `
|
|
155
|
+
#### `pgpm migrate`
|
|
162
156
|
|
|
163
157
|
Comprehensive migration management.
|
|
164
158
|
|
|
165
159
|
```bash
|
|
166
160
|
# Initialize migration tracking
|
|
167
|
-
|
|
161
|
+
pgpm migrate init
|
|
168
162
|
|
|
169
163
|
# Check migration status
|
|
170
|
-
|
|
164
|
+
pgpm migrate status
|
|
171
165
|
|
|
172
166
|
# List all changes
|
|
173
|
-
|
|
167
|
+
pgpm migrate list
|
|
174
168
|
|
|
175
169
|
# Show change dependencies
|
|
176
|
-
|
|
170
|
+
pgpm migrate deps
|
|
177
171
|
```
|
|
178
172
|
|
|
179
173
|
### Module Management
|
|
180
174
|
|
|
181
|
-
#### `
|
|
175
|
+
#### `pgpm install`
|
|
182
176
|
|
|
183
177
|
Install LaunchQL modules as dependencies.
|
|
184
178
|
|
|
185
179
|
```bash
|
|
186
180
|
# Install single package
|
|
187
|
-
|
|
181
|
+
pgpm install @launchql/auth
|
|
188
182
|
|
|
189
183
|
# Install multiple packages
|
|
190
|
-
|
|
184
|
+
pgpm install @launchql/auth @launchql/utils
|
|
191
185
|
```
|
|
192
186
|
|
|
193
|
-
#### `
|
|
187
|
+
#### `pgpm extension`
|
|
194
188
|
|
|
195
189
|
Interactively manage module dependencies.
|
|
196
190
|
|
|
197
191
|
```bash
|
|
198
|
-
|
|
192
|
+
pgpm extension
|
|
199
193
|
```
|
|
200
194
|
|
|
201
|
-
#### `
|
|
195
|
+
#### `pgpm tag`
|
|
202
196
|
|
|
203
197
|
Version your changes with tags.
|
|
204
198
|
|
|
205
199
|
```bash
|
|
206
200
|
# Tag latest change
|
|
207
|
-
|
|
201
|
+
pgpm tag v1.0.0
|
|
208
202
|
|
|
209
203
|
# Tag with comment
|
|
210
|
-
|
|
204
|
+
pgpm tag v1.0.0 --comment "Initial release"
|
|
211
205
|
|
|
212
206
|
# Tag specific change
|
|
213
|
-
|
|
207
|
+
pgpm tag v1.1.0 --package mypackage --changeName my-change
|
|
214
208
|
```
|
|
215
209
|
|
|
216
210
|
### Packaging and Distribution
|
|
217
211
|
|
|
218
|
-
#### `
|
|
212
|
+
#### `pgpm plan`
|
|
219
213
|
|
|
220
214
|
Generate deployment plans for your modules.
|
|
221
215
|
|
|
222
216
|
```bash
|
|
223
|
-
|
|
217
|
+
pgpm plan
|
|
224
218
|
```
|
|
225
219
|
|
|
226
|
-
#### `
|
|
220
|
+
#### `pgpm package`
|
|
227
221
|
|
|
228
222
|
Package your module for distribution.
|
|
229
223
|
|
|
230
224
|
```bash
|
|
231
225
|
# Package with defaults
|
|
232
|
-
|
|
226
|
+
pgpm package
|
|
233
227
|
|
|
234
228
|
# Package without deployment plan
|
|
235
|
-
|
|
229
|
+
pgpm package --no-plan
|
|
236
230
|
```
|
|
237
231
|
|
|
238
232
|
### Utilities
|
|
239
233
|
|
|
240
|
-
#### `
|
|
234
|
+
#### `pgpm export`
|
|
241
235
|
|
|
242
236
|
Export migrations from existing databases.
|
|
243
237
|
|
|
244
238
|
```bash
|
|
245
|
-
|
|
239
|
+
pgpm export
|
|
246
240
|
```
|
|
247
241
|
|
|
248
|
-
#### `
|
|
242
|
+
#### `pgpm kill`
|
|
249
243
|
|
|
250
244
|
Clean up database connections and optionally drop databases.
|
|
251
245
|
|
|
252
246
|
```bash
|
|
253
247
|
# Kill connections and drop databases
|
|
254
|
-
|
|
248
|
+
pgpm kill
|
|
255
249
|
|
|
256
250
|
# Only kill connections
|
|
257
|
-
|
|
251
|
+
pgpm kill --no-drop
|
|
258
252
|
```
|
|
259
253
|
|
|
260
254
|
## 💡 Common Workflows
|
|
@@ -264,17 +258,17 @@ lql kill --no-drop
|
|
|
264
258
|
```bash
|
|
265
259
|
# 1. Create workspace
|
|
266
260
|
mkdir my-app && cd my-app
|
|
267
|
-
|
|
261
|
+
pgpm init --workspace
|
|
268
262
|
|
|
269
263
|
# 2. Create your first module
|
|
270
|
-
|
|
264
|
+
pgpm init
|
|
271
265
|
|
|
272
266
|
# 3. Add some SQL migrations to sql/ directory
|
|
273
267
|
# 4. Deploy to database
|
|
274
|
-
|
|
268
|
+
pgpm deploy --createdb
|
|
275
269
|
|
|
276
270
|
# 5. Start developing
|
|
277
|
-
|
|
271
|
+
pgpm server
|
|
278
272
|
```
|
|
279
273
|
|
|
280
274
|
### Using Custom Templates
|
|
@@ -283,16 +277,16 @@ You can use custom templates from GitHub repositories or local paths:
|
|
|
283
277
|
|
|
284
278
|
```bash
|
|
285
279
|
# Initialize workspace with templates from GitHub
|
|
286
|
-
|
|
280
|
+
pgpm init --workspace --repo owner/repo
|
|
287
281
|
|
|
288
282
|
# Initialize workspace with templates from local path
|
|
289
|
-
|
|
283
|
+
pgpm init --workspace --template-path ./my-custom-templates
|
|
290
284
|
|
|
291
285
|
# Initialize module with custom templates
|
|
292
|
-
|
|
286
|
+
pgpm init --template-path ./my-custom-templates
|
|
293
287
|
|
|
294
288
|
# Use specific branch from GitHub repository
|
|
295
|
-
|
|
289
|
+
pgpm init --workspace --repo owner/repo --from-branch develop
|
|
296
290
|
```
|
|
297
291
|
|
|
298
292
|
**Template Structure:**
|
|
@@ -309,29 +303,29 @@ Custom templates should follow the same structure as the default templates:
|
|
|
309
303
|
git clone <repo> && cd <project>
|
|
310
304
|
|
|
311
305
|
# 2. Install dependencies
|
|
312
|
-
|
|
306
|
+
pgpm install
|
|
313
307
|
|
|
314
308
|
# 3. Deploy to local database
|
|
315
|
-
|
|
309
|
+
pgpm deploy --createdb
|
|
316
310
|
|
|
317
311
|
# 4. Start development server
|
|
318
|
-
|
|
312
|
+
pgpm server
|
|
319
313
|
```
|
|
320
314
|
|
|
321
315
|
### Production Deployment
|
|
322
316
|
|
|
323
317
|
```bash
|
|
324
318
|
# 1. Create deployment plan
|
|
325
|
-
|
|
319
|
+
pgpm plan
|
|
326
320
|
|
|
327
321
|
# 2. Package module
|
|
328
|
-
|
|
322
|
+
pgpm package
|
|
329
323
|
|
|
330
324
|
# 3. Deploy to production
|
|
331
|
-
|
|
325
|
+
pgpm deploy --package myapp --to @production
|
|
332
326
|
|
|
333
327
|
# 4. Verify deployment
|
|
334
|
-
|
|
328
|
+
pgpm verify --package myapp
|
|
335
329
|
```
|
|
336
330
|
|
|
337
331
|
## ⚙️ Configuration
|
|
@@ -354,11 +348,11 @@ export PGPASSWORD=password
|
|
|
354
348
|
|
|
355
349
|
```bash
|
|
356
350
|
# Global help
|
|
357
|
-
|
|
351
|
+
pgpm --help
|
|
358
352
|
|
|
359
353
|
# Command-specific help
|
|
360
|
-
|
|
361
|
-
|
|
354
|
+
pgpm deploy --help
|
|
355
|
+
pgpm server -h
|
|
362
356
|
```
|
|
363
357
|
|
|
364
358
|
### Common Options
|
|
@@ -404,6 +398,7 @@ Most commands support these global options:
|
|
|
404
398
|
|
|
405
399
|
### 🧰 CLI & Codegen
|
|
406
400
|
|
|
401
|
+
* [pgpm](https://github.com/launchql/launchql/tree/main/packages/pgpm): **🖥️ PostgreSQL Package Manager** for modular Postgres development. Works with database workspaces, scaffolding, migrations, seeding, and installing database packages.
|
|
407
402
|
* [@launchql/cli](https://github.com/launchql/launchql/tree/main/packages/cli): **🖥️ Command-line toolkit** for managing LaunchQL projects—supports database scaffolding, migrations, seeding, code generation, and automation.
|
|
408
403
|
* [launchql/launchql-gen](https://github.com/launchql/launchql/tree/main/packages/launchql-gen): **✨ Auto-generated GraphQL** mutations and queries dynamically built from introspected schema data.
|
|
409
404
|
* [@launchql/query-builder](https://github.com/launchql/launchql/tree/main/packages/query-builder): **🏗️ SQL constructor** providing a robust TypeScript-based query builder for dynamic generation of `SELECT`, `INSERT`, `UPDATE`, `DELETE`, and stored procedure calls—supports advanced SQL features like `JOIN`, `GROUP BY`, and schema-qualified queries.
|
package/commands/add.js
CHANGED
|
@@ -34,12 +34,12 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
const core_1 = require("@launchql/core");
|
|
37
|
-
const argv_1 = require("../utils/argv");
|
|
38
37
|
const path = __importStar(require("path"));
|
|
38
|
+
const argv_1 = require("../utils/argv");
|
|
39
39
|
const addUsageText = `
|
|
40
|
-
|
|
40
|
+
Add Command:
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
pgpm add [change] [OPTIONS]
|
|
43
43
|
|
|
44
44
|
Add a database change to plans and create deploy/revert/verify SQL files.
|
|
45
45
|
|
|
@@ -53,10 +53,10 @@ Options:
|
|
|
53
53
|
--cwd <directory> Working directory (default: current directory)
|
|
54
54
|
|
|
55
55
|
Examples:
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
56
|
+
pgpm add organizations Add change named 'organizations'
|
|
57
|
+
pgpm add brands --note "Adds the brands table" Add change with note
|
|
58
|
+
pgpm add contacts --requires users --note "Adds contacts table" Add with dependency
|
|
59
|
+
pgpm add be/a/path/like/this Add change with nested path
|
|
60
60
|
`;
|
|
61
61
|
exports.default = async (argv, prompter, _options) => {
|
|
62
62
|
// Show usage if explicitly requested
|
|
@@ -5,12 +5,12 @@ const logger_1 = require("@launchql/logger");
|
|
|
5
5
|
const pg_env_1 = require("pg-env");
|
|
6
6
|
const log = new logger_1.Logger('admin-users-add');
|
|
7
7
|
const addUsageText = `
|
|
8
|
-
|
|
8
|
+
Admin Users Add Command:
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
pgpm admin-users add [OPTIONS]
|
|
11
11
|
|
|
12
|
-
Add database users with
|
|
13
|
-
Note: You must run '
|
|
12
|
+
Add database users with postgres roles.
|
|
13
|
+
Note: You must run 'pgpm admin-users bootstrap' first to initialize roles.
|
|
14
14
|
|
|
15
15
|
Options:
|
|
16
16
|
--help, -h Show this help message
|
|
@@ -20,9 +20,9 @@ Options:
|
|
|
20
20
|
--cwd <directory> Working directory (default: current directory)
|
|
21
21
|
|
|
22
22
|
Examples:
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
pgpm admin-users add --username myuser --password mypass
|
|
24
|
+
pgpm admin-users add --test # Add test users (requires bootstrap first)
|
|
25
|
+
pgpm admin-users add # Will prompt for username and password
|
|
26
26
|
`;
|
|
27
27
|
exports.default = async (argv, prompter, _options) => {
|
|
28
28
|
// Show usage if explicitly requested
|
|
@@ -39,7 +39,7 @@ exports.default = async (argv, prompter, _options) => {
|
|
|
39
39
|
{
|
|
40
40
|
type: 'confirm',
|
|
41
41
|
name: 'yes',
|
|
42
|
-
message: 'Are you sure you want to add
|
|
42
|
+
message: 'Are you sure you want to add test users? (WARNING: Should NEVER be run on production!)',
|
|
43
43
|
default: false
|
|
44
44
|
}
|
|
45
45
|
]);
|
|
@@ -5,19 +5,19 @@ const logger_1 = require("@launchql/logger");
|
|
|
5
5
|
const pg_env_1 = require("pg-env");
|
|
6
6
|
const log = new logger_1.Logger('admin-users-bootstrap');
|
|
7
7
|
const bootstrapUsageText = `
|
|
8
|
-
|
|
8
|
+
Admin Users Bootstrap Command:
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
pgpm admin-users bootstrap [OPTIONS]
|
|
11
11
|
|
|
12
|
-
Initialize
|
|
13
|
-
Creates the standard
|
|
12
|
+
Initialize postgres roles and permissions. This command must be run before adding users.
|
|
13
|
+
Creates the standard postgres roles: anonymous, authenticated, administrator.
|
|
14
14
|
|
|
15
15
|
Options:
|
|
16
16
|
--help, -h Show this help message
|
|
17
17
|
--cwd <directory> Working directory (default: current directory)
|
|
18
18
|
|
|
19
19
|
Examples:
|
|
20
|
-
|
|
20
|
+
pgpm admin-users bootstrap # Initialize postgres roles
|
|
21
21
|
`;
|
|
22
22
|
exports.default = async (argv, prompter, _options) => {
|
|
23
23
|
// Show usage if explicitly requested
|
|
@@ -30,7 +30,7 @@ exports.default = async (argv, prompter, _options) => {
|
|
|
30
30
|
{
|
|
31
31
|
type: 'confirm',
|
|
32
32
|
name: 'yes',
|
|
33
|
-
message: 'Are you sure you want to initialize
|
|
33
|
+
message: 'Are you sure you want to initialize postgres roles and permissions?',
|
|
34
34
|
default: false
|
|
35
35
|
}
|
|
36
36
|
]);
|
|
@@ -41,7 +41,7 @@ exports.default = async (argv, prompter, _options) => {
|
|
|
41
41
|
const init = new core_1.LaunchQLInit(pgEnv);
|
|
42
42
|
try {
|
|
43
43
|
await init.bootstrapRoles();
|
|
44
|
-
log.success('
|
|
44
|
+
log.success('postgres roles and permissions initialized successfully.');
|
|
45
45
|
}
|
|
46
46
|
finally {
|
|
47
47
|
await init.close();
|
|
@@ -5,11 +5,11 @@ const logger_1 = require("@launchql/logger");
|
|
|
5
5
|
const pg_env_1 = require("pg-env");
|
|
6
6
|
const log = new logger_1.Logger('admin-users-remove');
|
|
7
7
|
const removeUsageText = `
|
|
8
|
-
|
|
8
|
+
Admin Users Remove Command:
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
pgpm admin-users remove [OPTIONS]
|
|
11
11
|
|
|
12
|
-
Remove database users and revoke their
|
|
12
|
+
Remove database users and revoke their postgres roles.
|
|
13
13
|
|
|
14
14
|
Options:
|
|
15
15
|
--help, -h Show this help message
|
|
@@ -18,9 +18,9 @@ Options:
|
|
|
18
18
|
--cwd <directory> Working directory (default: current directory)
|
|
19
19
|
|
|
20
20
|
Examples:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
pgpm admin-users remove --username myuser
|
|
22
|
+
pgpm admin-users remove --test # Remove test users
|
|
23
|
+
pgpm admin-users remove # Will prompt for username
|
|
24
24
|
`;
|
|
25
25
|
exports.default = async (argv, prompter, _options) => {
|
|
26
26
|
// Show usage if explicitly requested
|
|
@@ -37,7 +37,7 @@ exports.default = async (argv, prompter, _options) => {
|
|
|
37
37
|
{
|
|
38
38
|
type: 'confirm',
|
|
39
39
|
name: 'yes',
|
|
40
|
-
message: 'Are you sure you want to remove
|
|
40
|
+
message: 'Are you sure you want to remove test users (app_user, app_admin)?',
|
|
41
41
|
default: false
|
|
42
42
|
}
|
|
43
43
|
]);
|
package/commands/admin-users.js
CHANGED
|
@@ -13,11 +13,11 @@ const subcommandMap = {
|
|
|
13
13
|
remove: remove_1.default
|
|
14
14
|
};
|
|
15
15
|
const adminUsersUsageText = `
|
|
16
|
-
|
|
16
|
+
Admin Users Commands:
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
pgpm admin-users bootstrap Initialize postgres roles and permissions (must be run first)
|
|
19
|
+
pgpm admin-users add Add database users with roles
|
|
20
|
+
pgpm admin-users remove Remove database users and revoke roles
|
|
21
21
|
|
|
22
22
|
Options:
|
|
23
23
|
--help, -h Show this help message
|
|
@@ -60,7 +60,7 @@ exports.default = async (argv, prompter, options) => {
|
|
|
60
60
|
};
|
|
61
61
|
function getSubcommandDescription(cmd) {
|
|
62
62
|
const descriptions = {
|
|
63
|
-
bootstrap: 'Initialize
|
|
63
|
+
bootstrap: 'Initialize postgres roles and permissions (must be run first)',
|
|
64
64
|
add: 'Add database users with roles',
|
|
65
65
|
remove: 'Remove database users and revoke roles'
|
|
66
66
|
};
|
package/commands/analyze.js
CHANGED
|
@@ -3,8 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const path_1 = __importDefault(require("path"));
|
|
7
6
|
const core_1 = require("@launchql/core");
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
8
|
exports.default = async (argv, _prompter) => {
|
|
9
9
|
const cwd = argv.cwd || process.cwd();
|
|
10
10
|
const proj = new core_1.LaunchQLPackage(path_1.default.resolve(cwd));
|