class Migration(migrations.Migration): dependencies = [ ('db', '0001_initial'), ] operations = [ migrations.AlterField( model_name='dbcalcstate', name='state', # The UNDETERMINED and NOTFOUND 'states' were removed as these # don't make sense field=models.CharField( db_index=True, max_length=25, choices=[(b'RETRIEVALFAILED', b'RETRIEVALFAILED'), (b'COMPUTED', b'COMPUTED'), (b'RETRIEVING', b'RETRIEVING'), (b'WITHSCHEDULER', b'WITHSCHEDULER'), (b'SUBMISSIONFAILED', b'SUBMISSIONFAILED'), (b'PARSING', b'PARSING'), (b'FAILED', b'FAILED'), (b'FINISHED', b'FINISHED'), (b'TOSUBMIT', b'TOSUBMIT'), (b'SUBMITTING', b'SUBMITTING'), (b'IMPORTED', b'IMPORTED'), (b'NEW', b'NEW'), (b'PARSINGFAILED', b'PARSINGFAILED')]), preserve_default=True, ), # Fix up any calculation states that had one of the removed states migrations.RunPython(fix_calc_states), update_schema_version(SCHEMA_VERSION) ]
class Migration(migrations.Migration): dependencies = [ ('db', '0005_add_cmtime_indices'), ] operations = [ migrations.RemoveField( model_name='dbpath', name='child', ), migrations.RemoveField( model_name='dbpath', name='parent', ), migrations.RemoveField( model_name='dbnode', name='children', ), migrations.DeleteModel(name='DbPath', ), migrations.RunSQL(""" DROP TRIGGER IF EXISTS autoupdate_tc ON db_dblink; DROP FUNCTION IF EXISTS update_tc(); """), update_schema_version(SCHEMA_VERSION) ]
class Migration(migrations.Migration): dependencies = [ ('db', '0003_add_link_type'), ] operations = [ # Create the index that speeds up the daemon queries # We use the RunSQL command because Django interface # doesn't seem to support partial indexes migrations.RunSQL(""" CREATE INDEX tval_idx_for_daemon ON db_dbattribute (tval) WHERE ("db_dbattribute"."tval" IN ('COMPUTED', 'WITHSCHEDULER', 'TOSUBMIT'))"""), # Create an index on UUIDs to speed up loading of nodes # using this field migrations.AlterField( model_name='dbnode', name='uuid', field=django_extensions.db.fields.UUIDField(db_index=True, editable=False, blank=True), preserve_default=True, ), update_schema_version(SCHEMA_VERSION) ]
class Migration(migrations.Migration): dependencies = [ ('db', '0007_update_linktypes'), ] operations = [ # The 'hidden' property of AbstractCode has been changed from an attribute to an extra # Therefore we find all nodes of type Code and if they have an attribute with the key 'hidden' # we move that value to the extra table # # First we copy the 'hidden' attributes from code.Code. nodes to the db_extra table migrations.RunSQL(""" INSERT INTO db_dbextra (key, datatype, tval, fval, ival, bval, dval, dbnode_id) ( SELECT db_dbattribute.key, db_dbattribute.datatype, db_dbattribute.tval, db_dbattribute.fval, db_dbattribute.ival, db_dbattribute.bval, db_dbattribute.dval, db_dbattribute.dbnode_id FROM db_dbattribute JOIN db_dbnode ON db_dbnode.id = db_dbattribute.dbnode_id WHERE db_dbattribute.key = 'hidden' AND db_dbnode.type = 'code.Code.' ); """), # Secondly, we delete the original entries from the DbAttribute table migrations.RunSQL(""" DELETE FROM db_dbattribute WHERE id in ( SELECT db_dbattribute.id FROM db_dbattribute JOIN db_dbnode ON db_dbnode.id = db_dbattribute.dbnode_id WHERE db_dbattribute.key = 'hidden' AND db_dbnode.type = 'code.Code.' ); """), update_schema_version(SCHEMA_VERSION) ]
class Migration(migrations.Migration): dependencies = [ ('db', '0011_delete_kombu_tables'), ] operations = [ migrations.DeleteModel( name='DbLock', ), update_schema_version(SCHEMA_VERSION) ]
class Migration(migrations.Migration): dependencies = [ ('db', '0009_base_data_plugin_type_string'), ] operations = [ migrations.AddField(model_name='dbnode', name='process_type', field=models.CharField(max_length=255, db_index=True, null=True)), update_schema_version(SCHEMA_VERSION) ]
class Migration(migrations.Migration): dependencies = [ ('db', '0008_code_hidden_to_extra'), ] operations = [ # The base Data types Bool, Float, Int and Str have been moved in the source code, which means that their # module path changes, which determines the plugin type string which is stored in the databse. # The type string now will have a type string prefix that is unique to each sub type. migrations.RunSQL(""" UPDATE db_dbnode SET type = 'data.bool.Bool.' WHERE type = 'data.base.Bool.'; UPDATE db_dbnode SET type = 'data.float.Float.' WHERE type = 'data.base.Float.'; UPDATE db_dbnode SET type = 'data.int.Int.' WHERE type = 'data.base.Int.'; UPDATE db_dbnode SET type = 'data.str.Str.' WHERE type = 'data.base.Str.'; UPDATE db_dbnode SET type = 'data.list.List.' WHERE type = 'data.base.List.'; """), update_schema_version(SCHEMA_VERSION) ]
class Migration(migrations.Migration): dependencies = [ ('db', '0010_process_type'), ] operations = [ migrations.RunSQL(""" DROP TABLE IF EXISTS kombu_message; DROP TABLE IF EXISTS kombu_queue; DELETE FROM db_dbsetting WHERE key = 'daemon|user'; DELETE FROM db_dbsetting WHERE key = 'daemon|task_stop|retriever'; DELETE FROM db_dbsetting WHERE key = 'daemon|task_start|retriever'; DELETE FROM db_dbsetting WHERE key = 'daemon|task_stop|updater'; DELETE FROM db_dbsetting WHERE key = 'daemon|task_start|updater'; DELETE FROM db_dbsetting WHERE key = 'daemon|task_stop|submitter'; DELETE FROM db_dbsetting WHERE key = 'daemon|task_start|submitter'; """), update_schema_version(SCHEMA_VERSION) ]
class Migration(migrations.Migration): dependencies = [ ('db', '0004_add_daemon_and_uuid_indices'), ] operations = [ migrations.AlterField( model_name='dbnode', name='ctime', field=models.DateTimeField(default=aiida.utils.timezone.now, editable=False, db_index=True), preserve_default=True, ), migrations.AlterField( model_name='dbnode', name='mtime', field=models.DateTimeField(auto_now=True, db_index=True), preserve_default=True, ), update_schema_version(SCHEMA_VERSION) ]
class Migration(migrations.Migration): dependencies = [ ('auth', '0001_initial'), ] operations = [ migrations.CreateModel( name='DbUser', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('password', models.CharField(max_length=128, verbose_name='password')), ('last_login', models.DateTimeField(default=django.utils.timezone.now, verbose_name='last login')), ('is_superuser', models.BooleanField( default=False, help_text= 'Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')), ('email', models.EmailField(unique=True, max_length=75, db_index=True)), ('first_name', models.CharField(max_length=254, blank=True)), ('last_name', models.CharField(max_length=254, blank=True)), ('institution', models.CharField(max_length=254, blank=True)), ('is_staff', models.BooleanField( default=False, help_text= b'Designates whether the user can log into this admin site.' )), ('is_active', models.BooleanField( default=True, help_text= b'Designates whether this user should be treated as active. Unselect this instead of deleting accounts.' )), ('date_joined', models.DateTimeField(default=django.utils.timezone.now)), ('groups', models.ManyToManyField( related_query_name='user', related_name='user_set', to='auth.Group', blank=True, help_text= 'The groups this user belongs to. A user will get all permissions granted to each of his/her group.', verbose_name='groups')), ('user_permissions', models.ManyToManyField( related_query_name='user', related_name='user_set', to='auth.Permission', blank=True, help_text='Specific permissions for this user.', verbose_name='user permissions')), ], options={ 'abstract': False, }, bases=(models.Model, ), ), migrations.CreateModel( name='DbAttribute', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('key', models.CharField(max_length=1024, db_index=True)), ('datatype', models.CharField(default=b'none', max_length=10, db_index=True, choices=[(b'float', b'float'), (b'int', b'int'), (b'txt', b'txt'), (b'bool', b'bool'), (b'date', b'date'), (b'json', b'json'), (b'dict', b'dict'), (b'list', b'list'), (b'none', b'none')])), ('tval', models.TextField(default=b'', blank=True)), ('fval', models.FloatField(default=None, null=True)), ('ival', models.IntegerField(default=None, null=True)), ('bval', models.NullBooleanField(default=None)), ('dval', models.DateTimeField(default=None, null=True)), ], options={ 'abstract': False, }, bases=(models.Model, ), ), migrations.CreateModel( name='DbAuthInfo', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('auth_params', models.TextField(default=b'{}')), ('metadata', models.TextField(default=b'{}')), ('enabled', models.BooleanField(default=True)), ('aiidauser', models.ForeignKey(to=settings.AUTH_USER_MODEL)), ], options={}, bases=(models.Model, ), ), migrations.CreateModel( name='DbCalcState', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('state', models.CharField(db_index=True, max_length=25, choices=[ (b'UNDETERMINED', b'UNDETERMINED'), (b'NOTFOUND', b'NOTFOUND'), (b'RETRIEVALFAILED', b'RETRIEVALFAILED'), (b'COMPUTED', b'COMPUTED'), (b'RETRIEVING', b'RETRIEVING'), (b'WITHSCHEDULER', b'WITHSCHEDULER'), (b'SUBMISSIONFAILED', b'SUBMISSIONFAILED'), (b'PARSING', b'PARSING'), (b'FAILED', b'FAILED'), (b'FINISHED', b'FINISHED'), (b'TOSUBMIT', b'TOSUBMIT'), (b'SUBMITTING', b'SUBMITTING'), (b'IMPORTED', b'IMPORTED'), (b'NEW', b'NEW'), (b'PARSINGFAILED', b'PARSINGFAILED') ])), ('time', models.DateTimeField(default=django.utils.timezone.now, editable=False)), ], options={}, bases=(models.Model, ), ), migrations.CreateModel( name='DbComment', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('uuid', django_extensions.db.fields.UUIDField(editable=False, blank=True)), ('ctime', models.DateTimeField(default=django.utils.timezone.now, editable=False)), ('mtime', models.DateTimeField(auto_now=True)), ('content', models.TextField(blank=True)), ], options={}, bases=(models.Model, ), ), migrations.CreateModel( name='DbComputer', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('uuid', django_extensions.db.fields.UUIDField(editable=False, blank=True)), ('name', models.CharField(unique=True, max_length=255)), ('hostname', models.CharField(max_length=255)), ('description', models.TextField(blank=True)), ('enabled', models.BooleanField(default=True)), ('transport_type', models.CharField(max_length=255)), ('scheduler_type', models.CharField(max_length=255)), ('transport_params', models.TextField(default=b'{}')), ('metadata', models.TextField(default=b'{}')), ], options={}, bases=(models.Model, ), ), migrations.CreateModel( name='DbExtra', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('key', models.CharField(max_length=1024, db_index=True)), ('datatype', models.CharField(default=b'none', max_length=10, db_index=True, choices=[(b'float', b'float'), (b'int', b'int'), (b'txt', b'txt'), (b'bool', b'bool'), (b'date', b'date'), (b'json', b'json'), (b'dict', b'dict'), (b'list', b'list'), (b'none', b'none')])), ('tval', models.TextField(default=b'', blank=True)), ('fval', models.FloatField(default=None, null=True)), ('ival', models.IntegerField(default=None, null=True)), ('bval', models.NullBooleanField(default=None)), ('dval', models.DateTimeField(default=None, null=True)), ], options={ 'abstract': False, }, bases=(models.Model, ), ), migrations.CreateModel( name='DbGroup', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('uuid', django_extensions.db.fields.UUIDField(editable=False, blank=True)), ('name', models.CharField(max_length=255, db_index=True)), ('type', models.CharField(default=b'', max_length=255, db_index=True)), ('time', models.DateTimeField(default=django.utils.timezone.now, editable=False)), ('description', models.TextField(blank=True)), ], options={}, bases=(models.Model, ), ), migrations.CreateModel( name='DbLink', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('label', models.CharField(max_length=255, db_index=True)), ], options={}, bases=(models.Model, ), ), migrations.CreateModel( name='DbLock', fields=[ ('key', models.CharField(max_length=255, serialize=False, primary_key=True)), ('creation', models.DateTimeField(default=django.utils.timezone.now, editable=False)), ('timeout', models.IntegerField(editable=False)), ('owner', models.CharField(max_length=255)), ], options={}, bases=(models.Model, ), ), migrations.CreateModel( name='DbLog', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('time', models.DateTimeField(default=django.utils.timezone.now, editable=False)), ('loggername', models.CharField(max_length=255, db_index=True)), ('levelname', models.CharField(max_length=50, db_index=True)), ('objname', models.CharField(db_index=True, max_length=255, blank=True)), ('objpk', models.IntegerField(null=True, db_index=True)), ('message', models.TextField(blank=True)), ('metadata', models.TextField(default=b'{}')), ], options={}, bases=(models.Model, ), ), migrations.CreateModel( name='DbNode', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('uuid', django_extensions.db.fields.UUIDField(editable=False, blank=True)), ('type', models.CharField(max_length=255, db_index=True)), ('label', models.CharField(db_index=True, max_length=255, blank=True)), ('description', models.TextField(blank=True)), ('ctime', models.DateTimeField(default=django.utils.timezone.now, editable=False)), ('mtime', models.DateTimeField(auto_now=True)), ('nodeversion', models.IntegerField(default=1, editable=False)), ('public', models.BooleanField(default=False)), ], options={}, bases=(models.Model, ), ), migrations.CreateModel( name='DbPath', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('depth', models.IntegerField(editable=False)), ('entry_edge_id', models.IntegerField(null=True, editable=False)), ('direct_edge_id', models.IntegerField(null=True, editable=False)), ('exit_edge_id', models.IntegerField(null=True, editable=False)), ('child', models.ForeignKey(related_name='parent_paths', editable=False, to='db.DbNode')), ('parent', models.ForeignKey(related_name='child_paths', editable=False, to='db.DbNode')), ], options={}, bases=(models.Model, ), ), migrations.CreateModel( name='DbSetting', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('key', models.CharField(max_length=1024, db_index=True)), ('datatype', models.CharField(default=b'none', max_length=10, db_index=True, choices=[(b'float', b'float'), (b'int', b'int'), (b'txt', b'txt'), (b'bool', b'bool'), (b'date', b'date'), (b'json', b'json'), (b'dict', b'dict'), (b'list', b'list'), (b'none', b'none')])), ('tval', models.TextField(default=b'', blank=True)), ('fval', models.FloatField(default=None, null=True)), ('ival', models.IntegerField(default=None, null=True)), ('bval', models.NullBooleanField(default=None)), ('dval', models.DateTimeField(default=None, null=True)), ('description', models.TextField(blank=True)), ('time', models.DateTimeField(auto_now=True)), ], options={ 'abstract': False, }, bases=(models.Model, ), ), migrations.CreateModel( name='DbWorkflow', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('uuid', django_extensions.db.fields.UUIDField(editable=False, blank=True)), ('ctime', models.DateTimeField(default=django.utils.timezone.now, editable=False)), ('mtime', models.DateTimeField(auto_now=True)), ('label', models.CharField(db_index=True, max_length=255, blank=True)), ('description', models.TextField(blank=True)), ('nodeversion', models.IntegerField(default=1, editable=False)), ('lastsyncedversion', models.IntegerField(default=0, editable=False)), ('state', models.CharField(default=b'INITIALIZED', max_length=255, choices=[(b'CREATED', b'CREATED'), (b'FINISHED', b'FINISHED'), (b'RUNNING', b'RUNNING'), (b'SLEEP', b'SLEEP'), (b'ERROR', b'ERROR'), (b'INITIALIZED', b'INITIALIZED')])), ('report', models.TextField(blank=True)), ('module', models.TextField()), ('module_class', models.TextField()), ('script_path', models.TextField()), ('script_md5', models.CharField(max_length=255)), ('user', models.ForeignKey( to=settings.AUTH_USER_MODEL, on_delete=django.db.models.deletion.PROTECT)), ], options={}, bases=(models.Model, ), ), migrations.CreateModel( name='DbWorkflowData', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('name', models.CharField(max_length=255)), ('time', models.DateTimeField(default=django.utils.timezone.now, editable=False)), ('data_type', models.CharField(default=b'PARAMETER', max_length=255)), ('value_type', models.CharField(default=b'NONE', max_length=255)), ('json_value', models.TextField(blank=True)), ('aiida_obj', models.ForeignKey(blank=True, to='db.DbNode', null=True)), ('parent', models.ForeignKey(related_name='data', to='db.DbWorkflow')), ], options={}, bases=(models.Model, ), ), migrations.CreateModel( name='DbWorkflowStep', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('name', models.CharField(max_length=255)), ('time', models.DateTimeField(default=django.utils.timezone.now, editable=False)), ('nextcall', models.CharField(default=b'none', max_length=255)), ('state', models.CharField(default=b'CREATED', max_length=255, choices=[(b'CREATED', b'CREATED'), (b'FINISHED', b'FINISHED'), (b'RUNNING', b'RUNNING'), (b'SLEEP', b'SLEEP'), (b'ERROR', b'ERROR'), (b'INITIALIZED', b'INITIALIZED')])), ('calculations', models.ManyToManyField(related_name='workflow_step', to='db.DbNode')), ('parent', models.ForeignKey(related_name='steps', to='db.DbWorkflow')), ('sub_workflows', models.ManyToManyField(related_name='parent_workflow_step', to='db.DbWorkflow')), ('user', models.ForeignKey( to=settings.AUTH_USER_MODEL, on_delete=django.db.models.deletion.PROTECT)), ], options={}, bases=(models.Model, ), ), migrations.AlterUniqueTogether( name='dbworkflowstep', unique_together=set([('parent', 'name')]), ), migrations.AlterUniqueTogether( name='dbworkflowdata', unique_together=set([('parent', 'name', 'data_type')]), ), migrations.AlterUniqueTogether( name='dbsetting', unique_together=set([('key', )]), ), migrations.AddField( model_name='dbnode', name='children', field=models.ManyToManyField(related_name='parents', through='db.DbPath', to='db.DbNode'), preserve_default=True, ), migrations.AddField( model_name='dbnode', name='dbcomputer', field=models.ForeignKey( related_name='dbnodes', on_delete=django.db.models.deletion.PROTECT, to='db.DbComputer', null=True), preserve_default=True, ), migrations.AddField( model_name='dbnode', name='outputs', field=models.ManyToManyField(related_name='inputs', through='db.DbLink', to='db.DbNode'), preserve_default=True, ), migrations.AddField( model_name='dbnode', name='user', field=models.ForeignKey( related_name='dbnodes', on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL), preserve_default=True, ), migrations.AddField( model_name='dblink', name='input', field=models.ForeignKey( related_name='output_links', on_delete=django.db.models.deletion.PROTECT, to='db.DbNode'), preserve_default=True, ), migrations.AddField( model_name='dblink', name='output', field=models.ForeignKey(related_name='input_links', to='db.DbNode'), preserve_default=True, ), migrations.AlterUniqueTogether( name='dblink', unique_together=set([('input', 'output'), ('output', 'label')]), ), migrations.AddField( model_name='dbgroup', name='dbnodes', field=models.ManyToManyField(related_name='dbgroups', to='db.DbNode'), preserve_default=True, ), migrations.AddField( model_name='dbgroup', name='user', field=models.ForeignKey(related_name='dbgroups', to=settings.AUTH_USER_MODEL), preserve_default=True, ), migrations.AlterUniqueTogether( name='dbgroup', unique_together=set([('name', 'type')]), ), migrations.AddField( model_name='dbextra', name='dbnode', field=models.ForeignKey(related_name='dbextras', to='db.DbNode'), preserve_default=True, ), migrations.AlterUniqueTogether( name='dbextra', unique_together=set([('dbnode', 'key')]), ), migrations.AddField( model_name='dbcomment', name='dbnode', field=models.ForeignKey(related_name='dbcomments', to='db.DbNode'), preserve_default=True, ), migrations.AddField( model_name='dbcomment', name='user', field=models.ForeignKey(to=settings.AUTH_USER_MODEL), preserve_default=True, ), migrations.AddField( model_name='dbcalcstate', name='dbnode', field=models.ForeignKey(related_name='dbstates', to='db.DbNode'), preserve_default=True, ), migrations.AlterUniqueTogether( name='dbcalcstate', unique_together=set([('dbnode', 'state')]), ), migrations.AddField( model_name='dbauthinfo', name='dbcomputer', field=models.ForeignKey(to='db.DbComputer'), preserve_default=True, ), migrations.AlterUniqueTogether( name='dbauthinfo', unique_together=set([('aiidauser', 'dbcomputer')]), ), migrations.AddField( model_name='dbattribute', name='dbnode', field=models.ForeignKey(related_name='dbattributes', to='db.DbNode'), preserve_default=True, ), migrations.AlterUniqueTogether( name='dbattribute', unique_together=set([('dbnode', 'key')]), ), update_schema_version(SCHEMA_VERSION) ]
class Migration(migrations.Migration): dependencies = [ ('db', '0006_delete_dbpath'), ] operations = [ # I am first migrating the wrongly declared returnlinks out of # the InlineCalculations. # This bug is reported #628 https://github.com/aiidateam/aiida_core/issues/628 # There is an explicit check in the code of the inline calculation # ensuring that the calculation returns UNSTORED nodes. # Therefore, no cycle can be created with that migration! # # this command: # 1) selects all links that # - joins an InlineCalculation (or subclass) as input # - joins a Data (or subclass) as output # - is marked as a returnlink. # 2) set for these links the type to 'createlink' migrations.RunSQL(""" UPDATE db_dblink set type='createlink' WHERE db_dblink.id IN ( SELECT db_dblink_1.id FROM db_dbnode AS db_dbnode_1 JOIN db_dblink AS db_dblink_1 ON db_dblink_1.input_id = db_dbnode_1.id JOIN db_dbnode AS db_dbnode_2 ON db_dblink_1.output_id = db_dbnode_2.id WHERE db_dbnode_1.type LIKE 'calculation.inline.%' AND db_dbnode_2.type LIKE 'data.%' AND db_dblink_1.type = 'returnlink' ); """), # Now I am updating the link-types that are null because of either an export and subsequent import # https://github.com/aiidateam/aiida_core/issues/685 # or because the link types don't exist because the links were added before the introduction of link types. # This is reported here: https://github.com/aiidateam/aiida_core/issues/687 # # The following sql statement: # 1) selects all links that # - joins Data (or subclass) or Code as input # - joins Calculation (or subclass) as output. This includes WorkCalculation, InlineCalcuation, JobCalculations... # - has no type (null) # 2) set for these links the type to 'inputlink' migrations.RunSQL(""" UPDATE db_dblink set type='inputlink' where id in ( SELECT db_dblink_1.id FROM db_dbnode AS db_dbnode_1 JOIN db_dblink AS db_dblink_1 ON db_dblink_1.input_id = db_dbnode_1.id JOIN db_dbnode AS db_dbnode_2 ON db_dblink_1.output_id = db_dbnode_2.id WHERE ( db_dbnode_1.type LIKE 'data.%' or db_dbnode_1.type = 'code.Code.' ) AND db_dbnode_2.type LIKE 'calculation.%' AND ( db_dblink_1.type = null OR db_dblink_1.type = '') ); """), # # The following sql statement: # 1) selects all links that # - join JobCalculation (or subclass) or InlineCalculation as input # - joins Data (or subclass) as output. # - has no type (null) # 2) set for these links the type to 'createlink' migrations.RunSQL(""" UPDATE db_dblink set type='createlink' where id in ( SELECT db_dblink_1.id FROM db_dbnode AS db_dbnode_1 JOIN db_dblink AS db_dblink_1 ON db_dblink_1.input_id = db_dbnode_1.id JOIN db_dbnode AS db_dbnode_2 ON db_dblink_1.output_id = db_dbnode_2.id WHERE db_dbnode_2.type LIKE 'data.%' AND ( db_dbnode_1.type LIKE 'calculation.job.%' OR db_dbnode_1.type = 'calculation.inline.InlineCalculation.' ) AND ( db_dblink_1.type = null OR db_dblink_1.type = '') ); """), # The following sql statement: # 1) selects all links that # - join WorkCalculation as input. No subclassing was introduced so far, so only one type string is checked for. # - join Data (or subclass) as output. # - has no type (null) # 2) set for these links the type to 'returnlink' migrations.RunSQL(""" UPDATE db_dblink set type='returnlink' where id in ( SELECT db_dblink_1.id FROM db_dbnode AS db_dbnode_1 JOIN db_dblink AS db_dblink_1 ON db_dblink_1.input_id = db_dbnode_1.id JOIN db_dbnode AS db_dbnode_2 ON db_dblink_1.output_id = db_dbnode_2.id WHERE db_dbnode_2.type LIKE 'data.%' AND db_dbnode_1.type = 'calculation.work.WorkCalculation.' AND ( db_dblink_1.type = null OR db_dblink_1.type = '') ); """), # Now I update links that are CALLS: # The following sql statement: # 1) selects all links that # - join WorkCalculation as input. No subclassing was introduced so far, so only one type string is checked for. # - join Calculation (or subclass) as output. Includes JobCalculation and WorkCalculations and all subclasses. # - has no type (null) # 2) set for these links the type to 'calllink' migrations.RunSQL(""" UPDATE db_dblink set type='calllink' where id in ( SELECT db_dblink_1.id FROM db_dbnode AS db_dbnode_1 JOIN db_dblink AS db_dblink_1 ON db_dblink_1.input_id = db_dbnode_1.id JOIN db_dbnode AS db_dbnode_2 ON db_dblink_1.output_id = db_dbnode_2.id WHERE db_dbnode_1.type = 'calculation.work.WorkCalculation.' AND db_dbnode_2.type LIKE 'calculation.%' AND ( db_dblink_1.type = null OR db_dblink_1.type = '') ); """), update_schema_version(SCHEMA_VERSION) ]
class Migration(migrations.Migration): dependencies = [ ('db', '0002_db_state_change'), ] operations = [ migrations.AddField( model_name='dblink', name='type', field=models.CharField(db_index=True, max_length=255, blank=True), preserve_default=True, ), migrations.AlterField( model_name='dbcalcstate', name='time', field=models.DateTimeField(default=aiida.utils.timezone.now, editable=False), preserve_default=True, ), migrations.AlterField( model_name='dbcomment', name='ctime', field=models.DateTimeField(default=aiida.utils.timezone.now, editable=False), preserve_default=True, ), migrations.AlterField( model_name='dbgroup', name='time', field=models.DateTimeField(default=aiida.utils.timezone.now, editable=False), preserve_default=True, ), migrations.AlterField( model_name='dblock', name='creation', field=models.DateTimeField(default=aiida.utils.timezone.now, editable=False), preserve_default=True, ), migrations.AlterField( model_name='dblog', name='time', field=models.DateTimeField(default=aiida.utils.timezone.now, editable=False), preserve_default=True, ), migrations.AlterField( model_name='dbnode', name='ctime', field=models.DateTimeField(default=aiida.utils.timezone.now, editable=False), preserve_default=True, ), migrations.AlterField( model_name='dbuser', name='date_joined', field=models.DateTimeField(default=aiida.utils.timezone.now), preserve_default=True, ), migrations.AlterField( model_name='dbworkflow', name='ctime', field=models.DateTimeField(default=aiida.utils.timezone.now, editable=False), preserve_default=True, ), migrations.AlterField( model_name='dbworkflowdata', name='time', field=models.DateTimeField(default=aiida.utils.timezone.now, editable=False), preserve_default=True, ), migrations.AlterField( model_name='dbworkflowstep', name='time', field=models.DateTimeField(default=aiida.utils.timezone.now, editable=False), preserve_default=True, ), migrations.AlterUniqueTogether( name='dblink', unique_together=set([]), ), update_schema_version(SCHEMA_VERSION) ]