@reldens/storage 0.102.0 → 0.104.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/CLAUDE.md +1 -1
- package/lib/entity-templates/prisma-model.template +1 -1
- package/lib/generators/models-generation.js +1 -1
- package/lib/prisma/prisma-client-loader.js +1 -1
- package/lib/prisma/prisma-metadata-loader.js +1 -2
- package/lib/prisma/prisma-schema-generator.js +3 -2
- package/package.json +2 -2
- package/tests/utils/test-helpers.js +1 -1
package/CLAUDE.md
CHANGED
|
@@ -150,7 +150,7 @@ npx reldens-storage-prisma --host=<host> --database=<db> --user=<user> --passwor
|
|
|
150
150
|
- **Type caster isolation**: PrismaTypeCaster never requires `@prisma/client` directly, receives `prismaDbNull` as prop
|
|
151
151
|
- **Prisma v7 breaking changes applied:**
|
|
152
152
|
- Requires `@prisma/adapter-mariadb` for MySQL connections (WASM engine mandates a driver adapter)
|
|
153
|
-
- `datasource` block in `schema.prisma` no longer accepts `url` - connection URL is provided via `prisma.config.js` generated at project root using `{ datasource: { url: process.env.
|
|
153
|
+
- `datasource` block in `schema.prisma` no longer accepts `url` - connection URL is provided via `prisma.config.js` generated at project root using `process.loadEnvFile('.env')` + `{ datasource: { url: process.env.RELDENS_DB_URL } }`
|
|
154
154
|
- `PrismaClient` constructor no longer accepts `datasources` or `datasourceUrl` - use `adapter: new PrismaMariaDb(connectionString)` instead
|
|
155
155
|
- `provider = "prisma-client-js"` is kept (deprecated but functional); switching to `prisma-client` would require additional adapter changes
|
|
156
156
|
- `_runtimeDataModel` in Prisma 7 is pruned: fields only contain `{ name, kind, type, relationName, dbName }` - `isId`, `isRequired`, `hasDefaultValue` are stripped. ID field detection falls back to `field.name === 'id' && field.kind === 'scalar'`
|
|
@@ -84,7 +84,7 @@ class ModelsGeneration extends BaseGenerator
|
|
|
84
84
|
|
|
85
85
|
generateIdColumn(columns, driverKey)
|
|
86
86
|
{
|
|
87
|
-
if('objection-js' !== driverKey){
|
|
87
|
+
if('objection-js' !== driverKey && 'prisma' !== driverKey){
|
|
88
88
|
return '';
|
|
89
89
|
}
|
|
90
90
|
let primaryKeyColumn = this.detectPrimaryKeyColumn(columns);
|
|
@@ -29,7 +29,7 @@ class PrismaClientLoader
|
|
|
29
29
|
}
|
|
30
30
|
if(!connectionData){
|
|
31
31
|
Logger.info('Creating PrismaClient with default connection from schema');
|
|
32
|
-
return PrismaClientLoader.createWithAdapter(prismaModule.PrismaClient, process.env.
|
|
32
|
+
return PrismaClientLoader.createWithAdapter(prismaModule.PrismaClient, process.env.RELDENS_DB_URL);
|
|
33
33
|
}
|
|
34
34
|
let connectionString = connectionData.client+'://'
|
|
35
35
|
+connectionData.user
|
|
@@ -79,8 +79,7 @@ class PrismaMetadataLoader
|
|
|
79
79
|
if('Json' === field.type){
|
|
80
80
|
metadata.jsonFields.add(field.name);
|
|
81
81
|
}
|
|
82
|
-
|
|
83
|
-
if(isIdField){
|
|
82
|
+
if(field.name === sc.get(this.rawModel, 'idColumn', 'id')){
|
|
84
83
|
metadata.idFieldType = field.type;
|
|
85
84
|
metadata.idFieldName = field.name;
|
|
86
85
|
}
|
|
@@ -96,7 +96,7 @@ class PrismaSchemaGenerator
|
|
|
96
96
|
setDatabaseEnvironmentVariables()
|
|
97
97
|
{
|
|
98
98
|
let datasourceProvider = this.getDatasourceProvider();
|
|
99
|
-
process.env.
|
|
99
|
+
process.env.RELDENS_DB_URL = this.buildConnectionString(datasourceProvider);
|
|
100
100
|
if(this.dataProxy){
|
|
101
101
|
process.env.DATABASE_DIRECT_URL = this.buildDirectConnectionString(datasourceProvider);
|
|
102
102
|
}
|
|
@@ -139,7 +139,8 @@ class PrismaSchemaGenerator
|
|
|
139
139
|
|
|
140
140
|
generateConfigFile()
|
|
141
141
|
{
|
|
142
|
-
let configContent = '
|
|
142
|
+
let configContent = 'process.loadEnvFile(\'.env\');\n'
|
|
143
|
+
+'module.exports = { datasource: { url: process.env.RELDENS_DB_URL } };\n';
|
|
143
144
|
let configPath = FileHandler.joinPaths(process.cwd(), 'prisma.config.js');
|
|
144
145
|
FileHandler.writeFile(configPath, configContent);
|
|
145
146
|
Logger.info('Generated Prisma config file at: '+configPath);
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reldens/storage",
|
|
3
3
|
"scope": "@reldens",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.104.0",
|
|
5
5
|
"description": "Reldens - Storage",
|
|
6
6
|
"author": "Damian A. Pastorini",
|
|
7
7
|
"license": "MIT",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"@reldens/utils": "^0.57.0",
|
|
61
61
|
"knex": "3.3.0",
|
|
62
62
|
"mysql": "2.18.1",
|
|
63
|
-
"mysql2": "3.22.
|
|
63
|
+
"mysql2": "3.22.6",
|
|
64
64
|
"objection": "3.1.5",
|
|
65
65
|
"prisma": "7.8.0"
|
|
66
66
|
}
|
|
@@ -387,7 +387,7 @@ class TestHelpers
|
|
|
387
387
|
let { PrismaMariaDb } = require('@prisma/adapter-mariadb');
|
|
388
388
|
let adapterConfig = config
|
|
389
389
|
? { host: config.host, port: config.port, user: config.user, password: config.password, database: config.database }
|
|
390
|
-
: process.env.
|
|
390
|
+
: process.env.RELDENS_DB_URL;
|
|
391
391
|
let client = new PrismaClient({ adapter: new PrismaMariaDb(adapterConfig) });
|
|
392
392
|
await client.$connect();
|
|
393
393
|
return client;
|