mirror of
https://github.com/netbox-community/netbox.git
synced 2026-01-14 15:52:18 -06:00
Merge pull request #19443 from netbox-community/19440-migration-connections
Fixes #19440: Ensure data migrations use the correct database connection
This commit is contained in:
@@ -8,11 +8,12 @@ def set_null_values(apps, schema_editor):
|
||||
IKEPolicy = apps.get_model('vpn', 'IKEPolicy')
|
||||
IKEProposal = apps.get_model('vpn', 'IKEProposal')
|
||||
IPSecProposal = apps.get_model('vpn', 'IPSecProposal')
|
||||
db_alias = schema_editor.connection.alias
|
||||
|
||||
IKEPolicy.objects.filter(mode='').update(mode=None)
|
||||
IKEProposal.objects.filter(authentication_algorithm='').update(authentication_algorithm=None)
|
||||
IPSecProposal.objects.filter(authentication_algorithm='').update(authentication_algorithm=None)
|
||||
IPSecProposal.objects.filter(encryption_algorithm='').update(encryption_algorithm=None)
|
||||
IKEPolicy.objects.using(db_alias).filter(mode='').update(mode=None)
|
||||
IKEProposal.objects.using(db_alias).filter(authentication_algorithm='').update(authentication_algorithm=None)
|
||||
IPSecProposal.objects.using(db_alias).filter(authentication_algorithm='').update(authentication_algorithm=None)
|
||||
IPSecProposal.objects.using(db_alias).filter(encryption_algorithm='').update(encryption_algorithm=None)
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
Reference in New Issue
Block a user