Skip to content

Prevent sync_schema_config_fields from creating schema records for {table}Id fields #8065

@grantfitzsimmons

Description

@grantfitzsimmons

This was handled in b95e421#diff-8c096fc6189e8fbf5f9c608c661989ccfecee166ec4222127550478775f9d1e9 in v7.12.0.4-berlin, but needs to be integrated into main again after changes from v7.12.0.5 and v7.12.0.6. It was decided that creating schema config values for ID fields is not currently in the plans.

See it described here: https://discourse.specifysoftware.org/t/fix-missing-resources-in-a-specify-database/3599

It should only create schema config records for fields that are expected to have schema records (non ID fields).

Current

specify@62c69a171f67:/opt/specify7$ ve/bin/python manage.py sync_schema_config_fields --discipline-id 3
[28/Apr/2026 03:25:34] [WARNING] [specifyweb.backend.setup_tool.apps:18] Failed to retrieve last active setup task.
[28/Apr/2026 03:25:34] [WARNING] [specifyweb.backend.trees.apps:19] Failed to retrieve default tree creation information.
Discipline: Ornithology (ID=3)
Missing table containers:
- Component
- DNASequencingRunAttachment
- LocalityUpdate
- LocalityUpdateRowResult
Missing fields:
- AbsoluteAge: component
- Accession: accessionId
- AccessionAgent: accessionAgentId
- AccessionAttachment: accessionAttachmentId
- AccessionAuthorization: accessionAuthorizationId
- AccessionCitation: accessionCitationId
- Address: addressId
- AddressOfRecord: addressOfRecordId
- Agent: agentId, components
- AgentAttachment: agentAttachmentId
- AgentGeography: agentGeographyId
- AgentIdentifier: agentIdentifierId
- AgentSpecialty: agentSpecialtyId
- AgentVariant: agentVariantId
- Appraisal: appraisalId
- Attachment: attachmentId, spDataSetAttachments
- AttachmentImageAttribute: attachmentImageAttributeId
- AttachmentMetadata: attachmentMetadataID
- AttachmentTag: attachmentTagID
- AttributeDef: attributeDefId
- Author: authorId
- AutoNumberingScheme: autoNumberingSchemeId
- Borrow: borrowId
- BorrowAgent: borrowAgentId
- BorrowAttachment: borrowAttachmentId
- BorrowMaterial: borrowMaterialId
- BorrowReturnMaterial: borrowReturnMaterialId
- CollectingEvent: collectingEventId
- CollectingEventAttachment: collectingEventAttachmentId
- CollectingEventAttr: attrId
- CollectingEventAttribute: collectingEventAttributeId
- CollectingEventAuthorization: collectingEventAuthorizationId
- CollectingTrip: collectingTripId
- CollectingTripAttachment: collectingTripAttachmentId
- CollectingTripAttribute: collectingTripAttributeId
- CollectingTripAuthorization: collectingTripAuthorizationId
- Collection: userGroupScopeId
- CollectionObject: collectionObjectId
- CollectionObjectAttachment: collectionObjectAttachmentId
- CollectionObjectAttr: attrId
- CollectionObjectAttribute: collectionObjectAttributeId
- CollectionObjectCitation: collectionObjectCitationId
- CollectionObjectProperty: collectionObjectPropertyId
- CollectionRelType: collectionRelTypeId
- CollectionRelationship: collectionRelationshipId
- Collector: collectorId
- CommonNameTx: commonNameTxId
- CommonNameTxCitation: commonNameTxCitationId
- Component: absoluteAges, catalogNumber, collectionObject, componentId, createdByAgent, identifiedBy, identifiedDate, integer1, integer2, integer3, integer4, integer5, integer6, modifiedByAgent, name, number1, number2, number3, number4, number5, number6, proportion, relativeAges, role, text1, text2, text3, text4, text5, text6, timestampCreated, timestampModified, type, uniqueIdentifier, verbatimName, version, yesNo1, yesNo2, yesNo3, yesNo4, yesNo5, yesNo6
- ConservDescription: conservDescriptionId
- ConservDescriptionAttachment: conservDescriptionAttachmentId
- ConservEvent: conservEventId
- ConservEventAttachment: conservEventAttachmentId
- Container: containerId
- DNAPrimer: dnaPrimerId
- DNASequence: dnaSequenceId
- DNASequenceAttachment: dnaSequenceAttachmentId
- DNASequencingRun: dnaSequencingRunId
- DNASequencingRunAttachment: attachment, createdByAgent, dnaSequencingRun, dnaSequencingRunAttachmentId, modifiedByAgent, ordinal, remarks, timestampCreated, timestampModified, version
- DNASequencingRunCitation: dnaSequencingRunCitationId
- DataType: dataTypeId
- Deaccession: deaccessionId
- DeaccessionAgent: deaccessionAgentId
- DeaccessionAttachment: deaccessionAttachmentId
- Determination: determinationId
- DeterminationCitation: determinationCitationId
- Determiner: determinerId
- Discipline: tectonicUnitTreeDef, userGroupScopeId
- Disposal: disposalId
- DisposalAgent: disposalAgentId
- DisposalAttachment: disposalAttachmentId
- DisposalPreparation: disposalPreparationId
- Division: userGroupScopeId
- ExchangeIn: exchangeInId
- ExchangeInAttachment: exchangeInAttachmentId
- ExchangeInPrep: exchangeInPrepId
- ExchangeOut: exchangeOutId
- ExchangeOutAttachment: exchangeOutAttachmentId
- ExchangeOutPrep: exchangeOutPrepId
- Exsiccata: exsiccataId
- ExsiccataItem: exsiccataItemId
- Extractor: extractorId
- FieldNotebook: fieldNotebookId
- FieldNotebookAttachment: fieldNotebookAttachmentId
- FieldNotebookPage: fieldNotebookPageId
- FieldNotebookPageAttachment: fieldNotebookPageAttachmentId
- FieldNotebookPageSet: fieldNotebookPageSetId
- FieldNotebookPageSetAttachment: fieldNotebookPageSetAttachmentId
- FundingAgent: fundingAgentId
- GeoCoordDetail: geoCoordDetailId
- Geography: geographyId
- GeographyTreeDef: geographyTreeDefId
- GeographyTreeDefItem: geographyTreeDefItemId
- GeologicTimePeriod: geologicTimePeriodId
- GeologicTimePeriodTreeDef: geologicTimePeriodTreeDefId
- GeologicTimePeriodTreeDefItem: geologicTimePeriodTreeDefItemId
- Gift: giftId
- GiftAgent: giftAgentId
- GiftAttachment: giftAttachmentId
- GiftPreparation: giftPreparationId
- GroupPerson: groupPersonId
- InfoRequest: infoRequestID
- Institution: userGroupScopeId
- InstitutionNetwork: institutionNetworkId
- Journal: journalId
- LatLonPolygon: latLonPolygonId
- LatLonPolygonPnt: latLonPolygonPntId
- LithoStrat: lithoStratId
- LithoStratTreeDef: lithoStratTreeDefId
- LithoStratTreeDefItem: lithoStratTreeDefItemId
- Loan: loanId
- LoanAgent: loanAgentId
- LoanAttachment: loanAttachmentId
- LoanPreparation: loanPreparationId
- LoanReturnPreparation: loanReturnPreparationId
- Locality: collectingEvents, localityId
- LocalityAttachment: localityAttachmentId
- LocalityCitation: localityCitationId
- LocalityDetail: localityDetailId
- LocalityNameAlias: localityNameAliasId
- LocalityUpdate: collection, createdbyagent, localityUpdateId, modifiedbyagent, recordset, specifyuser, status, taskid, timestampcreated, timestampmodified
- LocalityUpdateRowResult: localityUpdateRowResultId, localityupdate, result, rownumber
- MaterialSample: materialSampleId
- MorphBankView: morphBankViewId
- OtherIdentifier: otherIdentifierId
- PaleoContext: paleoContextId
- PcrPerson: pcrPersonId
- Permit: permitId
- PermitAttachment: permitAttachmentId
- PickList: pickListId
- PickListItem: pickListItemId
- PrepType: prepTypeId
- Preparation: preparationId
- PreparationAttachment: preparationAttachmentId
- PreparationAttr: attrId
- PreparationAttribute: preparationAttributeId
- PreparationProperty: preparationPropertyId
- Project: projectId
- RecordSet: recordSetId
- RecordSetItem: recordSetItemId
- ReferenceWork: referenceWorkId
- ReferenceWorkAttachment: referenceWorkAttachmentId
- RelativeAge: component
- RepositoryAgreement: repositoryAgreementId
- RepositoryAgreementAttachment: repositoryAgreementAttachmentId
- Shipment: shipmentId
- SpAppResource: spAppResourceId
- SpAppResourceData: spAppResourceDataId
- SpAppResourceDir: spAppResourceDirId
- SpAuditLog: spAuditLogId
- SpAuditLogField: spAuditLogFieldId
- SpExportSchema: spExportSchemaId
- SpExportSchemaItem: spExportSchemaItemId
- SpExportSchemaItemMapping: spExportSchemaItemMappingId
- SpExportSchemaMapping: spExportSchemaMappingId
- SpFieldValueDefault: spFieldValueDefaultId
- SpLocaleContainer: spLocaleContainerId
- SpLocaleContainerItem: spLocaleContainerItemId
- SpLocaleItemStr: spLocaleItemStrId
- SpPermission: permissionId
- SpPrincipal: userGroupId
- SpQuery: spQueryId
- SpQueryField: isStrict, spQueryFieldId
- SpReport: spReportId
- SpSymbiotaInstance: spSymbiotaInstanceId
- SpTaskSemaphore: spTaskSemaphoreId
- SpVersion: spVersionId
- SpViewSetObj: spViewSetObjId
- SpVisualQuery: spVisualQueryId
- SpecifyUser: specifyUserId
- Storage: storageId
- StorageAttachment: storageAttachmentId
- StorageTreeDef: storageTreeDefId
- StorageTreeDefItem: storageTreeDefItemId
- Taxon: components, taxonId
- TaxonAttachment: taxonAttachmentId
- TaxonAttribute: taxonAttributeId
- TaxonCitation: taxonCitationId
- TaxonTreeDef: taxonTreeDefId
- TaxonTreeDefItem: taxonTreeDefItemId
- TreatmentEvent: treatmentEventId
- TreatmentEventAttachment: treatmentEventAttachmentId
- VoucherRelationship: voucherRelationshipId
- Workbench: workbenchId
- WorkbenchDataItem: workbenchDataItemId
- WorkbenchRow: workbenchRowId
- WorkbenchRowExportedRelationship: workbenchRowExportedRelationshipId
- WorkbenchRowImage: workbenchRowImageId
- WorkbenchTemplate: workbenchTemplateId
- WorkbenchTemplateMappingItem: workbenchTemplateMappingItemId
Run again with --apply to create missing records.

