reverting and merging into streaming app instead
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 2s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 2s
This commit is contained in:
@@ -30,9 +30,6 @@ class ProjectDatabaseRouter:
|
||||
if model._meta.app_label == 'streaming':
|
||||
return 'streaming_db'
|
||||
|
||||
if model._meta.app_label == 'streaming_redirect':
|
||||
return 'streaming_redirect_db'
|
||||
|
||||
return 'default'
|
||||
|
||||
def db_for_write(self, model, **hints):
|
||||
@@ -59,17 +56,14 @@ class ProjectDatabaseRouter:
|
||||
if model._meta.app_label == 'streaming':
|
||||
return 'streaming_db'
|
||||
|
||||
if model._meta.app_label == 'streaming_redirect':
|
||||
return 'streaming_redirect_db'
|
||||
|
||||
return 'default'
|
||||
|
||||
def allow_relation(self, obj1, obj2, **hints):
|
||||
"""Allow relations if both models are in the same database."""
|
||||
# Prevents accidental foreign key relationships across different physical DBs
|
||||
if (
|
||||
obj1._meta.app_label in ['cloudmanager', 'simpsons', 'redirect', 'job', 'telegram', 'podcast', 'streaming', 'streaming_redirect'] or
|
||||
obj2._meta.app_label in ['cloudmanager', 'simpsons', 'redirect', 'job', 'telegram', 'podcast', 'streaming', 'streaming_redirect']
|
||||
obj1._meta.app_label in ['cloudmanager', 'simpsons', 'redirect', 'job', 'telegram', 'podcast', 'streaming'] or
|
||||
obj2._meta.app_label in ['cloudmanager', 'simpsons', 'redirect', 'job', 'telegram', 'podcast', 'streaming']
|
||||
):
|
||||
return obj1._meta.app_label == obj2._meta.app_label
|
||||
return None
|
||||
@@ -98,11 +92,8 @@ class ProjectDatabaseRouter:
|
||||
if app_label == 'streaming':
|
||||
return db == 'streaming_db'
|
||||
|
||||
if app_label == 'streaming_redirect':
|
||||
return db == 'streaming_redirect_db'
|
||||
|
||||
# Ensure default Django apps (auth, sessions, etc.) don't migrate into simpsons/cloudmanager
|
||||
if db in ['cloudmanager_db', 'simpsons_db', 'redirect_db', 'job_db', 'telegram_db', 'podcast_db', 'streaming_db', 'streaming_redirect_db']:
|
||||
if db in ['cloudmanager_db', 'simpsons_db', 'redirect_db', 'job_db', 'telegram_db', 'podcast_db', 'streaming_db']:
|
||||
return False
|
||||
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user