prisma-laravel-migrate 0.0.70 → 0.1.2
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.
|
@@ -65,6 +65,7 @@ export class ColumnDefinitionGenerator {
|
|
|
65
65
|
onDelete: this.mapPrismaAction(field.relationOnDelete),
|
|
66
66
|
onUpdate: this.mapPrismaAction(field.relationOnUpdate),
|
|
67
67
|
ignore: isForMigrator(parseLocalDirective(field.documentation)) || (field.relationFromFields?.length ?? 0) === 0,
|
|
68
|
+
local: isForMigrator(parseLocalDirective(field.documentation)),
|
|
68
69
|
fields: field.relationFromFields ?? [],
|
|
69
70
|
};
|
|
70
71
|
base.ignore = base.relationship?.ignore;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PrismaTypes } from "../migrator/column-maps.js";
|
|
2
2
|
import { buildRelationsForModel } from "./relationship/index.js";
|
|
3
|
-
import { isForModel, parseSilentDirective } from "utils/utils";
|
|
3
|
+
import { isForModel, parseSilentDirective } from "../../utils/utils.js";
|
|
4
4
|
/**
|
|
5
5
|
* Build ModelDefinition[] + EnumDefinition[] from your DMMF.
|
|
6
6
|
*/
|
package/dist/utils/sort.js
CHANGED
|
@@ -8,7 +8,9 @@
|
|
|
8
8
|
*/
|
|
9
9
|
export function sortMigrations(migrations) {
|
|
10
10
|
// 1) Build a map: tableName → Migration
|
|
11
|
-
const migMap = new Map(migrations
|
|
11
|
+
const migMap = new Map(migrations
|
|
12
|
+
.filter(m => !m.local) // skip ignored models
|
|
13
|
+
.map(m => [m.tableName, m]));
|
|
12
14
|
// 2) Collect “true” FKs only (skip back‐relation object fields)
|
|
13
15
|
const rawDeps = new Map();
|
|
14
16
|
for (const { tableName } of migrations) {
|
|
@@ -21,6 +23,7 @@ export function sortMigrations(migrations) {
|
|
|
21
23
|
// - this field is a scalar FK column (def.kind === 'scalar')
|
|
22
24
|
// - it's the owning side (relationFromFields non-empty)
|
|
23
25
|
if (!def.relationship ||
|
|
26
|
+
!def.relationship.local ||
|
|
24
27
|
!def.relationFromFields ||
|
|
25
28
|
def.relationFromFields.length === 0) {
|
|
26
29
|
continue;
|