Skip to content

Commit

Permalink
Model Variables - Bugfix (#510)
Browse files Browse the repository at this point in the history
* Corrects issue with db migration downgrade and another due to a naming mismatch when creating a new model.
* Resolves issues with upgrade/downgrade when there's existing configurations.
* Resolves an issue with a naming mismatch that causes the dropdown to not show up for new model configurations.
---------

Co-authored-by: Robert McMahan <[email protected]>
  • Loading branch information
blackwire and Robert McMahan authored Jun 25, 2024
1 parent 13a3813 commit 40129b4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
1 change: 0 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ $ pip-compile --allow-unsafe --generate-hashes --resolver=backtracking setup.py
#### Backend
Update dependencies in requirements-controller.in and/or requirements-jobs.in then:
```sh
$ cd backend/
$ pip-compile --allow-unsafe --generate-hashes --resolver=backtracking backend/requirements-controller.in
$ pip-compile --allow-unsafe --generate-hashes --resolver=backtracking backend/requirements-jobs.in
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,15 @@
def upgrade():
op.drop_constraint('ml_model_variables_ibfk_1', 'ml_model_variables', type_='foreignkey')
op.drop_constraint('PRIMARY', 'ml_model_variables', type_='primary')
with op.batch_alter_table('ml_model_variables', schema=None) as batch_op:
batch_op.add_column(sa.Column('id', sa.Integer()))
op.create_primary_key('PRIMARY', 'ml_model_variables', ['id'])
op.execute('ALTER TABLE ml_model_variables MODIFY id INTEGER NOT NULL AUTO_INCREMENT;')
op.execute('ALTER TABLE ml_model_variables ADD id INTEGER PRIMARY KEY AUTO_INCREMENT;')
op.create_foreign_key(
'ml_model_variables_ibfk_1', 'ml_model_variables', 'ml_models',
['ml_model_id'], ['id'])


def downgrade():
op.drop_constraint('ml_model_variables_ibfk_1', 'ml_model_variables', type_='foreignkey')
op.drop_constraint('PRIMARY', 'ml_model_variables', type_='primary')
with op.batch_alter_table('ml_model_variables', schema=None) as batch_op:
batch_op.drop_column('id')
op.execute('ALTER TABLE ml_model_variables DROP COLUMN id;')
op.create_primary_key(
'PRIMARY', 'ml_model_variables',
['ml_model_id', 'name'])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ export class MlModelFormComponent implements OnInit {
controls.push(this._fb.group({
sources: [variableSources],
source: [existingVariable.source],
names: [variables.filter(v => v.source === existingVariable.source).map(v => v.name)],
list: [variables.filter(v => v.source === existingVariable.source).map(v => { return {name: v.name, count: v.count} })],
name: [null],
}));
continue;
Expand Down

0 comments on commit 40129b4

Please sign in to comment.