Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions specifyweb/backend/stored_queries/tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,9 @@ def test_sqlalchemy_model_errors(self):
"attachments": ["dnasequencerunattachment", "dnasequencingrunattachment"]
}
},
"ExportDataset": {"not_found": ["extensions"]},
"ExportDataSetExtension": {"not_found": ["exportDataSet"]},
"SchemaMapping": {"incorrect_direction": {"query": ["manytoone", "onetoone"]}},
"Discipline": {"not_found": ["numberingSchemes", "userGroups"]},
"Division": {"not_found": ["numberingSchemes", "userGroups"]},
"Institution": {"not_found": ["userGroups"]},
Expand Down
18 changes: 18 additions & 0 deletions specifyweb/backend/stored_queries/tests/tests_legacy.py
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,24 @@ def test_sqlalchemy_model_errors(self):
]
}
},
"ExportDataset": {
"not_found": [
"extensions"
]
},
"ExportDataSetExtension": {
"not_found": [
"exportDataSet"
]
},
"SchemaMapping": {
"incorrect_direction": {
"query": [
"manytoone",
"onetoone"
]
}
},
"Discipline": {
"not_found": [
"numberingSchemes",
Expand Down
3 changes: 3 additions & 0 deletions specifyweb/frontend/js_src/lib/components/DataModel/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5450,6 +5450,9 @@ export type SpQueryField = {
readonly timestampCreated: string;
readonly timestampModified: string | null;
readonly version: number | null;
readonly term: string | null;
readonly isStatic: boolean | null;
readonly staticValue: string | null;
};
readonly toOneDependent: RR<never, never>;
readonly toOneIndependent: {
Expand Down
28 changes: 26 additions & 2 deletions specifyweb/specify/datamodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -3522,7 +3522,27 @@ def is_tree_table(table: Table):
relationships=[
Relationship(name='metadata', type='many-to-one', required=False, relatedModelName='SpAppResource', column='MetadataID', otherSideName='exportDatasets'),
Relationship(name='coreMapping', type='many-to-one', required=True, relatedModelName='SchemaMapping', column='CoreMappingID', otherSideName='exportDatasets'),
Relationship(name='collection', type='many-to-one', required=True, relatedModelName='Collection', column='CollectionID', otherSideName='exportDatasets')
Relationship(name='collection', type='many-to-one', required=True, relatedModelName='Collection', column='CollectionID', otherSideName='exportDatasets'),
Relationship(name='extensions', type='one-to-many', required=False, relatedModelName='ExportDataSetExtension', otherSideName='exportDataSet')
],
fieldAliases=[]
),
Table(
classname='edu.ku.brc.specify.datamodel.ExportDataSetExtension',
table='exportdatasetextension',
tableId=1039,
idColumn='ExportDataSetExtensionID',
idFieldName='exportDataSetExtensionId',
idField=IdField(name='exportDataSetExtensionId', column='ExportDataSetExtensionID', type='java.lang.Integer'),
fields=[
Field(name='sortOrder', column='SortOrder', indexed=False, unique=False, required=True, type='java.lang.Integer'),
],
indexes=[
Index(name='ExtensionDatasetIDX', column_names=['ExportDataSetID']),
],
relationships=[
Relationship(name='exportDataSet', type='many-to-one', required=True, relatedModelName='ExportDataSet', column='ExportDataSetID', otherSideName='extensions'),
Relationship(name='schemaMapping', type='many-to-one', required=True, relatedModelName='SchemaMapping', column='SchemaMappingID', otherSideName='exportDataSetExtensions'),
],
fieldAliases=[]
),
Expand Down Expand Up @@ -6174,6 +6194,7 @@ def is_tree_table(table: Table):
Field(name='mappingType', column='MappingType', indexed=False, unique=False, required=True, type='java.lang.String', length=16),
Field(name='name', column='Name', indexed=True, unique=False, required=True, type='java.lang.String', length=256),
Field(name='isDefault', column='IsDefault', indexed=False, unique=False, required=True, type='java.lang.Boolean'),
Field(name='vocabulary', column='Vocabulary', indexed=False, unique=False, required=False, type='java.lang.String', length=32),
],
indexes=[
Index(name='SchemaMappingNameIDX', column_names=['Name'])
Expand Down Expand Up @@ -6798,7 +6819,10 @@ def is_tree_table(table: Table):
Field(name='timestampCreated', column='TimestampCreated', indexed=False, unique=False, required=True, type='java.sql.Timestamp'),
Field(name='timestampModified', column='TimestampModified', indexed=False, unique=False, required=False, type='java.sql.Timestamp'),
Field(name='version', column='Version', indexed=False, unique=False, required=False, type='java.lang.Integer'),
Field(name='isStrict', column='IsStrict', indexed=False, unique=False, required=True, type='java.lang.Boolean')
Field(name='isStrict', column='IsStrict', indexed=False, unique=False, required=True, type='java.lang.Boolean'),
Field(name='term', column='Term', indexed=False, unique=False, required=False, type='java.lang.String', length=255),
Field(name='isStatic', column='IsStatic', indexed=False, unique=False, required=False, type='java.lang.Boolean'),
Field(name='staticValue', column='StaticValue', indexed=False, unique=False, required=False, type='text', length=65535),
],
indexes=[

Expand Down
28 changes: 28 additions & 0 deletions specifyweb/specify/migrations/0047_spqueryfield_dwc_fields.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Generated by Django 4.2.27 on 2026-03-31 03:36

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('specify', '0046_create_exportdataset'),
]

operations = [
migrations.AddField(
model_name='spqueryfield',
name='isstatic',
field=models.BooleanField(blank=True, db_column='IsStatic', default=False, null=True),
),
migrations.AddField(
model_name='spqueryfield',
name='staticvalue',
field=models.TextField(blank=True, db_column='StaticValue', null=True),
),
migrations.AddField(
model_name='spqueryfield',
name='term',
field=models.CharField(blank=True, db_column='Term', max_length=255, null=True),
),
]
33 changes: 33 additions & 0 deletions specifyweb/specify/migrations/0048_extensions_and_vocabulary.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
from django.db import migrations, models
import django.db.models.deletion
import specifyweb.specify.models


class Migration(migrations.Migration):

dependencies = [
('specify', '0047_spqueryfield_dwc_fields'),
]

operations = [
migrations.AddField(
model_name='schemamapping',
name='vocabulary',
field=models.CharField(blank=True, db_column='Vocabulary', max_length=32, null=True),
),
migrations.CreateModel(
name='Exportdatasetextension',
fields=[
('id', models.AutoField(db_column='ExportDataSetExtensionID', primary_key=True, serialize=False)),
('sortorder', models.IntegerField(db_column='SortOrder', default=0)),
('exportdataset', models.ForeignKey(db_column='ExportDataSetID', on_delete=django.db.models.deletion.CASCADE, related_name='extensions', to='specify.exportdataset')),
('schemamapping', models.ForeignKey(db_column='SchemaMappingID', on_delete=specifyweb.specify.models.protect_with_blockers, related_name='+', to='specify.schemamapping')),
],
options={
'db_table': 'exportdatasetextension',
'ordering': ('sortorder',),
'indexes': [models.Index(fields=['exportdataset'], name='ExtensionDatasetIDX')],
'unique_together': {('exportdataset', 'schemamapping')},
},
),
]
35 changes: 35 additions & 0 deletions specifyweb/specify/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3318,6 +3318,30 @@ class Meta:
]

save = partialmethod(custom_save)

class Exportdatasetextension(models.Model):
specify_model = datamodel.get_table_strict('exportdatasetextension')

# ID Field
id = models.AutoField(primary_key=True, db_column='ExportDataSetExtensionID')

# Fields
sortorder = models.IntegerField(blank=False, null=False, unique=False, default=0, db_column='SortOrder', db_index=False)

# Relationships: Many-to-One
exportdataset = models.ForeignKey('Exportdataset', db_column='ExportDataSetID', related_name='extensions', null=False, on_delete=models.CASCADE)
schemamapping = models.ForeignKey('Schemamapping', db_column='SchemaMappingID', related_name='+', null=False, on_delete=protect_with_blockers)

class Meta:
db_table = 'exportdatasetextension'
ordering = ('sortorder',)
indexes = [
models.Index(fields=['exportdataset'], name='ExtensionDatasetIDX'),
]
unique_together = (('exportdataset', 'schemamapping'),)

save = partialmethod(custom_save)

class Exsiccata(models.Model):
specify_model = datamodel.get_table_strict('exsiccata')

Expand Down Expand Up @@ -5895,6 +5919,14 @@ class Schemamapping(models.Model):
db_index=False,
)

vocabulary = models.CharField(
blank=True,
null=True,
max_length=32,
db_column='Vocabulary',
db_index=False,
)

createdbyagent = models.ForeignKey('Agent', db_column='CreatedByAgentID', related_name='+', null=True, on_delete=protect_with_blockers)
modifiedbyagent = models.ForeignKey('Agent', db_column='ModifiedByAgentID', related_name='+', null=True, on_delete=protect_with_blockers)
specifyuser = models.ForeignKey('SpecifyUser', db_column='SpecifyUserID', related_name='schemamappings', null=False, on_delete=protect_with_blockers)
Expand Down Expand Up @@ -6512,6 +6544,9 @@ class Spqueryfield(models.Model):
timestampmodified = models.DateTimeField(blank=True, null=True, unique=False, db_column='TimestampModified', db_index=False, default=timezone.now) # auto_now=True
version = models.IntegerField(blank=True, null=False, unique=False, db_column='Version', db_index=False, default=0)
isstrict = models.BooleanField(db_column='IsStrict', blank=True, null=True)
term = models.CharField(blank=True, null=True, max_length=255, unique=False, db_column='Term')
isstatic = models.BooleanField(blank=True, null=True, default=False, db_column='IsStatic')
staticvalue = models.TextField(blank=True, null=True, db_column='StaticValue')

# Relationships: Many-to-One
createdbyagent = models.ForeignKey('Agent', db_column='CreatedByAgentID', related_name='+', null=True, on_delete=protect_with_blockers)
Expand Down
Loading