@shogo-ai/db 2.5.4 → 2.5.6
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/dist/index.cjs +7 -3
- package/dist/index.js +7 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -172,14 +172,18 @@ var POSTGRES_TO_SQLITE_TRANSFORMS = [
|
|
|
172
172
|
{ pattern: /@default\(uuid\(\)\)/g, replacement: "@default(cuid())" },
|
|
173
173
|
// dbgenerated() with PostgreSQL-specific functions
|
|
174
174
|
{ pattern: /@default\(dbgenerated\("gen_random_uuid\(\)"\)\)/g, replacement: "@default(cuid())" },
|
|
175
|
-
// auto() is
|
|
175
|
+
// auto() is MongoDB-only; earlier versions of the SQLite → PostgreSQL
|
|
176
|
+
// transform wrote it, so a schema switched back from one of those recovers.
|
|
176
177
|
{ pattern: /@default\(auto\(\)\)/g, replacement: "@default(autoincrement())" },
|
|
177
178
|
// Remove @db.* native type annotations (SQLite doesn't support these)
|
|
178
179
|
{ pattern: /@db\.\w+(\([^)]*\))?/g, replacement: "" }
|
|
179
180
|
];
|
|
180
181
|
var SQLITE_TO_POSTGRES_TRANSFORMS = [
|
|
181
|
-
// autoincrement() is
|
|
182
|
-
|
|
182
|
+
// `@default(autoincrement())` is valid on both (a serial column on
|
|
183
|
+
// PostgreSQL) and stays as is. Never rewrite it to `auto()`: that is the
|
|
184
|
+
// MongoDB connector's function and fails PostgreSQL schema validation.
|
|
185
|
+
// A schema written by an earlier version of this transform is repaired here.
|
|
186
|
+
{ pattern: /@default\(auto\(\)\)/g, replacement: "@default(autoincrement())" }
|
|
183
187
|
];
|
|
184
188
|
function detectSchemaProvider(schemaContent) {
|
|
185
189
|
if (schemaContent.includes('provider = "postgresql"') || schemaContent.includes("provider = 'postgresql'")) {
|
package/dist/index.js
CHANGED
|
@@ -131,14 +131,18 @@ var POSTGRES_TO_SQLITE_TRANSFORMS = [
|
|
|
131
131
|
{ pattern: /@default\(uuid\(\)\)/g, replacement: "@default(cuid())" },
|
|
132
132
|
// dbgenerated() with PostgreSQL-specific functions
|
|
133
133
|
{ pattern: /@default\(dbgenerated\("gen_random_uuid\(\)"\)\)/g, replacement: "@default(cuid())" },
|
|
134
|
-
// auto() is
|
|
134
|
+
// auto() is MongoDB-only; earlier versions of the SQLite → PostgreSQL
|
|
135
|
+
// transform wrote it, so a schema switched back from one of those recovers.
|
|
135
136
|
{ pattern: /@default\(auto\(\)\)/g, replacement: "@default(autoincrement())" },
|
|
136
137
|
// Remove @db.* native type annotations (SQLite doesn't support these)
|
|
137
138
|
{ pattern: /@db\.\w+(\([^)]*\))?/g, replacement: "" }
|
|
138
139
|
];
|
|
139
140
|
var SQLITE_TO_POSTGRES_TRANSFORMS = [
|
|
140
|
-
// autoincrement() is
|
|
141
|
-
|
|
141
|
+
// `@default(autoincrement())` is valid on both (a serial column on
|
|
142
|
+
// PostgreSQL) and stays as is. Never rewrite it to `auto()`: that is the
|
|
143
|
+
// MongoDB connector's function and fails PostgreSQL schema validation.
|
|
144
|
+
// A schema written by an earlier version of this transform is repaired here.
|
|
145
|
+
{ pattern: /@default\(auto\(\)\)/g, replacement: "@default(autoincrement())" }
|
|
142
146
|
];
|
|
143
147
|
function detectSchemaProvider(schemaContent) {
|
|
144
148
|
if (schemaContent.includes('provider = "postgresql"') || schemaContent.includes("provider = 'postgresql'")) {
|