Desired

[28/Apr/2026 04:14:40] [WARNING] [specifyweb.backend.trees.apps:19] Failed to retrieve default tree creation information.
Discipline: Geology (ID=1638400)
Missing table containers:
- Component
- DNASequencingRunAttachment
- LocalityUpdate
- LocalityUpdateRowResult
- SpDataSetAttachment
Missing fields:
- AbsoluteAge: component
- Agent: components
- Attachment: spDataSetAttachments
- CollectionObject: components
- Component: absoluteAges, catalogNumber, collectionObject, createdByAgent, identifiedBy, identifiedDate, integer1, integer2, integer3, integer4, integer5, integer6, modifiedByAgent, name, number1, number2, number3, number4, number5, number6, proportion, relativeAges, role, text1, text2, text3, text4, text5, text6, timestampCreated, timestampModified, type, uniqueIdentifier, verbatimName, version, yesNo1, yesNo2, yesNo3, yesNo4, yesNo5, yesNo6
- DNASequencingRunAttachment: attachment, createdByAgent, dnaSequencingRun, modifiedByAgent, ordinal, remarks, timestampCreated, timestampModified, version
- Discipline: tectonicUnitTreeDef
- Gift: agent1, agent2, agent3, agent4, agent5
- Loan: agent1, agent2, agent3, agent4, agent5
- Locality: collectingEvents
- LocalityUpdate: collection, createdbyagent, modifiedbyagent, recordset, specifyuser, status, taskid, timestampcreated, timestampmodified
- LocalityUpdateRowResult: localityupdate, result, rownumber
- RelativeAge: component
- SpDataSetAttachment: attachment, collectionMemberId, createdByAgent, modifiedByAgent, ordinal, remarks, spdataset, timestampCreated, timestampModified, version
- SpQueryField: isStrict
- Taxon: components
Applied missing schema config records.

Metadata

Metadata

Assignees

No one assigned

    Labels

    2 - Schema ConfigIssues that are related to the Schema Config tool

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions