Fix language code FK being generated as integer

Fixes #441
This commit is contained in:
rijkvanzanten
2020-09-29 18:52:25 -04:00
parent e69a01991c
commit 2588992bdf

View File

@@ -376,18 +376,33 @@ function initLocalStore(
}
if (fieldExists(junctionCollection, manyRelated) === false) {
state.newFields.push({
$type: 'manyRelated',
collection: junctionCollection,
field: manyRelated,
type: collectionExists(relatedCollection)
? fieldsStore.getPrimaryKeyFieldForCollection(relatedCollection)?.type
: 'integer',
schema: {},
meta: {
hidden: true,
},
});
if (type === 'translations') {
state.newFields.push({
$type: 'manyRelated',
collection: junctionCollection,
field: manyRelated,
type: collectionExists(relatedCollection)
? fieldsStore.getPrimaryKeyFieldForCollection(relatedCollection)?.type
: 'string',
schema: {},
meta: {
hidden: true,
},
});
} else {
state.newFields.push({
$type: 'manyRelated',
collection: junctionCollection,
field: manyRelated,
type: collectionExists(relatedCollection)
? fieldsStore.getPrimaryKeyFieldForCollection(relatedCollection)?.type
: 'integer',
schema: {},
meta: {
hidden: true,
},
});
}
}
if (collectionExists(relatedCollection) === false) {