@friggframework/core 2.0.0--canary.461.97d93c9.0 → 2.0.0--canary.461.74b99c9.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.
Files changed (2) hide show
  1. package/database/config.js +17 -2
  2. package/package.json +5 -5
@@ -4,13 +4,28 @@
4
4
  */
5
5
 
6
6
  /**
7
- * Determines database type from app definition
8
- * Reads backend/index.js Definition.database configuration
7
+ * Determines database type from DATABASE_URL or app definition
8
+ *
9
+ * Detection order:
10
+ * 1. DATABASE_URL protocol (for migration handlers - avoids loading app definition)
11
+ * 2. App definition (backend/index.js Definition.database configuration)
9
12
  *
10
13
  * @returns {'mongodb'|'postgresql'} Database type
11
14
  * @throws {Error} If database type cannot be determined or app definition missing
12
15
  */
13
16
  function getDatabaseType() {
17
+ // First, try to detect from DATABASE_URL (migration handlers don't need app definition)
18
+ const databaseUrl = process.env.DATABASE_URL;
19
+ if (databaseUrl) {
20
+ if (databaseUrl.startsWith('postgresql://') || databaseUrl.startsWith('postgres://')) {
21
+ return 'postgresql';
22
+ }
23
+ if (databaseUrl.startsWith('mongodb://') || databaseUrl.startsWith('mongodb+srv://')) {
24
+ return 'mongodb';
25
+ }
26
+ }
27
+
28
+ // Fallback: Load app definition
14
29
  try {
15
30
  const path = require('node:path');
16
31
  const fs = require('node:fs');
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@friggframework/core",
3
3
  "prettier": "@friggframework/prettier-config",
4
- "version": "2.0.0--canary.461.97d93c9.0",
4
+ "version": "2.0.0--canary.461.74b99c9.0",
5
5
  "dependencies": {
6
6
  "@aws-sdk/client-apigatewaymanagementapi": "^3.588.0",
7
7
  "@aws-sdk/client-kms": "^3.588.0",
@@ -37,9 +37,9 @@
37
37
  }
38
38
  },
39
39
  "devDependencies": {
40
- "@friggframework/eslint-config": "2.0.0--canary.461.97d93c9.0",
41
- "@friggframework/prettier-config": "2.0.0--canary.461.97d93c9.0",
42
- "@friggframework/test": "2.0.0--canary.461.97d93c9.0",
40
+ "@friggframework/eslint-config": "2.0.0--canary.461.74b99c9.0",
41
+ "@friggframework/prettier-config": "2.0.0--canary.461.74b99c9.0",
42
+ "@friggframework/test": "2.0.0--canary.461.74b99c9.0",
43
43
  "@prisma/client": "^6.17.0",
44
44
  "@types/lodash": "4.17.15",
45
45
  "@typescript-eslint/eslint-plugin": "^8.0.0",
@@ -79,5 +79,5 @@
79
79
  "publishConfig": {
80
80
  "access": "public"
81
81
  },
82
- "gitHead": "97d93c9143829a56c166c50c1127961fba83bfa0"
82
+ "gitHead": "74b99c9d56dce5e4ea9f74f2db3a6087132578d3"
83
83
  }