From b3991d03882948d4acd587f5507fa6e1745a6b9f Mon Sep 17 00:00:00 2001 From: ibuler Date: Thu, 11 Mar 2021 10:46:57 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DMigrate=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix: 修复 org migrations 依赖 --- apps/orgs/migrations/0010_auto_20210219_1241.py | 9 ++++++++- apps/orgs/utils.py | 2 ++ apps/terminal/migrations/0017_auto_20191125_0931.py | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/apps/orgs/migrations/0010_auto_20210219_1241.py b/apps/orgs/migrations/0010_auto_20210219_1241.py index 38c79f552..5e561055b 100644 --- a/apps/orgs/migrations/0010_auto_20210219_1241.py +++ b/apps/orgs/migrations/0010_auto_20210219_1241.py @@ -65,8 +65,15 @@ def add_all_user_to_default_org(apps, schema_editor): class Migration(migrations.Migration): dependencies = [ - ('orgs', '0009_auto_20201023_1628'), + ('tickets', '0007_auto_20201224_1821'), + ('audits', '0011_userloginlog_backend'), + ('ops', '0019_adhocexecution_celery_task_id'), ('perms', '0018_auto_20210208_1515'), + ('applications', '0008_auto_20210104_0435'), + ('terminal', '0031_auto_20210113_1356'), + ('users', '0031_auto_20201118_1801'), + ('assets', '0066_auto_20210208_1802'), + ('orgs', '0009_auto_20201023_1628'), ] operations = [ diff --git a/apps/orgs/utils.py b/apps/orgs/utils.py index b2f6d3737..2eaa9e9e6 100644 --- a/apps/orgs/utils.py +++ b/apps/orgs/utils.py @@ -54,6 +54,8 @@ def _find(attr): def get_current_org(): org_id = get_current_org_id() + if not org_id or org_id == Organization.ROOT_ID: + return Organization.root() org = Organization.get_instance(org_id, default=Organization.root()) return org diff --git a/apps/terminal/migrations/0017_auto_20191125_0931.py b/apps/terminal/migrations/0017_auto_20191125_0931.py index c555e6db6..d3389d82b 100644 --- a/apps/terminal/migrations/0017_auto_20191125_0931.py +++ b/apps/terminal/migrations/0017_auto_20191125_0931.py @@ -76,6 +76,7 @@ def migrate_replay_storage(apps, schema_editor): class Migration(migrations.Migration): dependencies = [ + ('settings', '0001_initial'), ('terminal', '0016_commandstorage_replaystorage'), ]