@saltcorn/cli 0.7.2-beta.5 → 0.7.2-beta.9

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 CHANGED
@@ -20,7 +20,7 @@ $ npm install -g @saltcorn/cli
20
20
  $ saltcorn COMMAND
21
21
  running command...
22
22
  $ saltcorn (-v|--version|version)
23
- @saltcorn/cli/0.7.2-beta.5 linux-x64 node-v14.19.2
23
+ @saltcorn/cli/0.7.2-beta.9 darwin-arm64 node-v16.15.1
24
24
  $ saltcorn --help [COMMAND]
25
25
  USAGE
26
26
  $ saltcorn COMMAND
@@ -33,11 +33,11 @@ USAGE
33
33
  <!-- commands -->
34
34
  * [`saltcorn add-schema`](#saltcorn-add-schema)
35
35
  * [`saltcorn backup`](#saltcorn-backup)
36
- * [`saltcorn build-app`](#saltcorn-build-app)
37
36
  * [`saltcorn configuration-check`](#saltcorn-configuration-check)
38
37
  * [`saltcorn create-tenant TENANT`](#saltcorn-create-tenant-tenant)
39
38
  * [`saltcorn create-user`](#saltcorn-create-user)
40
39
  * [`saltcorn delete-tenants`](#saltcorn-delete-tenants)
40
+ * [`saltcorn delete-user USER_EMAIL`](#saltcorn-delete-user-user_email)
41
41
  * [`saltcorn fixtures`](#saltcorn-fixtures)
42
42
  * [`saltcorn get-cfg KEY`](#saltcorn-get-cfg-key)
43
43
  * [`saltcorn help [COMMAND]`](#saltcorn-help-command)
@@ -48,6 +48,7 @@ USAGE
48
48
  * [`saltcorn localize-plugin PLUGIN PATH`](#saltcorn-localize-plugin-plugin-path)
49
49
  * [`saltcorn make-migration`](#saltcorn-make-migration)
50
50
  * [`saltcorn saltcorn migrate`](#saltcorn-saltcorn-migrate)
51
+ * [`saltcorn modify-user USER_EMAIL`](#saltcorn-modify-user-user_email)
51
52
  * [`saltcorn plugins`](#saltcorn-plugins)
52
53
  * [`saltcorn plugins:inspect PLUGIN...`](#saltcorn-pluginsinspect-plugin)
53
54
  * [`saltcorn plugins:install PLUGIN...`](#saltcorn-pluginsinstall-plugin)
@@ -57,7 +58,7 @@ USAGE
57
58
  * [`saltcorn release VERSION`](#saltcorn-release-version)
58
59
  * [`saltcorn reset-schema`](#saltcorn-reset-schema)
59
60
  * [`saltcorn restore FILE`](#saltcorn-restore-file)
60
- * [`saltcorn rm-tenant TENANT`](#saltcorn-rm-tenant-tenant)
61
+ * [`saltcorn rm-tenant`](#saltcorn-rm-tenant)
61
62
  * [`saltcorn run-benchmark [BASEURL]`](#saltcorn-run-benchmark-baseurl)
62
63
  * [`saltcorn run-tests [PACKAGE]`](#saltcorn-run-tests-package)
63
64
  * [`saltcorn scheduler`](#saltcorn-scheduler)
@@ -75,9 +76,12 @@ Add Saltcorn schema to existing database
75
76
  ```
76
77
  USAGE
77
78
  $ saltcorn add-schema
79
+
80
+ OPTIONS
81
+ -f, --force force command execution
78
82
  ```
79
83
 
80
- _See code: [src/commands/add-schema.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.5/src/commands/add-schema.js)_
84
+ _See code: [src/commands/add-schema.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.9/src/commands/add-schema.js)_
81
85
 
82
86
  ## `saltcorn backup`
83
87
 
@@ -93,23 +97,7 @@ OPTIONS
93
97
  -z, --zip zip format
94
98
  ```
95
99
 
96
- _See code: [src/commands/backup.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.5/src/commands/backup.js)_
97
-
98
- ## `saltcorn build-app`
99
-
100
- build mobile app from tenant
101
-
102
- ```
103
- USAGE
104
- $ saltcorn build-app
105
-
106
- OPTIONS
107
- -l, --localUserTables=localUserTables user defined tables that should be replicated into the app
108
- -p, --platforms=platforms Platforms to build for space separated list
109
- -v, --entryPoint=entryPoint Entry Point
110
- ```
111
-
112
- _See code: [@saltcorn/mobile-builder](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.5/dist/commands/build-app.js)_
100
+ _See code: [src/commands/backup.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.9/src/commands/backup.js)_
113
101
 
114
102
  ## `saltcorn configuration-check`
115
103
 
@@ -123,7 +111,7 @@ OPTIONS
123
111
  -t, --tenant=tenant tenant
124
112
  ```
125
113
 
126
- _See code: [src/commands/configuration-check.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.5/src/commands/configuration-check.js)_
114
+ _See code: [src/commands/configuration-check.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.9/src/commands/configuration-check.js)_
127
115
 
128
116
  ## `saltcorn create-tenant TENANT`
129
117
 
@@ -141,7 +129,7 @@ OPTIONS
141
129
  -e, --email=email Email of owner of tenant
142
130
  ```
143
131
 
144
- _See code: [src/commands/create-tenant.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.5/src/commands/create-tenant.js)_
132
+ _See code: [src/commands/create-tenant.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.9/src/commands/create-tenant.js)_
145
133
 
146
134
  ## `saltcorn create-user`
147
135
 
@@ -159,7 +147,7 @@ OPTIONS
159
147
  -t, --tenant=tenant tenant
160
148
  ```
161
149
 
162
- _See code: [src/commands/create-user.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.5/src/commands/create-user.js)_
150
+ _See code: [src/commands/create-user.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.9/src/commands/create-user.js)_
163
151
 
164
152
  ## `saltcorn delete-tenants`
165
153
 
@@ -170,7 +158,28 @@ USAGE
170
158
  $ saltcorn delete-tenants
171
159
  ```
172
160
 
173
- _See code: [src/commands/delete-tenants.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.5/src/commands/delete-tenants.js)_
161
+ _See code: [src/commands/delete-tenants.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.9/src/commands/delete-tenants.js)_
162
+
163
+ ## `saltcorn delete-user USER_EMAIL`
164
+
165
+ Delete user.
166
+
167
+ ```
168
+ USAGE
169
+ $ saltcorn delete-user USER_EMAIL
170
+
171
+ ARGUMENTS
172
+ USER_EMAIL User to delete
173
+
174
+ OPTIONS
175
+ -f, --force force command execution
176
+ -t, --tenant=tenant tenant
177
+
178
+ DESCRIPTION
179
+ Command deletes the user specified by USER_EMAIL.
180
+ ```
181
+
182
+ _See code: [src/commands/delete-user.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.9/src/commands/delete-user.js)_
174
183
 
175
184
  ## `saltcorn fixtures`
176
185
 
@@ -189,7 +198,7 @@ DESCRIPTION
189
198
  This manual step it is never required for users and rarely required for developers
190
199
  ```
191
200
 
192
- _See code: [src/commands/fixtures.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.5/src/commands/fixtures.js)_
201
+ _See code: [src/commands/fixtures.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.9/src/commands/fixtures.js)_
193
202
 
194
203
  ## `saltcorn get-cfg KEY`
195
204
 
@@ -207,7 +216,7 @@ OPTIONS
207
216
  -t, --tenant=tenant tenant
208
217
  ```
209
218
 
210
- _See code: [src/commands/get-cfg.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.5/src/commands/get-cfg.js)_
219
+ _See code: [src/commands/get-cfg.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.9/src/commands/get-cfg.js)_
211
220
 
212
221
  ## `saltcorn help [COMMAND]`
213
222
 
@@ -245,7 +254,7 @@ ALIASES
245
254
  $ saltcorn paths
246
255
  ```
247
256
 
248
- _See code: [src/commands/info.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.5/src/commands/info.js)_
257
+ _See code: [src/commands/info.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.9/src/commands/info.js)_
249
258
 
250
259
  ## `saltcorn install-pack`
251
260
 
@@ -261,7 +270,7 @@ OPTIONS
261
270
  -t, --tenant=tenant tenant
262
271
  ```
263
272
 
264
- _See code: [src/commands/install-pack.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.5/src/commands/install-pack.js)_
273
+ _See code: [src/commands/install-pack.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.9/src/commands/install-pack.js)_
265
274
 
266
275
  ## `saltcorn install-plugin`
267
276
 
@@ -277,7 +286,7 @@ OPTIONS
277
286
  -t, --tenant=tenant tenant
278
287
  ```
279
288
 
280
- _See code: [src/commands/install-plugin.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.5/src/commands/install-plugin.js)_
289
+ _See code: [src/commands/install-plugin.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.9/src/commands/install-plugin.js)_
281
290
 
282
291
  ## `saltcorn list-tenants`
283
292
 
@@ -288,7 +297,7 @@ USAGE
288
297
  $ saltcorn list-tenants
289
298
  ```
290
299
 
291
- _See code: [src/commands/list-tenants.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.5/src/commands/list-tenants.js)_
300
+ _See code: [src/commands/list-tenants.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.9/src/commands/list-tenants.js)_
292
301
 
293
302
  ## `saltcorn localize-plugin PLUGIN PATH`
294
303
 
@@ -306,7 +315,7 @@ OPTIONS
306
315
  -t, --tenant=tenant tenant
307
316
  ```
308
317
 
309
- _See code: [src/commands/localize-plugin.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.5/src/commands/localize-plugin.js)_
318
+ _See code: [src/commands/localize-plugin.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.9/src/commands/localize-plugin.js)_
310
319
 
311
320
  ## `saltcorn make-migration`
312
321
 
@@ -322,7 +331,7 @@ DESCRIPTION
322
331
  unless you are a developer.
323
332
  ```
324
333
 
325
- _See code: [src/commands/make-migration.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.5/src/commands/make-migration.js)_
334
+ _See code: [src/commands/make-migration.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.9/src/commands/make-migration.js)_
326
335
 
327
336
  ## `saltcorn saltcorn migrate`
328
337
 
@@ -344,7 +353,36 @@ DESCRIPTION
344
353
  servers and need to control when the migrations are run.
345
354
  ```
346
355
 
347
- _See code: [src/commands/migrate.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.5/src/commands/migrate.js)_
356
+ _See code: [src/commands/migrate.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.9/src/commands/migrate.js)_
357
+
358
+ ## `saltcorn modify-user USER_EMAIL`
359
+
360
+ Modify (update) user.
361
+
362
+ ```
363
+ USAGE
364
+ $ saltcorn modify-user USER_EMAIL
365
+
366
+ ARGUMENTS
367
+ USER_EMAIL User to modify
368
+
369
+ OPTIONS
370
+ -a, --admin make user be Admin
371
+ -e, --email=email new email
372
+ -i, --imode interactive mode
373
+ -p, --password=password new password
374
+ -r, --role=role new role (can conflict with -a option)
375
+ -t, --tenant=tenant tenant
376
+
377
+ DESCRIPTION
378
+ Command changes the user specified by USER_EMAIL.
379
+
380
+ You can change the user group, password and email.
381
+
382
+ NOTE that -a and -r role (--role=role) can give conflict.
383
+ ```
384
+
385
+ _See code: [src/commands/modify-user.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.9/src/commands/modify-user.js)_
348
386
 
349
387
  ## `saltcorn plugins`
350
388
 
@@ -496,7 +534,7 @@ ARGUMENTS
496
534
  VERSION New version number
497
535
  ```
498
536
 
499
- _See code: [src/commands/release.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.5/src/commands/release.js)_
537
+ _See code: [src/commands/release.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.9/src/commands/release.js)_
500
538
 
501
539
  ## `saltcorn reset-schema`
502
540
 
@@ -507,7 +545,7 @@ USAGE
507
545
  $ saltcorn reset-schema
508
546
 
509
547
  OPTIONS
510
- -f, --force force
548
+ -f, --force force command execution
511
549
  -t, --tenant=tenant tenant
512
550
 
513
551
  DESCRIPTION
@@ -515,7 +553,7 @@ DESCRIPTION
515
553
  This will delete all existing information
516
554
  ```
517
555
 
518
- _See code: [src/commands/reset-schema.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.5/src/commands/reset-schema.js)_
556
+ _See code: [src/commands/reset-schema.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.9/src/commands/reset-schema.js)_
519
557
 
520
558
  ## `saltcorn restore FILE`
521
559
 
@@ -532,21 +570,26 @@ OPTIONS
532
570
  -t, --tenant=tenant tenant
533
571
  ```
534
572
 
535
- _See code: [src/commands/restore.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.5/src/commands/restore.js)_
573
+ _See code: [src/commands/restore.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.9/src/commands/restore.js)_
536
574
 
537
- ## `saltcorn rm-tenant TENANT`
575
+ ## `saltcorn rm-tenant`
538
576
 
539
- Remove a tenant
577
+ Remove a tenant.
540
578
 
541
579
  ```
542
580
  USAGE
543
- $ saltcorn rm-tenant TENANT
581
+ $ saltcorn rm-tenant
544
582
 
545
- ARGUMENTS
546
- TENANT Tenant to remove
583
+ OPTIONS
584
+ -f, --force force command execution
585
+ -t, --tenant=tenant (required) tenant
586
+
587
+ DESCRIPTION
588
+ Attention! All tenant data will be lost!
589
+ It recommended to make backup of tenant before perform this command.
547
590
  ```
548
591
 
549
- _See code: [src/commands/rm-tenant.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.5/src/commands/rm-tenant.js)_
592
+ _See code: [src/commands/rm-tenant.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.9/src/commands/rm-tenant.js)_
550
593
 
551
594
  ## `saltcorn run-benchmark [BASEURL]`
552
595
 
@@ -565,7 +608,7 @@ OPTIONS
565
608
  -t, --token=token API Token for reporting results
566
609
  ```
567
610
 
568
- _See code: [src/commands/run-benchmark.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.5/src/commands/run-benchmark.js)_
611
+ _See code: [src/commands/run-benchmark.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.9/src/commands/run-benchmark.js)_
569
612
 
570
613
  ## `saltcorn run-tests [PACKAGE]`
571
614
 
@@ -585,7 +628,7 @@ OPTIONS
585
628
  --watchAll Watch files for changes and rerun all tests.
586
629
  ```
587
630
 
588
- _See code: [src/commands/run-tests.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.5/src/commands/run-tests.js)_
631
+ _See code: [src/commands/run-tests.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.9/src/commands/run-tests.js)_
589
632
 
590
633
  ## `saltcorn scheduler`
591
634
 
@@ -599,7 +642,7 @@ OPTIONS
599
642
  -v, --verbose Verbose
600
643
  ```
601
644
 
602
- _See code: [src/commands/scheduler.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.5/src/commands/scheduler.js)_
645
+ _See code: [src/commands/scheduler.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.9/src/commands/scheduler.js)_
603
646
 
604
647
  ## `saltcorn serve`
605
648
 
@@ -619,7 +662,7 @@ OPTIONS
619
662
  -v, --verbose Verbose
620
663
  ```
621
664
 
622
- _See code: [src/commands/serve.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.5/src/commands/serve.js)_
665
+ _See code: [src/commands/serve.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.9/src/commands/serve.js)_
623
666
 
624
667
  ## `saltcorn set-cfg KEY VALUE`
625
668
 
@@ -638,7 +681,7 @@ OPTIONS
638
681
  -t, --tenant=tenant tenant
639
682
  ```
640
683
 
641
- _See code: [src/commands/set-cfg.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.5/src/commands/set-cfg.js)_
684
+ _See code: [src/commands/set-cfg.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.9/src/commands/set-cfg.js)_
642
685
 
643
686
  ## `saltcorn setup`
644
687
 
@@ -653,11 +696,11 @@ OPTIONS
653
696
 
654
697
  DESCRIPTION
655
698
  ...
656
- This will attempt to install or connect a database, and set up a
699
+ This will attempt to install or connect a database, and set up a
657
700
  configuration file
658
701
  ```
659
702
 
660
- _See code: [src/commands/setup.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.5/src/commands/setup.js)_
703
+ _See code: [src/commands/setup.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.9/src/commands/setup.js)_
661
704
 
662
705
  ## `saltcorn setup-benchmark`
663
706
 
@@ -671,7 +714,7 @@ OPTIONS
671
714
  -t, --tenant=tenant tenant
672
715
  ```
673
716
 
674
- _See code: [src/commands/setup-benchmark.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.5/src/commands/setup-benchmark.js)_
717
+ _See code: [src/commands/setup-benchmark.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.9/src/commands/setup-benchmark.js)_
675
718
 
676
719
  ## `saltcorn test-plugin PATH`
677
720
 
@@ -689,7 +732,7 @@ DESCRIPTION
689
732
  Extra documentation goes here
690
733
  ```
691
734
 
692
- _See code: [src/commands/test-plugin.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.5/src/commands/test-plugin.js)_
735
+ _See code: [src/commands/test-plugin.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.9/src/commands/test-plugin.js)_
693
736
 
694
737
  ## `saltcorn transform-field EXPRESSION FIELD TABLE [TENANT]`
695
738
 
@@ -706,5 +749,5 @@ ARGUMENTS
706
749
  TENANT tenant name
707
750
  ```
708
751
 
709
- _See code: [src/commands/transform-field.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.5/src/commands/transform-field.js)_
752
+ _See code: [src/commands/transform-field.js](https://github.com/saltcorn/saltcorn/blob/v0.7.2-beta.9/src/commands/transform-field.js)_
710
753
  <!-- commandsstop -->
@@ -1 +1 @@
1
- {"version":"0.7.2-beta.5","commands":{"add-schema":{"id":"add-schema","description":"Add Saltcorn schema to existing database","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"backup":{"id":"backup","description":"Backup the PostgreSQL database to a file with pg_dump or zip","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"output":{"name":"output","type":"option","char":"o","description":"output filename"},"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"},"zip":{"name":"zip","type":"boolean","char":"z","description":"zip format","allowNo":false}},"args":[]},"configuration-check":{"id":"configuration-check","description":"Check configuration","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"}},"args":[]},"create-tenant":{"id":"create-tenant","description":"Create a tenant","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"email":{"name":"email","type":"option","char":"e","description":"Email of owner of tenant"},"description":{"name":"description","type":"option","char":"d","description":"Description of tenant"}},"args":[{"name":"tenant","description":"Tenant subdomain to create","required":true}]},"create-user":{"id":"create-user","description":"Create a new user","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"admin":{"name":"admin","type":"boolean","char":"a","description":"Admin user","allowNo":false},"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"},"email":{"name":"email","type":"option","char":"e","description":"email"},"role":{"name":"role","type":"option","char":"r","description":"role"},"password":{"name":"password","type":"option","char":"p","description":"password"}},"args":[]},"delete-tenants":{"id":"delete-tenants","description":"Delete inactive tenants","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"fixtures":{"id":"fixtures","description":"Load fixtures for testing\n...\nThis manual step it is never required for users and rarely required for developers\n","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"reset":{"name":"reset","type":"boolean","char":"r","description":"Also reset schema","allowNo":false},"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"}},"args":[]},"get-cfg":{"id":"get-cfg","description":"Get a configuration value","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"},"plugin":{"name":"plugin","type":"option","char":"p","description":"plugin"}},"args":[{"name":"key","description":"Configuration key","required":true}]},"info":{"id":"info","description":"Show paths\n...\nShow configuration and file store paths\n","pluginName":"@saltcorn/cli","pluginType":"core","aliases":["paths"],"flags":{"json":{"name":"json","type":"boolean","char":"j","description":"json format","allowNo":false}},"args":[]},"install-pack":{"id":"install-pack","description":"Install a pack","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"},"name":{"name":"name","type":"option","char":"n","description":"Pack name in store"},"file":{"name":"file","type":"option","char":"f","description":"File with pack JSON"}},"args":[]},"install-plugin":{"id":"install-plugin","description":"Install a plugin","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"},"name":{"name":"name","type":"option","char":"n","description":"Plugin name in store"},"directory":{"name":"directory","type":"option","char":"d","description":"Directory with local plugin"}},"args":[]},"list-tenants":{"id":"list-tenants","description":"List tenants in CSV format","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"localize-plugin":{"id":"localize-plugin","description":"Convert plugin to local plugin","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"}},"args":[{"name":"plugin","description":"Current plugin name","required":true},{"name":"path","description":"Absolute path to local plugin","required":true}]},"make-migration":{"id":"make-migration","description":"Create a new blank Database structure migration file.\nThese migrations update database structure.\nYou should not normally need to run this\nunless you are a developer.\n","usage":"make-migration","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"migrate":{"id":"migrate","description":"Run Database structure migrations\n...\nNOTE!\n- Please stop Saltcorn before run DB migrations.\n- Please make db backup before migration.\n- There are no way to rollback migration if you doesn't make backup.\n\nThis is not normally required as migrations will be run when the server starts.\nHowever, this command may be useful if you are running multiple application\nservers and need to control when the migrations are run.\n","usage":"saltcorn migrate","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"plugins":{"id":"plugins","description":"List and upgrade plugins for tenants\n...\nExtra documentation goes here\n","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"examples":["plugins -v - verbose output of commands","plugins -u -d - dry-run for plugin update","plugins -u -f - force plugin update"],"flags":{"upgrade":{"name":"upgrade","type":"boolean","char":"u","description":"Upgrade","allowNo":false},"dryRun":{"name":"dryRun","type":"boolean","char":"d","description":"Upgrade dry-run","allowNo":false},"verbose":{"name":"verbose","type":"boolean","char":"v","description":"Verbose output","allowNo":false},"force":{"name":"force","type":"boolean","char":"f","description":"Force update","allowNo":false},"name":{"name":"name","type":"option","char":"n","description":"Plugin name"}},"args":[]},"release":{"id":"release","description":"Release a new saltcorn version","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"version","description":"New version number","required":true}]},"reset-schema":{"id":"reset-schema","description":"Reset the database\n...\nThis will delete all existing information\n","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"force":{"name":"force","type":"boolean","char":"f","description":"force","allowNo":false},"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"}},"args":[]},"restore":{"id":"restore","description":"Restore a previously backed up database (zip or sqlc format)","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"}},"args":[{"name":"file","description":"backup file to restore","required":true}]},"rm-tenant":{"id":"rm-tenant","description":"Remove a tenant","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"tenant","description":"Tenant to remove","required":true}]},"run-benchmark":{"id":"run-benchmark","description":"Run benchmark","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"token":{"name":"token","type":"option","char":"t","description":"API Token for reporting results"},"benchmark":{"name":"benchmark","type":"option","char":"b","description":"Which benchmark to run"},"delay":{"name":"delay","type":"option","char":"d","description":"delay between runs (s)","default":30}},"args":[{"name":"baseurl","description":"Base URL","required":false}]},"run-tests":{"id":"run-tests","description":"Run test suites","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"coverage":{"name":"coverage","type":"boolean","char":"c","description":"Coverage","allowNo":false},"testFilter":{"name":"testFilter","type":"option","char":"t","description":"Filter tests by suite or test name"},"watch":{"name":"watch","type":"boolean","description":"Watch files for changes and rerun tests related to changed files.","allowNo":false},"watchAll":{"name":"watchAll","type":"boolean","description":"Watch files for changes and rerun all tests.","allowNo":false}},"args":[{"name":"package","description":"which package to run tests for"}]},"scheduler":{"id":"scheduler","description":"Run the Saltcorn scheduler","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"verbose":{"name":"verbose","type":"boolean","char":"v","description":"Verbose","allowNo":false}},"args":[]},"serve":{"id":"serve","description":"Start the Saltcorn server","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"port":{"name":"port","type":"option","char":"p","description":"port","default":3000},"verbose":{"name":"verbose","type":"boolean","char":"v","description":"Verbose","allowNo":false},"watchReaper":{"name":"watchReaper","type":"boolean","char":"r","description":"Watch reaper","allowNo":false},"dev":{"name":"dev","type":"boolean","char":"d","description":"Run in dev mode and re-start on file changes","allowNo":false},"addschema":{"name":"addschema","type":"boolean","char":"a","description":"Add schema if missing","allowNo":false},"nomigrate":{"name":"nomigrate","type":"boolean","char":"n","description":"No migrations","allowNo":false},"noscheduler":{"name":"noscheduler","type":"boolean","char":"s","description":"No scheduler","allowNo":false}},"args":[]},"set-cfg":{"id":"set-cfg","description":"Set a configuration value","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"},"plugin":{"name":"plugin","type":"option","char":"p","description":"plugin"}},"args":[{"name":"key","description":"Configuration key","required":true},{"name":"value","description":"Configuration value (JSON or string)","required":true}]},"setup-benchmark":{"id":"setup-benchmark","description":"Setup an instance for benchmarking","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"}},"args":[]},"setup":{"id":"setup","description":"Set up a new system\n...\nThis will attempt to install or connect a database, and set up a \nconfiguration file\n","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"coverage":{"name":"coverage","type":"boolean","char":"c","description":"Coverage","allowNo":false}},"args":[]},"test-plugin":{"id":"test-plugin","description":"Test a plugin\n...\nExtra documentation goes here\n","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"path","description":"path to plugin package","required":true}]},"transform-field":{"id":"transform-field","description":"transform an existing field by applying a calculated expression","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"expression","description":"expression to calculate field","required":true},{"name":"field","description":"field name","required":true},{"name":"table","description":"table name","required":true},{"name":"tenant","description":"tenant name","required":false}]}}}
1
+ {"version":"0.7.2-beta.9","commands":{"add-schema":{"id":"add-schema","description":"Add Saltcorn schema to existing database","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"force":{"name":"force","type":"boolean","char":"f","description":"force command execution","allowNo":false}},"args":[]},"backup":{"id":"backup","description":"Backup the PostgreSQL database to a file with pg_dump or zip","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"output":{"name":"output","type":"option","char":"o","description":"output filename"},"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"},"zip":{"name":"zip","type":"boolean","char":"z","description":"zip format","allowNo":false}},"args":[]},"configuration-check":{"id":"configuration-check","description":"Check configuration","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"}},"args":[]},"create-tenant":{"id":"create-tenant","description":"Create a tenant","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"email":{"name":"email","type":"option","char":"e","description":"Email of owner of tenant"},"description":{"name":"description","type":"option","char":"d","description":"Description of tenant"}},"args":[{"name":"tenant","description":"Tenant subdomain to create","required":true}]},"create-user":{"id":"create-user","description":"Create a new user","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"admin":{"name":"admin","type":"boolean","char":"a","description":"Admin user","allowNo":false},"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"},"email":{"name":"email","type":"option","char":"e","description":"email"},"role":{"name":"role","type":"option","char":"r","description":"role"},"password":{"name":"password","type":"option","char":"p","description":"password"}},"args":[]},"delete-tenants":{"id":"delete-tenants","description":"Delete inactive tenants","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"delete-user":{"id":"delete-user","description":"Delete user.\n\nCommand deletes the user specified by USER_EMAIL.\n\n","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"force":{"name":"force","type":"boolean","char":"f","description":"force command execution","allowNo":false},"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"}},"args":[{"name":"user_email","description":"User to delete","required":true}]},"fixtures":{"id":"fixtures","description":"Load fixtures for testing\n...\nThis manual step it is never required for users and rarely required for developers\n","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"reset":{"name":"reset","type":"boolean","char":"r","description":"Also reset schema","allowNo":false},"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"}},"args":[]},"get-cfg":{"id":"get-cfg","description":"Get a configuration value","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"},"plugin":{"name":"plugin","type":"option","char":"p","description":"plugin"}},"args":[{"name":"key","description":"Configuration key","required":true}]},"info":{"id":"info","description":"Show paths\n...\nShow configuration and file store paths\n","pluginName":"@saltcorn/cli","pluginType":"core","aliases":["paths"],"flags":{"json":{"name":"json","type":"boolean","char":"j","description":"json format","allowNo":false}},"args":[]},"install-pack":{"id":"install-pack","description":"Install a pack","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"},"name":{"name":"name","type":"option","char":"n","description":"Pack name in store"},"file":{"name":"file","type":"option","char":"f","description":"File with pack JSON"}},"args":[]},"install-plugin":{"id":"install-plugin","description":"Install a plugin","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"},"name":{"name":"name","type":"option","char":"n","description":"Plugin name in store"},"directory":{"name":"directory","type":"option","char":"d","description":"Directory with local plugin"}},"args":[]},"list-tenants":{"id":"list-tenants","description":"List tenants in CSV format","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"localize-plugin":{"id":"localize-plugin","description":"Convert plugin to local plugin","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"}},"args":[{"name":"plugin","description":"Current plugin name","required":true},{"name":"path","description":"Absolute path to local plugin","required":true}]},"make-migration":{"id":"make-migration","description":"Create a new blank Database structure migration file.\nThese migrations update database structure.\nYou should not normally need to run this\nunless you are a developer.\n","usage":"make-migration","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"migrate":{"id":"migrate","description":"Run Database structure migrations\n...\nNOTE!\n- Please stop Saltcorn before run DB migrations.\n- Please make db backup before migration.\n- There are no way to rollback migration if you doesn't make backup.\n\nThis is not normally required as migrations will be run when the server starts.\nHowever, this command may be useful if you are running multiple application\nservers and need to control when the migrations are run.\n","usage":"saltcorn migrate","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{},"args":[]},"modify-user":{"id":"modify-user","description":"Modify (update) user.\n\nCommand changes the user specified by USER_EMAIL.\n\nYou can change the user group, password and email.\n\nNOTE that -a and -r role (--role=role) can give conflict.\n","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"admin":{"name":"admin","type":"boolean","char":"a","description":"make user be Admin","allowNo":false},"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"},"email":{"name":"email","type":"option","char":"e","description":"new email"},"role":{"name":"role","type":"option","char":"r","description":"new role (can conflict with -a option)"},"password":{"name":"password","type":"option","char":"p","description":"new password"},"imode":{"name":"imode","type":"boolean","char":"i","description":"interactive mode","allowNo":false}},"args":[{"name":"user_email","description":"User to modify","required":true}]},"plugins":{"id":"plugins","description":"List and upgrade plugins for tenants\n...\nExtra documentation goes here\n","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"examples":["plugins -v - verbose output of commands","plugins -u -d - dry-run for plugin update","plugins -u -f - force plugin update"],"flags":{"upgrade":{"name":"upgrade","type":"boolean","char":"u","description":"Upgrade","allowNo":false},"dryRun":{"name":"dryRun","type":"boolean","char":"d","description":"Upgrade dry-run","allowNo":false},"verbose":{"name":"verbose","type":"boolean","char":"v","description":"Verbose output","allowNo":false},"force":{"name":"force","type":"boolean","char":"f","description":"Force update","allowNo":false},"name":{"name":"name","type":"option","char":"n","description":"Plugin name"}},"args":[]},"release":{"id":"release","description":"Release a new saltcorn version","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"version","description":"New version number","required":true}]},"reset-schema":{"id":"reset-schema","description":"Reset the database\n...\nThis will delete all existing information\n","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"force":{"name":"force","type":"boolean","char":"f","description":"force command execution","allowNo":false},"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"}},"args":[]},"restore":{"id":"restore","description":"Restore a previously backed up database (zip or sqlc format)","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"}},"args":[{"name":"file","description":"backup file to restore","required":true}]},"rm-tenant":{"id":"rm-tenant","description":"Remove a tenant.\nAttention! All tenant data will be lost!\nIt recommended to make backup of tenant before perform this command.\n","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"force":{"name":"force","type":"boolean","char":"f","description":"force command execution","allowNo":false},"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant","required":true}},"args":[]},"run-benchmark":{"id":"run-benchmark","description":"Run benchmark","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"token":{"name":"token","type":"option","char":"t","description":"API Token for reporting results"},"benchmark":{"name":"benchmark","type":"option","char":"b","description":"Which benchmark to run"},"delay":{"name":"delay","type":"option","char":"d","description":"delay between runs (s)","default":30}},"args":[{"name":"baseurl","description":"Base URL","required":false}]},"run-tests":{"id":"run-tests","description":"Run test suites","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"coverage":{"name":"coverage","type":"boolean","char":"c","description":"Coverage","allowNo":false},"testFilter":{"name":"testFilter","type":"option","char":"t","description":"Filter tests by suite or test name"},"watch":{"name":"watch","type":"boolean","description":"Watch files for changes and rerun tests related to changed files.","allowNo":false},"watchAll":{"name":"watchAll","type":"boolean","description":"Watch files for changes and rerun all tests.","allowNo":false}},"args":[{"name":"package","description":"which package to run tests for"}]},"scheduler":{"id":"scheduler","description":"Run the Saltcorn scheduler","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"verbose":{"name":"verbose","type":"boolean","char":"v","description":"Verbose","allowNo":false}},"args":[]},"serve":{"id":"serve","description":"Start the Saltcorn server","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"port":{"name":"port","type":"option","char":"p","description":"port","default":3000},"verbose":{"name":"verbose","type":"boolean","char":"v","description":"Verbose","allowNo":false},"watchReaper":{"name":"watchReaper","type":"boolean","char":"r","description":"Watch reaper","allowNo":false},"dev":{"name":"dev","type":"boolean","char":"d","description":"Run in dev mode and re-start on file changes","allowNo":false},"addschema":{"name":"addschema","type":"boolean","char":"a","description":"Add schema if missing","allowNo":false},"nomigrate":{"name":"nomigrate","type":"boolean","char":"n","description":"No migrations","allowNo":false},"noscheduler":{"name":"noscheduler","type":"boolean","char":"s","description":"No scheduler","allowNo":false}},"args":[]},"set-cfg":{"id":"set-cfg","description":"Set a configuration value","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"},"plugin":{"name":"plugin","type":"option","char":"p","description":"plugin"}},"args":[{"name":"key","description":"Configuration key","required":true},{"name":"value","description":"Configuration value (JSON or string)","required":true}]},"setup-benchmark":{"id":"setup-benchmark","description":"Setup an instance for benchmarking","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"tenant":{"name":"tenant","type":"option","char":"t","description":"tenant"}},"args":[]},"setup":{"id":"setup","description":"Set up a new system\n...\nThis will attempt to install or connect a database, and set up a\nconfiguration file\n","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{"coverage":{"name":"coverage","type":"boolean","char":"c","description":"Coverage","allowNo":false}},"args":[]},"test-plugin":{"id":"test-plugin","description":"Test a plugin\n...\nExtra documentation goes here\n","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"path","description":"path to plugin package","required":true}]},"transform-field":{"id":"transform-field","description":"transform an existing field by applying a calculated expression","pluginName":"@saltcorn/cli","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"expression","description":"expression to calculate field","required":true},{"name":"field","description":"field name","required":true},{"name":"table","description":"table name","required":true},{"name":"tenant","description":"tenant name","required":false}]}}}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@saltcorn/cli",
3
3
  "description": "Command-line interface for Saltcorn, open-source no-code platform",
4
4
  "homepage": "https://saltcorn.com",
5
- "version": "0.7.2-beta.5",
5
+ "version": "0.7.2-beta.9",
6
6
  "author": "Tom Nielsen @glutamate",
7
7
  "bin": {
8
8
  "saltcorn": "./bin/saltcorn"
@@ -13,10 +13,9 @@
13
13
  "@oclif/config": "^1.18.3",
14
14
  "@oclif/plugin-plugins": "^2.1.0",
15
15
  "@oclif/plugin-help": "^3.3.1",
16
- "@saltcorn/admin-models": "0.7.2-beta.5",
17
- "@saltcorn/data": "0.7.2-beta.5",
18
- "@saltcorn/mobile-builder": "0.7.2-beta.5",
19
- "@saltcorn/server": "0.7.2-beta.5",
16
+ "@saltcorn/admin-models": "0.7.2-beta.9",
17
+ "@saltcorn/data": "0.7.2-beta.9",
18
+ "@saltcorn/server": "0.7.2-beta.9",
20
19
  "cli-ux": "^5.6.7",
21
20
  "contractis": "^0.1.0",
22
21
  "dateformat": "^3.0.3",
@@ -32,7 +31,8 @@
32
31
  },
33
32
  "devDependencies": {
34
33
  "@oclif/dev-cli": "^1.26.10",
35
- "globby": "^10.0.2"
34
+ "globby": "^10.0.2",
35
+ "ts-node": "^9.1.1"
36
36
  },
37
37
  "engines": {
38
38
  "node": ">=8.0.0"
@@ -53,8 +53,7 @@
53
53
  "bin": "saltcorn",
54
54
  "plugins": [
55
55
  "@oclif/plugin-help",
56
- "@oclif/plugin-plugins",
57
- "@saltcorn/mobile-builder"
56
+ "@oclif/plugin-plugins"
58
57
  ]
59
58
  },
60
59
  "repository": "github:saltcorn/saltcorn",
@@ -15,9 +15,19 @@ class AddSchemaCommand extends Command {
15
15
  * @returns {Promise<void>}
16
16
  */
17
17
  async run() {
18
+
19
+ const { flags } = this.parse(AddSchemaCommand);
18
20
  const reset = require("@saltcorn/data/db/reset_schema");
21
+ if(!flags.force){
22
+ const ans = await cli.confirm(
23
+ `This add Saltcorn schema to existing database\nContinue (y/n)?`);
24
+ if (!ans) {
25
+ console.log(`Success: Command execution canceled`);
26
+ this.exit(1);
27
+ }
28
+ }
19
29
  await reset(true);
20
-
30
+ console.log(`Success: Command execution successfully`);
21
31
  this.exit(0);
22
32
  }
23
33
  }
@@ -27,4 +37,16 @@ class AddSchemaCommand extends Command {
27
37
  */
28
38
  AddSchemaCommand.description = `Add Saltcorn schema to existing database`;
29
39
 
40
+ /**
41
+ * @type {string}
42
+ */
43
+ AddSchemaCommand.help = `Add Saltcorn schema to existing database`;
44
+
45
+ /**
46
+ * @type {object}
47
+ */
48
+ AddSchemaCommand.flags = {
49
+ force: flags.boolean({ char: "f", description: "force command execution" }),
50
+ };
51
+
30
52
  module.exports = AddSchemaCommand;
@@ -7,13 +7,12 @@ const { execSync } = require("child_process");
7
7
  const dateFormat = require("dateformat");
8
8
  const os = require("os");
9
9
  const { getConnectObject } = require("@saltcorn/data/db/connect");
10
- const env = process.env;
11
- var day = dateFormat(new Date(), "yyyymmdd");
10
+ const day = dateFormat(new Date(), "yyyymmdd");
12
11
  const connobj = getConnectObject();
13
12
 
14
13
  const pgdb = connobj.database;
15
14
 
16
- var default_filenm = `${day}-${pgdb}-${os.hostname}.sqlc`;
15
+ const default_filenm = `${day}-${pgdb}-${os.hostname}.sqlc`;
17
16
 
18
17
  /**
19
18
  * BackupCommand Class
@@ -67,6 +66,11 @@ class BackupCommand extends Command {
67
66
  */
68
67
  BackupCommand.description = `Backup the PostgreSQL database to a file with pg_dump or zip`;
69
68
 
69
+ /**
70
+ * @type {string}
71
+ */
72
+ BackupCommand.help = `Backup the PostgreSQL database to a file with pg_dump or zip`;
73
+
70
74
  /**
71
75
  * @type {object}
72
76
  */
@@ -4,8 +4,9 @@
4
4
  */
5
5
  const { Command, flags } = require("@oclif/command");
6
6
  const { cli } = require("cli-ux");
7
- const { maybe_as_tenant } = require("../common");
7
+ const { maybe_as_tenant, init_some_tenants } = require("../common");
8
8
 
9
+ // todo update logic based on modify-user command
9
10
  /**
10
11
  * CreateUserCommand Class
11
12
  * @extends oclif.Command
@@ -16,6 +17,7 @@ class CreateUserCommand extends Command {
16
17
  * @returns {Promise<void>}
17
18
  */
18
19
  async run() {
20
+
19
21
  const User = require("@saltcorn/data/models/user");
20
22
 
21
23
  const { flags } = this.parse(CreateUserCommand);
@@ -23,12 +25,10 @@ class CreateUserCommand extends Command {
23
25
  console.error("Error: specify at most one of admin and role");
24
26
  this.exit(1);
25
27
  }
26
- const { loadAllPlugins } = require("@saltcorn/server/load_plugins");
27
- const { init_multi_tenant } = require("@saltcorn/data/db/state");
28
- const { getAllTenants } = require("@saltcorn/admin-models/models/tenant");
29
- await loadAllPlugins();
30
- const tenants = await getAllTenants();
31
- await init_multi_tenant(loadAllPlugins, undefined, tenants);
28
+ // init tenant
29
+ await init_some_tenants(flags.tenant);
30
+
31
+ // run function as specified tenant
32
32
  await maybe_as_tenant(flags.tenant, async () => {
33
33
  let role_id = flags.admin ? 1 : 8;
34
34
  if (flags.role) {
@@ -43,7 +43,13 @@ class CreateUserCommand extends Command {
43
43
  const email = flags.email || (await cli.prompt("Email address"));
44
44
  const password =
45
45
  flags.password || (await cli.prompt("Password", { type: "hide" }));
46
- await User.create({ email, password, role_id });
46
+ const u = await User.create({ email, password, role_id });
47
+ if(u instanceof User)
48
+ console.log(`Success: User ${email} created successfully ${
49
+ typeof flags.tenant !== "undefined" ? "in tenant " + flags.tenant : ""
50
+ }`);
51
+ else
52
+ console.error(`Error: ${u.error}`);
47
53
  });
48
54
  this.exit(0);
49
55
  }