@pgpm/faker 0.5.0 → 0.7.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/Makefile
CHANGED
package/README.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @pgpm/faker
|
|
2
2
|
|
|
3
|
+
<p align="center" width="100%">
|
|
4
|
+
<img height="250" src="https://raw.githubusercontent.com/launchql/launchql/refs/heads/main/assets/outline-logo.svg" />
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p align="center" width="100%">
|
|
8
|
+
<a href="https://github.com/launchql/pgpm-modules/actions/workflows/ci.yml">
|
|
9
|
+
<img height="20" src="https://github.com/launchql/pgpm-modules/actions/workflows/ci.yml/badge.svg" />
|
|
10
|
+
</a>
|
|
11
|
+
<a href="https://github.com/launchql/pgpm-modules/blob/main/LICENSE"><img height="20" src="https://img.shields.io/badge/license-MIT-blue.svg"/></a>
|
|
12
|
+
<a href="https://www.npmjs.com/package/@pgpm/faker"><img height="20" src="https://img.shields.io/github/package-json/v/launchql/pgpm-modules?filename=packages%2Futils%2Ffaker%2Fpackage.json"/></a>
|
|
13
|
+
</p>
|
|
14
|
+
|
|
3
15
|
create fake data in PostgreSQL
|
|
4
16
|
|
|
5
17
|
## Overview
|
|
@@ -32,40 +44,42 @@ This is a quick way to get started. The sections below provide more detailed ins
|
|
|
32
44
|
### Prerequisites
|
|
33
45
|
|
|
34
46
|
```bash
|
|
35
|
-
# Install pgpm
|
|
47
|
+
# Install pgpm CLI
|
|
36
48
|
npm install -g pgpm
|
|
37
49
|
|
|
38
|
-
# Start
|
|
50
|
+
# Start local Postgres (via Docker) and export env vars
|
|
39
51
|
pgpm docker start
|
|
40
|
-
|
|
41
|
-
# Set environment variables
|
|
42
52
|
eval "$(pgpm env)"
|
|
43
53
|
```
|
|
44
54
|
|
|
45
|
-
|
|
55
|
+
> **Tip:** Already running Postgres? Skip the Docker step and just export your `PG*` environment variables.
|
|
46
56
|
|
|
47
|
-
|
|
57
|
+
### **Add to an Existing Package**
|
|
48
58
|
|
|
49
59
|
```bash
|
|
60
|
+
# 1. Install the package
|
|
50
61
|
pgpm install @pgpm/faker
|
|
51
|
-
|
|
62
|
+
|
|
63
|
+
# 2. Deploy locally
|
|
64
|
+
pgpm deploy
|
|
52
65
|
```
|
|
53
66
|
|
|
54
|
-
|
|
67
|
+
### **Add to a New Project**
|
|
55
68
|
|
|
56
69
|
```bash
|
|
57
|
-
|
|
58
|
-
pgpm
|
|
59
|
-
|
|
70
|
+
# 1. Create a workspace
|
|
71
|
+
pgpm init --workspace
|
|
72
|
+
cd my-app
|
|
60
73
|
|
|
61
|
-
|
|
74
|
+
# 2. Create your first module
|
|
75
|
+
pgpm init
|
|
76
|
+
cd packages/your-module
|
|
62
77
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
pgpm install
|
|
78
|
+
# 3. Install a package
|
|
79
|
+
pgpm install @pgpm/faker
|
|
66
80
|
|
|
67
|
-
# Deploy
|
|
68
|
-
pgpm deploy
|
|
81
|
+
# 4. Deploy everything
|
|
82
|
+
pgpm deploy --createdb --database mydb1
|
|
69
83
|
```
|
|
70
84
|
|
|
71
85
|
## Usage
|
|
@@ -504,141 +518,6 @@ pnpm test
|
|
|
504
518
|
|
|
505
519
|
None - this is a pure plpgsql implementation.
|
|
506
520
|
|
|
507
|
-
---
|
|
508
|
-
|
|
509
|
-
## Development
|
|
510
|
-
|
|
511
|
-
## start the postgres db process
|
|
512
|
-
|
|
513
|
-
First you'll want to start the postgres docker (you can also just use `docker-compose up -d`):
|
|
514
|
-
|
|
515
|
-
```sh
|
|
516
|
-
make up
|
|
517
|
-
```
|
|
518
|
-
|
|
519
|
-
## install modules
|
|
520
|
-
|
|
521
|
-
Install modules
|
|
522
|
-
|
|
523
|
-
```sh
|
|
524
|
-
yarn install
|
|
525
|
-
```
|
|
526
|
-
|
|
527
|
-
## install the Postgres extensions
|
|
528
|
-
|
|
529
|
-
Now that the postgres process is running, install the extensions:
|
|
530
|
-
|
|
531
|
-
```sh
|
|
532
|
-
make install
|
|
533
|
-
```
|
|
534
|
-
|
|
535
|
-
This basically `ssh`s into the postgres instance with the `packages/` folder mounted as a volume, and installs the bundled sql code as pgxn extensions.
|
|
536
|
-
|
|
537
|
-
## testing
|
|
538
|
-
|
|
539
|
-
Testing will load all your latest sql changes and create fresh, populated databases for each sqitch module in `packages/`.
|
|
540
|
-
|
|
541
|
-
```sh
|
|
542
|
-
yarn test:watch
|
|
543
|
-
```
|
|
544
|
-
|
|
545
|
-
## building new modules
|
|
546
|
-
|
|
547
|
-
Create a new folder in `packages/`
|
|
548
|
-
|
|
549
|
-
```sh
|
|
550
|
-
pgpm init
|
|
551
|
-
```
|
|
552
|
-
|
|
553
|
-
Then, run a generator:
|
|
554
|
-
|
|
555
|
-
```sh
|
|
556
|
-
pgpm generate
|
|
557
|
-
```
|
|
558
|
-
|
|
559
|
-
You can also add arguments if you already know what you want to do:
|
|
560
|
-
|
|
561
|
-
```sh
|
|
562
|
-
pgpm generate schema --schema myschema
|
|
563
|
-
pgpm generate table --schema myschema --table mytable
|
|
564
|
-
```
|
|
565
|
-
|
|
566
|
-
## deploy code as extensions
|
|
567
|
-
|
|
568
|
-
`cd` into `packages/<module>`, and run `pgpm package`. This will make an sql file in `packages/<module>/sql/` used for `CREATE EXTENSION` calls to install your sqitch module as an extension.
|
|
569
|
-
|
|
570
|
-
## recursive deploy
|
|
571
|
-
|
|
572
|
-
You can also deploy all modules utilizing versioning as sqtich modules. Remove `--createdb` if you already created your db:
|
|
573
|
-
|
|
574
|
-
```sh
|
|
575
|
-
pgpm deploy mydb1 --yes --createdb
|
|
576
|
-
```
|
|
577
|
-
|
|
578
|
-
---
|
|
579
|
-
|
|
580
|
-
### **Before You Begin**
|
|
581
|
-
|
|
582
|
-
```bash
|
|
583
|
-
# 1. Install pgpm
|
|
584
|
-
npm install -g pgpm
|
|
585
|
-
|
|
586
|
-
# 2. Start Postgres (Docker or local)
|
|
587
|
-
pgpm docker start
|
|
588
|
-
|
|
589
|
-
# 3. Load PG* environment variables (PGHOST, PGUSER, ...)
|
|
590
|
-
eval "$(pgpm env)"
|
|
591
|
-
```
|
|
592
|
-
|
|
593
|
-
---
|
|
594
|
-
|
|
595
|
-
### **Starting a New Project**
|
|
596
|
-
|
|
597
|
-
```bash
|
|
598
|
-
# 1. Create a workspace
|
|
599
|
-
pgpm init --workspace
|
|
600
|
-
cd my-app
|
|
601
|
-
|
|
602
|
-
# 2. Create your first module
|
|
603
|
-
pgpm init
|
|
604
|
-
|
|
605
|
-
# 3. Add a migration
|
|
606
|
-
pgpm add some_change
|
|
607
|
-
|
|
608
|
-
# 4. Deploy (auto-creates database)
|
|
609
|
-
pgpm deploy --createdb
|
|
610
|
-
```
|
|
611
|
-
|
|
612
|
-
---
|
|
613
|
-
|
|
614
|
-
### **Working With an Existing Project**
|
|
615
|
-
|
|
616
|
-
```bash
|
|
617
|
-
# 1. Clone and enter the project
|
|
618
|
-
git clone <repo> && cd <project>
|
|
619
|
-
|
|
620
|
-
# 2. Install dependencies
|
|
621
|
-
pnpm install
|
|
622
|
-
|
|
623
|
-
# 3. Deploy locally
|
|
624
|
-
pgpm deploy --createdb
|
|
625
|
-
```
|
|
626
|
-
|
|
627
|
-
---
|
|
628
|
-
|
|
629
|
-
### **Testing a Module Inside a Workspace**
|
|
630
|
-
|
|
631
|
-
```bash
|
|
632
|
-
# 1. Install workspace deps
|
|
633
|
-
pnpm install
|
|
634
|
-
|
|
635
|
-
# 2. Enter the module directory
|
|
636
|
-
cd packages/<some-module>
|
|
637
|
-
|
|
638
|
-
# 3. Run tests in watch mode
|
|
639
|
-
pnpm test:watch
|
|
640
|
-
```
|
|
641
|
-
|
|
642
521
|
## Related Tooling
|
|
643
522
|
|
|
644
523
|
* [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.
|
package/launchql-faker.control
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# launchql-faker extension
|
|
2
2
|
comment = 'launchql-faker extension'
|
|
3
|
-
default_version = '0.
|
|
3
|
+
default_version = '0.6.0'
|
|
4
4
|
module_pathname = '$libdir/launchql-faker'
|
|
5
5
|
requires = 'citext,pgcrypto,plpgsql,uuid-ossp,launchql-types,launchql-verify'
|
|
6
6
|
relocatable = false
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pgpm/faker",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "Fake data generation utilities for testing and development",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -11,19 +11,19 @@
|
|
|
11
11
|
"test:watch": "jest --watch"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@pgpm/types": "0.
|
|
15
|
-
"@pgpm/verify": "0.
|
|
14
|
+
"@pgpm/types": "0.7.0",
|
|
15
|
+
"@pgpm/verify": "0.7.0"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
18
|
"pgpm": "^0.2.0"
|
|
19
19
|
},
|
|
20
20
|
"repository": {
|
|
21
21
|
"type": "git",
|
|
22
|
-
"url": "https://github.com/launchql/
|
|
22
|
+
"url": "https://github.com/launchql/pgpm-modules"
|
|
23
23
|
},
|
|
24
|
-
"homepage": "https://github.com/launchql/
|
|
24
|
+
"homepage": "https://github.com/launchql/pgpm-modules",
|
|
25
25
|
"bugs": {
|
|
26
|
-
"url": "https://github.com/launchql/
|
|
26
|
+
"url": "https://github.com/launchql/pgpm-modules/issues"
|
|
27
27
|
},
|
|
28
|
-
"gitHead": "
|
|
28
|
+
"gitHead": "1f24d8fa95fb141f16e5b8345458c3b687d80908"
|
|
29
29
|
}
|
|
File without changes
|