@instantdb/platform 0.22.157 → 0.22.158
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/.turbo/turbo-build.log +8 -8
- package/__tests__/src/migrations.test.ts +111 -0
- package/dist/commonjs/migrations.d.ts.map +1 -1
- package/dist/commonjs/migrations.js +8 -0
- package/dist/commonjs/migrations.js.map +1 -1
- package/dist/esm/migrations.d.ts.map +1 -1
- package/dist/esm/migrations.js +8 -0
- package/dist/esm/migrations.js.map +1 -1
- package/dist/standalone/index.js +9 -6
- package/dist/standalone/index.umd.cjs +2 -2
- package/package.json +3 -3
- package/src/migrations.ts +9 -0
package/src/migrations.ts
CHANGED
|
@@ -692,11 +692,13 @@ export const compareLinks = (
|
|
|
692
692
|
`${oldLink.forward.has}-${oldLink.reverse.has}` as RelationshipKinds;
|
|
693
693
|
const { cardinality: oldCardinal, 'unique?': oldUnique } =
|
|
694
694
|
relationshipConstraints[oldRelationship];
|
|
695
|
+
const oldRequired = !!oldLink.forward.required;
|
|
695
696
|
|
|
696
697
|
const newRelationship =
|
|
697
698
|
`${newLink.forward.has}-${newLink.reverse.has}` as RelationshipKinds;
|
|
698
699
|
const { cardinality: newCardinal, 'unique?': newUnique } =
|
|
699
700
|
relationshipConstraints[newRelationship];
|
|
701
|
+
const newRequired = !!newLink.forward.required;
|
|
700
702
|
|
|
701
703
|
if (!oldUnique && newUnique) {
|
|
702
704
|
results.push({
|
|
@@ -711,6 +713,13 @@ export const compareLinks = (
|
|
|
711
713
|
});
|
|
712
714
|
}
|
|
713
715
|
|
|
716
|
+
if (newRequired !== oldRequired) {
|
|
717
|
+
results.push({
|
|
718
|
+
type: newRequired ? 'required' : 'remove-required',
|
|
719
|
+
identifier: identity,
|
|
720
|
+
});
|
|
721
|
+
}
|
|
722
|
+
|
|
714
723
|
if (
|
|
715
724
|
oldLink.reverse.onDelete !== newLink.reverse.onDelete ||
|
|
716
725
|
oldLink.forward.onDelete !== newLink.forward.onDelete ||
|