procbay-schema 1.0.29 → 1.0.31
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 +21 -21
- package/README.md +189 -189
- package/package.json +77 -77
- package/prisma/.env +20 -12
- package/prisma/migrations/20250819101318_init_new_schema/migration.sql +2675 -2675
- package/prisma/migrations/20250826051243_alter_purchase_intake_status/migration.sql +5 -5
- package/prisma/migrations/20250826094350_alter_approval_journey_table/migration.sql +5 -5
- package/prisma/migrations/20250901060845_init_fast_catalogue_tables/migration.sql +83 -83
- package/prisma/migrations/20250903123528_added_catalogue_table/migration.sql +58 -58
- package/prisma/migrations/20250904071854_alter_item_and_category_table/migration.sql +8 -8
- package/prisma/migrations/20250905122252_alter_fc_enum/migration.sql +5 -5
- package/prisma/migrations/20250909084050_init_catalogue_vendor_table/migration.sql +40 -40
- package/prisma/migrations/20250909121726_alter_requested_catalogue_detail_status/migration.sql +5 -5
- package/prisma/migrations/20250909125931_giot_push/migration.sql +23 -23
- package/prisma/migrations/20250911110904_alter_catalogue_vendor_table/migration.sql +12 -12
- package/prisma/migrations/20250916063938_init_catalogue_cart_table/migration.sql +58 -58
- package/prisma/migrations/20250922070540_alter_rcd_status/migration.sql +5 -5
- package/prisma/migrations/20251001105012_alter_purchase_order_table/migration.sql +11 -0
- package/prisma/migrations/migration_lock.toml +3 -3
- package/prisma/schema.prisma +2664 -2657
- package/prisma/seeders/approval-hierarchy.seed.js +340 -340
- package/prisma/seeders/attribute-value.seed.js +64 -64
- package/prisma/seeders/attribute.seed.js +61 -61
- package/prisma/seeders/category.seed.js +133 -133
- package/prisma/seeders/city.seed.js +147 -147
- package/prisma/seeders/country.seed.js +282 -282
- package/prisma/seeders/currency.seed.js +41 -41
- package/prisma/seeders/customer-notification.seed.js +83 -83
- package/prisma/seeders/department.seed.js +38 -38
- package/prisma/seeders/docs/CORE_SEEDER_OPTIMIZATIONS.md +270 -270
- package/prisma/seeders/docs/GEOGRAPHIC_PERFORMANCE_OPTIMIZATIONS.md +175 -175
- package/prisma/seeders/dynamic-form.seed.js +135 -135
- package/prisma/seeders/email-template.seed.js +68 -68
- package/prisma/seeders/faq-category.seed.js +56 -56
- package/prisma/seeders/faq.seed.js +61 -61
- package/prisma/seeders/form-master.seed.js +55 -55
- package/prisma/seeders/item.seed.js +133 -133
- package/prisma/seeders/permission.seed.js +102 -102
- package/prisma/seeders/region.seed.js +78 -78
- package/prisma/seeders/role-permission.seed.js +70 -70
- package/prisma/seeders/role.seed.js +38 -38
- package/prisma/seeders/seed.js +553 -553
- package/prisma/seeders/serial-number-config.seed.js +58 -58
- package/prisma/seeders/smtp-config.seed.js +61 -61
- package/prisma/seeders/state.seed.js +170 -170
- package/prisma/seeders/strategies.seed.js +54 -54
- package/prisma/seeders/subregion.seed.js +88 -88
- package/prisma/seeders/support-category.seed.js +56 -56
- package/prisma/seeders/template.seed.js +89 -89
- package/prisma/seeders/test-core-seeders.js +276 -276
- package/prisma/seeders/user-department.seed.js +66 -66
- package/prisma/seeders/user-event-configuration.seed.js +47 -47
- package/prisma/seeders/user-role.seed.js +74 -74
- package/prisma/seeders/user.seed.js +114 -114
- package/prisma/seeders/utils/bulk-seeder.js +300 -300
- package/prisma/seeders/utils/config.js +103 -103
- package/prisma/seeders/utils/connection-manager.js +380 -380
- package/prisma/seeders/utils/content-seeder.js +472 -472
- package/prisma/seeders/utils/core-seeder.js +330 -330
- package/prisma/seeders/utils/json-loader.js +69 -69
- package/prisma/seeders/utils/performance-config.js +341 -341
- package/prisma/seeders/utils/performance-helpers.js +206 -206
- package/prisma/seeders/utils/progress-tracker.js +364 -364
- package/prisma/seeders/utils/seeder-config-mapper.js +316 -316
- package/scripts/seed-databases.js +873 -873
- package/scripts/sync-schemas.js +865 -865
- package/scripts/truncate-tables.js +1048 -1048
- package/src/prisma/edge.js +19 -12
- package/src/prisma/index-browser.js +11 -4
- package/src/prisma/index.d.ts +179 -4
- package/src/prisma/index.js +23 -16
- package/src/prisma/libquery_engine-darwin.dylib.node +0 -0
- package/src/prisma/libquery_engine-darwin.dylib.node.tmp24628 +0 -0
- package/src/prisma/libquery_engine-darwin.dylib.node.tmp29464 +0 -0
- package/src/prisma/libquery_engine-debian-openssl-3.0.x.so.node +0 -0
- package/src/prisma/package.json +2 -2
- package/src/prisma/query_engine-windows.dll.node +0 -0
- package/src/prisma/query_engine-windows.dll.node.tmp4144 +0 -0
- package/src/prisma/runtime/edge-esm.js +18 -18
- package/src/prisma/runtime/edge.js +18 -18
- package/src/prisma/runtime/index-browser.d.ts +0 -0
- package/src/prisma/runtime/index-browser.js +0 -0
- package/src/prisma/runtime/library.d.ts +1 -1
- package/src/prisma/runtime/library.js +48 -48
- package/src/prisma/runtime/react-native.js +10 -10
- package/src/prisma/runtime/wasm.js +10 -10
- package/src/prisma/schema.prisma +13 -6
- package/src/prisma/wasm.js +11 -4
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Azhar Pathan
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Azhar Pathan
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,189 +1,189 @@
|
|
|
1
|
-
# procbay-schema
|
|
2
|
-
|
|
3
|
-
A set of utilities for managing Prisma database schemas, seeding, and maintenance operations for the Procure-to-Pay system.
|
|
4
|
-
|
|
5
|
-
[](https://www.npmjs.com/package/procbay-schema)
|
|
6
|
-
[](https://opensource.org/licenses/MIT)
|
|
7
|
-
|
|
8
|
-
## Features
|
|
9
|
-
|
|
10
|
-
- **Schema Synchronization**: Easily synchronize your Prisma schema across multiple databases
|
|
11
|
-
- **Database Seeding**: Seed one or multiple databases with consistent data
|
|
12
|
-
- **Table Management**: Truncate specific tables with validation and safety features
|
|
13
|
-
- **Interactive Mode**: Select tables interactively for operations
|
|
14
|
-
- **Dry Run Support**: Preview changes before execution
|
|
15
|
-
- **Comprehensive Logging**: Clear, colorful console output with progress indicators
|
|
16
|
-
- **Error Handling**: Structured error handling with detailed feedback
|
|
17
|
-
|
|
18
|
-
## Installation
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
npm install procbay-schema
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
## Using Prisma Client
|
|
25
|
-
|
|
26
|
-
This package includes the full Prisma client generated from the schema, making it easy to use in your projects:
|
|
27
|
-
|
|
28
|
-
```javascript
|
|
29
|
-
import { PrismaClient } from "procbay-schema";
|
|
30
|
-
|
|
31
|
-
// Create a new Prisma client instance
|
|
32
|
-
const prisma = new PrismaClient();
|
|
33
|
-
|
|
34
|
-
async function main() {
|
|
35
|
-
// Example: Query all users
|
|
36
|
-
const users = await prisma.user.findMany({
|
|
37
|
-
include: {
|
|
38
|
-
user_roles: {
|
|
39
|
-
include: {
|
|
40
|
-
role: true,
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
// Example: Create a new user
|
|
47
|
-
const newUser = await prisma.user.create({
|
|
48
|
-
data: {
|
|
49
|
-
email_id: "john@example.com",
|
|
50
|
-
name: "John Doe",
|
|
51
|
-
first_name: "John",
|
|
52
|
-
last_name: "Doe",
|
|
53
|
-
status: "Active",
|
|
54
|
-
user_roles: {
|
|
55
|
-
create: {
|
|
56
|
-
role: {
|
|
57
|
-
connect: { id: 1 }, // Connect to an existing role
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
main()
|
|
66
|
-
.catch((e) => {
|
|
67
|
-
console.error(e);
|
|
68
|
-
process.exit(1);
|
|
69
|
-
})
|
|
70
|
-
.finally(async () => {
|
|
71
|
-
// Close the database connection when done
|
|
72
|
-
await prisma.$disconnect();
|
|
73
|
-
});
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
## CLI Usage
|
|
77
|
-
|
|
78
|
-
The package provides three main command-line utilities:
|
|
79
|
-
|
|
80
|
-
### Sync Database Schemas
|
|
81
|
-
|
|
82
|
-
Synchronize Prisma schema across multiple databases:
|
|
83
|
-
|
|
84
|
-
```bash
|
|
85
|
-
# Sync all databases
|
|
86
|
-
npx prisma-sync
|
|
87
|
-
|
|
88
|
-
# Sync a specific database
|
|
89
|
-
npx prisma-sync --db YOUR_DB_NAME
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
### Seed Databases
|
|
93
|
-
|
|
94
|
-
Seed one or multiple databases with data:
|
|
95
|
-
|
|
96
|
-
```bash
|
|
97
|
-
# Seed all databases
|
|
98
|
-
npx prisma-seed
|
|
99
|
-
|
|
100
|
-
# Seed a specific database
|
|
101
|
-
npx prisma-seed --db YOUR_DB_NAME
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
### Truncate Tables
|
|
105
|
-
|
|
106
|
-
Truncate specific tables in one or multiple databases:
|
|
107
|
-
|
|
108
|
-
```bash
|
|
109
|
-
# Truncate specific tables in all databases
|
|
110
|
-
npx prisma-truncate --tables table1,table2,table3
|
|
111
|
-
|
|
112
|
-
# Truncate specific tables in a single database
|
|
113
|
-
npx prisma-truncate --db YOUR_DB_NAME --tables table1,table2,table3
|
|
114
|
-
|
|
115
|
-
# Use interactive mode to select tables
|
|
116
|
-
npx prisma-truncate --db YOUR_DB_NAME --interactive
|
|
117
|
-
|
|
118
|
-
# Truncate all tables except specific ones
|
|
119
|
-
npx prisma-truncate --tables all --exclude _prisma_migrations,tenant_configurations
|
|
120
|
-
|
|
121
|
-
# Dry run (preview without executing)
|
|
122
|
-
npx prisma-truncate --db YOUR_DB_NAME --tables users,posts --dry-run
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
## API Usage
|
|
126
|
-
|
|
127
|
-
You can also use the package programmatically:
|
|
128
|
-
|
|
129
|
-
```javascript
|
|
130
|
-
import { syncDatabase, seedDatabase, truncateTables } from "procbay-schema";
|
|
131
|
-
|
|
132
|
-
// Sync schemas
|
|
133
|
-
syncDatabase({ db: "YOUR_DB_NAME" });
|
|
134
|
-
|
|
135
|
-
// Seed database
|
|
136
|
-
seedDatabase({ db: "YOUR_DB_NAME" });
|
|
137
|
-
|
|
138
|
-
// Truncate tables
|
|
139
|
-
truncateTables({
|
|
140
|
-
db: "YOUR_DB_NAME",
|
|
141
|
-
tables: ["users", "posts", "comments"],
|
|
142
|
-
exclude: ["migrations"],
|
|
143
|
-
dryRun: false,
|
|
144
|
-
noCascade: false,
|
|
145
|
-
noConfirm: true,
|
|
146
|
-
});
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
## Configuration
|
|
150
|
-
|
|
151
|
-
The package expects a standard Prisma configuration:
|
|
152
|
-
|
|
153
|
-
1. A `.env` file in your `prisma` directory containing database URLs in the format:
|
|
154
|
-
|
|
155
|
-
```
|
|
156
|
-
DATABASE_NAME_DATABASE_URL="postgresql://username:password@localhost:5432/database_name"
|
|
157
|
-
DEFAULT_DATABASE_URL="postgresql://username:password@localhost:5432/default_db"
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
2. A Prisma schema file at `prisma/schema.prisma`
|
|
161
|
-
|
|
162
|
-
## Schema Information
|
|
163
|
-
|
|
164
|
-
The Prisma schema included in this package contains models for a complete Procure-to-Pay system, including:
|
|
165
|
-
|
|
166
|
-
- User management (User, Role, Permission)
|
|
167
|
-
- Vendor management (Vendor, VendorCategory, VendorContactPerson)
|
|
168
|
-
- Purchase management (PurchaseIntake, PurchaseIntakeItem)
|
|
169
|
-
- Product catalog (Item, Category, Attribute)
|
|
170
|
-
- Approval workflows (ApprovalHierarchy, ApprovalLevel)
|
|
171
|
-
- And many more
|
|
172
|
-
|
|
173
|
-
## Environment Variables
|
|
174
|
-
|
|
175
|
-
- `LOG_LEVEL` - Set logging level (debug, info, warn, error, silent)
|
|
176
|
-
|
|
177
|
-
## Requirements
|
|
178
|
-
|
|
179
|
-
- Node.js >= 16.0.0
|
|
180
|
-
- Prisma >= 6.0.0
|
|
181
|
-
- PostgreSQL database
|
|
182
|
-
|
|
183
|
-
## License
|
|
184
|
-
|
|
185
|
-
MIT © Azhar Pathan
|
|
186
|
-
|
|
187
|
-
## Contributing
|
|
188
|
-
|
|
189
|
-
Contributions, issues, and feature requests are welcome! Feel free to check the [issues page](https://ntgitlab.novatechset.com/procure-2-pay/backend/schema/-/issues).
|
|
1
|
+
# procbay-schema
|
|
2
|
+
|
|
3
|
+
A set of utilities for managing Prisma database schemas, seeding, and maintenance operations for the Procure-to-Pay system.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/procbay-schema)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
|
|
8
|
+
## Features
|
|
9
|
+
|
|
10
|
+
- **Schema Synchronization**: Easily synchronize your Prisma schema across multiple databases
|
|
11
|
+
- **Database Seeding**: Seed one or multiple databases with consistent data
|
|
12
|
+
- **Table Management**: Truncate specific tables with validation and safety features
|
|
13
|
+
- **Interactive Mode**: Select tables interactively for operations
|
|
14
|
+
- **Dry Run Support**: Preview changes before execution
|
|
15
|
+
- **Comprehensive Logging**: Clear, colorful console output with progress indicators
|
|
16
|
+
- **Error Handling**: Structured error handling with detailed feedback
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install procbay-schema
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Using Prisma Client
|
|
25
|
+
|
|
26
|
+
This package includes the full Prisma client generated from the schema, making it easy to use in your projects:
|
|
27
|
+
|
|
28
|
+
```javascript
|
|
29
|
+
import { PrismaClient } from "procbay-schema";
|
|
30
|
+
|
|
31
|
+
// Create a new Prisma client instance
|
|
32
|
+
const prisma = new PrismaClient();
|
|
33
|
+
|
|
34
|
+
async function main() {
|
|
35
|
+
// Example: Query all users
|
|
36
|
+
const users = await prisma.user.findMany({
|
|
37
|
+
include: {
|
|
38
|
+
user_roles: {
|
|
39
|
+
include: {
|
|
40
|
+
role: true,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
// Example: Create a new user
|
|
47
|
+
const newUser = await prisma.user.create({
|
|
48
|
+
data: {
|
|
49
|
+
email_id: "john@example.com",
|
|
50
|
+
name: "John Doe",
|
|
51
|
+
first_name: "John",
|
|
52
|
+
last_name: "Doe",
|
|
53
|
+
status: "Active",
|
|
54
|
+
user_roles: {
|
|
55
|
+
create: {
|
|
56
|
+
role: {
|
|
57
|
+
connect: { id: 1 }, // Connect to an existing role
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
main()
|
|
66
|
+
.catch((e) => {
|
|
67
|
+
console.error(e);
|
|
68
|
+
process.exit(1);
|
|
69
|
+
})
|
|
70
|
+
.finally(async () => {
|
|
71
|
+
// Close the database connection when done
|
|
72
|
+
await prisma.$disconnect();
|
|
73
|
+
});
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## CLI Usage
|
|
77
|
+
|
|
78
|
+
The package provides three main command-line utilities:
|
|
79
|
+
|
|
80
|
+
### Sync Database Schemas
|
|
81
|
+
|
|
82
|
+
Synchronize Prisma schema across multiple databases:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
# Sync all databases
|
|
86
|
+
npx prisma-sync
|
|
87
|
+
|
|
88
|
+
# Sync a specific database
|
|
89
|
+
npx prisma-sync --db YOUR_DB_NAME
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Seed Databases
|
|
93
|
+
|
|
94
|
+
Seed one or multiple databases with data:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
# Seed all databases
|
|
98
|
+
npx prisma-seed
|
|
99
|
+
|
|
100
|
+
# Seed a specific database
|
|
101
|
+
npx prisma-seed --db YOUR_DB_NAME
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Truncate Tables
|
|
105
|
+
|
|
106
|
+
Truncate specific tables in one or multiple databases:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
# Truncate specific tables in all databases
|
|
110
|
+
npx prisma-truncate --tables table1,table2,table3
|
|
111
|
+
|
|
112
|
+
# Truncate specific tables in a single database
|
|
113
|
+
npx prisma-truncate --db YOUR_DB_NAME --tables table1,table2,table3
|
|
114
|
+
|
|
115
|
+
# Use interactive mode to select tables
|
|
116
|
+
npx prisma-truncate --db YOUR_DB_NAME --interactive
|
|
117
|
+
|
|
118
|
+
# Truncate all tables except specific ones
|
|
119
|
+
npx prisma-truncate --tables all --exclude _prisma_migrations,tenant_configurations
|
|
120
|
+
|
|
121
|
+
# Dry run (preview without executing)
|
|
122
|
+
npx prisma-truncate --db YOUR_DB_NAME --tables users,posts --dry-run
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## API Usage
|
|
126
|
+
|
|
127
|
+
You can also use the package programmatically:
|
|
128
|
+
|
|
129
|
+
```javascript
|
|
130
|
+
import { syncDatabase, seedDatabase, truncateTables } from "procbay-schema";
|
|
131
|
+
|
|
132
|
+
// Sync schemas
|
|
133
|
+
syncDatabase({ db: "YOUR_DB_NAME" });
|
|
134
|
+
|
|
135
|
+
// Seed database
|
|
136
|
+
seedDatabase({ db: "YOUR_DB_NAME" });
|
|
137
|
+
|
|
138
|
+
// Truncate tables
|
|
139
|
+
truncateTables({
|
|
140
|
+
db: "YOUR_DB_NAME",
|
|
141
|
+
tables: ["users", "posts", "comments"],
|
|
142
|
+
exclude: ["migrations"],
|
|
143
|
+
dryRun: false,
|
|
144
|
+
noCascade: false,
|
|
145
|
+
noConfirm: true,
|
|
146
|
+
});
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Configuration
|
|
150
|
+
|
|
151
|
+
The package expects a standard Prisma configuration:
|
|
152
|
+
|
|
153
|
+
1. A `.env` file in your `prisma` directory containing database URLs in the format:
|
|
154
|
+
|
|
155
|
+
```
|
|
156
|
+
DATABASE_NAME_DATABASE_URL="postgresql://username:password@localhost:5432/database_name"
|
|
157
|
+
DEFAULT_DATABASE_URL="postgresql://username:password@localhost:5432/default_db"
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
2. A Prisma schema file at `prisma/schema.prisma`
|
|
161
|
+
|
|
162
|
+
## Schema Information
|
|
163
|
+
|
|
164
|
+
The Prisma schema included in this package contains models for a complete Procure-to-Pay system, including:
|
|
165
|
+
|
|
166
|
+
- User management (User, Role, Permission)
|
|
167
|
+
- Vendor management (Vendor, VendorCategory, VendorContactPerson)
|
|
168
|
+
- Purchase management (PurchaseIntake, PurchaseIntakeItem)
|
|
169
|
+
- Product catalog (Item, Category, Attribute)
|
|
170
|
+
- Approval workflows (ApprovalHierarchy, ApprovalLevel)
|
|
171
|
+
- And many more
|
|
172
|
+
|
|
173
|
+
## Environment Variables
|
|
174
|
+
|
|
175
|
+
- `LOG_LEVEL` - Set logging level (debug, info, warn, error, silent)
|
|
176
|
+
|
|
177
|
+
## Requirements
|
|
178
|
+
|
|
179
|
+
- Node.js >= 16.0.0
|
|
180
|
+
- Prisma >= 6.0.0
|
|
181
|
+
- PostgreSQL database
|
|
182
|
+
|
|
183
|
+
## License
|
|
184
|
+
|
|
185
|
+
MIT © Azhar Pathan
|
|
186
|
+
|
|
187
|
+
## Contributing
|
|
188
|
+
|
|
189
|
+
Contributions, issues, and feature requests are welcome! Feel free to check the [issues page](https://ntgitlab.novatechset.com/procure-2-pay/backend/schema/-/issues).
|
package/package.json
CHANGED
|
@@ -1,77 +1,77 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "procbay-schema",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "A set of utilities for managing Prisma database schemas, seeding, and maintenance operations for the Procure-to-Pay system",
|
|
5
|
-
"main": "src/prisma/index.js",
|
|
6
|
-
"type": "module",
|
|
7
|
-
"bin": {
|
|
8
|
-
"prisma-sync": "scripts/sync-schemas.js",
|
|
9
|
-
"prisma-seed": "scripts/seed-databases.js",
|
|
10
|
-
"prisma-truncate": "scripts/truncate-tables.js"
|
|
11
|
-
},
|
|
12
|
-
"files": [
|
|
13
|
-
"prisma/seeders",
|
|
14
|
-
"prisma/migrations",
|
|
15
|
-
"prisma/.env",
|
|
16
|
-
"prisma/schema.prisma",
|
|
17
|
-
"src/prisma",
|
|
18
|
-
"package.json",
|
|
19
|
-
"README.md",
|
|
20
|
-
"LICENSE"
|
|
21
|
-
],
|
|
22
|
-
"devDependencies": {
|
|
23
|
-
"@types/bcrypt": "^5.0.2",
|
|
24
|
-
"@types/jest": "^30.0.0",
|
|
25
|
-
"eslint": "^9.30.1",
|
|
26
|
-
"husky": "^9.1.7",
|
|
27
|
-
"jest": "^29.7.0",
|
|
28
|
-
"lint-staged": "^16.1.2",
|
|
29
|
-
"prettier": "^3.6.2",
|
|
30
|
-
"prisma": "^6.7.0"
|
|
31
|
-
},
|
|
32
|
-
"dependencies": {
|
|
33
|
-
"@prisma/client": "^6.7.0",
|
|
34
|
-
"bcrypt": "^5.1.1",
|
|
35
|
-
"colors": "^1.4.0",
|
|
36
|
-
"dotenv": "^16.4.5",
|
|
37
|
-
"readline": "^1.3.0"
|
|
38
|
-
},
|
|
39
|
-
"prisma": {
|
|
40
|
-
"seed": "node prisma/seeders/seed.js"
|
|
41
|
-
},
|
|
42
|
-
"scripts": {
|
|
43
|
-
"sync-database": "node scripts/sync-schemas.js",
|
|
44
|
-
"seed-database": "node scripts/seed-databases.js",
|
|
45
|
-
"truncate-tables": "node scripts/truncate-tables.js",
|
|
46
|
-
"test": "echo \"Error: no test specified\" && exit 1",
|
|
47
|
-
"prepare": "prisma generate"
|
|
48
|
-
},
|
|
49
|
-
"keywords": [
|
|
50
|
-
"prisma",
|
|
51
|
-
"database",
|
|
52
|
-
"schema",
|
|
53
|
-
"seed",
|
|
54
|
-
"truncate",
|
|
55
|
-
"utilities",
|
|
56
|
-
"cli",
|
|
57
|
-
"postgresql",
|
|
58
|
-
"procure-to-pay",
|
|
59
|
-
"procbay"
|
|
60
|
-
],
|
|
61
|
-
"author": "Azhar Pathan <apathan@katalysttech.com>",
|
|
62
|
-
"license": "MIT",
|
|
63
|
-
"repository": {
|
|
64
|
-
"type": "gitlab",
|
|
65
|
-
"url": "https://ntgitlab.novatechset.com/procure-2-pay/backend/schema"
|
|
66
|
-
},
|
|
67
|
-
"bugs": {
|
|
68
|
-
"url": "https://ntgitlab.novatechset.com/procure-2-pay/backend/schema/-/issues"
|
|
69
|
-
},
|
|
70
|
-
"homepage": "https://ntgitlab.novatechset.com/procure-2-pay/backend/schema#readme",
|
|
71
|
-
"engines": {
|
|
72
|
-
"node": ">=16.0.0"
|
|
73
|
-
},
|
|
74
|
-
"publishConfig": {
|
|
75
|
-
"access": "public"
|
|
76
|
-
}
|
|
77
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "procbay-schema",
|
|
3
|
+
"version": "1.0.31",
|
|
4
|
+
"description": "A set of utilities for managing Prisma database schemas, seeding, and maintenance operations for the Procure-to-Pay system",
|
|
5
|
+
"main": "src/prisma/index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"prisma-sync": "scripts/sync-schemas.js",
|
|
9
|
+
"prisma-seed": "scripts/seed-databases.js",
|
|
10
|
+
"prisma-truncate": "scripts/truncate-tables.js"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"prisma/seeders",
|
|
14
|
+
"prisma/migrations",
|
|
15
|
+
"prisma/.env",
|
|
16
|
+
"prisma/schema.prisma",
|
|
17
|
+
"src/prisma",
|
|
18
|
+
"package.json",
|
|
19
|
+
"README.md",
|
|
20
|
+
"LICENSE"
|
|
21
|
+
],
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@types/bcrypt": "^5.0.2",
|
|
24
|
+
"@types/jest": "^30.0.0",
|
|
25
|
+
"eslint": "^9.30.1",
|
|
26
|
+
"husky": "^9.1.7",
|
|
27
|
+
"jest": "^29.7.0",
|
|
28
|
+
"lint-staged": "^16.1.2",
|
|
29
|
+
"prettier": "^3.6.2",
|
|
30
|
+
"prisma": "^6.7.0"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@prisma/client": "^6.7.0",
|
|
34
|
+
"bcrypt": "^5.1.1",
|
|
35
|
+
"colors": "^1.4.0",
|
|
36
|
+
"dotenv": "^16.4.5",
|
|
37
|
+
"readline": "^1.3.0"
|
|
38
|
+
},
|
|
39
|
+
"prisma": {
|
|
40
|
+
"seed": "node prisma/seeders/seed.js"
|
|
41
|
+
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"sync-database": "node scripts/sync-schemas.js",
|
|
44
|
+
"seed-database": "node scripts/seed-databases.js",
|
|
45
|
+
"truncate-tables": "node scripts/truncate-tables.js",
|
|
46
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
47
|
+
"prepare": "prisma generate"
|
|
48
|
+
},
|
|
49
|
+
"keywords": [
|
|
50
|
+
"prisma",
|
|
51
|
+
"database",
|
|
52
|
+
"schema",
|
|
53
|
+
"seed",
|
|
54
|
+
"truncate",
|
|
55
|
+
"utilities",
|
|
56
|
+
"cli",
|
|
57
|
+
"postgresql",
|
|
58
|
+
"procure-to-pay",
|
|
59
|
+
"procbay"
|
|
60
|
+
],
|
|
61
|
+
"author": "Azhar Pathan <apathan@katalysttech.com>",
|
|
62
|
+
"license": "MIT",
|
|
63
|
+
"repository": {
|
|
64
|
+
"type": "gitlab",
|
|
65
|
+
"url": "https://ntgitlab.novatechset.com/procure-2-pay/backend/schema"
|
|
66
|
+
},
|
|
67
|
+
"bugs": {
|
|
68
|
+
"url": "https://ntgitlab.novatechset.com/procure-2-pay/backend/schema/-/issues"
|
|
69
|
+
},
|
|
70
|
+
"homepage": "https://ntgitlab.novatechset.com/procure-2-pay/backend/schema#readme",
|
|
71
|
+
"engines": {
|
|
72
|
+
"node": ">=16.0.0"
|
|
73
|
+
},
|
|
74
|
+
"publishConfig": {
|
|
75
|
+
"access": "public"
|
|
76
|
+
}
|
|
77
|
+
}
|
package/prisma/.env
CHANGED
|
@@ -1,13 +1,21 @@
|
|
|
1
|
-
# Environment variables declared in this file are automatically made available to Prisma.
|
|
2
|
-
# See the documentation for more detail: https://pris.ly/d/prisma-schema#accessing-environment-variables-from-the-schema
|
|
3
|
-
|
|
4
|
-
# Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB.
|
|
5
|
-
# See the documentation for all the connection string options: https://pris.ly/d/connection-strings
|
|
6
|
-
|
|
7
|
-
DEFAULT_DATABASE_URL="postgresql://postgres:root@localhost:5432/procbay_db?schema=procbay_schema"
|
|
8
|
-
ARVIND_DATABASE_URL="postgresql://p2puser:dShd190AK0e@172.16.2.27:5432/arvind_procbay_db?schema=procbay_schema"
|
|
9
|
-
AZHAR_DATABASE_URL="postgresql://p2puser:dShd190AK0e@172.16.2.27:5432/azhar_procbay_db?schema=procbay_schema"
|
|
10
|
-
HARSH_DATABASE_URL="postgresql://p2puser:dShd190AK0e@172.16.2.27:5432/harsh_procbay_db?schema=procbay_schema"
|
|
11
|
-
VAIBHAV_DATABASE_URL="postgresql://p2puser:dShd190AK0e@172.16.2.27:5432/vaibhav_procbay_db?schema=procbay_schema"
|
|
12
|
-
|
|
1
|
+
# Environment variables declared in this file are automatically made available to Prisma.
|
|
2
|
+
# See the documentation for more detail: https://pris.ly/d/prisma-schema#accessing-environment-variables-from-the-schema
|
|
3
|
+
|
|
4
|
+
# Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB.
|
|
5
|
+
# See the documentation for all the connection string options: https://pris.ly/d/connection-strings
|
|
6
|
+
|
|
7
|
+
# DEFAULT_DATABASE_URL="postgresql://postgres:root@localhost:5432/procbay_db?schema=procbay_schema"
|
|
8
|
+
# ARVIND_DATABASE_URL="postgresql://p2puser:dShd190AK0e@172.16.2.27:5432/arvind_procbay_db?schema=procbay_schema"
|
|
9
|
+
# AZHAR_DATABASE_URL="postgresql://p2puser:dShd190AK0e@172.16.2.27:5432/azhar_procbay_db?schema=procbay_schema"
|
|
10
|
+
# HARSH_DATABASE_URL="postgresql://p2puser:dShd190AK0e@172.16.2.27:5432/harsh_procbay_db?schema=procbay_schema"
|
|
11
|
+
# VAIBHAV_DATABASE_URL="postgresql://p2puser:dShd190AK0e@172.16.2.27:5432/vaibhav_procbay_db?schema=procbay_schema"
|
|
12
|
+
|
|
13
|
+
DEFAULT_DATABASE_URL="postgresql://postgres:admin@localhost:5432/procbay_db?schema=procbay_schema"
|
|
14
|
+
# ARVIND_DATABASE_URL="postgresql://p2puser:dShd190AK0e@172.16.2.27:5432/arvind_procbay_db?schema=procbay_schema"
|
|
15
|
+
# AZHAR_DATABASE_URL="postgresql://p2puser:dShd190AK0e@172.16.2.27:5432/azhar_procbay_db?schema=procbay_schema"
|
|
16
|
+
# HARSH_DATABASE_URL="postgresql://p2puser:dShd190AK0e@172.16.2.27:5432/harsh_procbay_db?schema=procbay_schema"
|
|
17
|
+
# VAIBHAV_DATABASE_URL="postgresql://p2puser:dShd190AK0e@172.16.2.27:5432/vaibhav_procbay_db?schema=procbay_schema"
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
DETAILED_LOGGING=true
|
|
13
21
|
LOG_LEVEL=info
|