Add telegram_communication app with dedicated DB routing
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3s

- Register TelegramCommunicationConfig in INSTALLED_APPS and add telegram_db to DATABASES
- Define TelegramData model mapped to the messages table
- Fix allow_migrate in ProjectDatabaseRouter: redirect and telegram entries were returning the DB name string (always truthy) instead of a boolean comparison, causing their migrations to bleed into every database
- Add telegram routing to db_for_read, db_for_write, allow_relation, and allow_migrate

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-30 13:20:40 +01:00
co-authored by Claude Sonnet 4.6
parent ec2696ee43
commit b4545d6c99
7 changed files with 92 additions and 6 deletions
@@ -3,4 +3,5 @@ from django.apps import AppConfig
class TelegramCommunicationConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'telegram_communication'
name = 'apps.telegram_communication'
label = 'telegram'
@@ -0,0 +1,28 @@
# Generated by Django 4.2.30 on 2026-06-30 12:13
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='TelegramData',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('message_id', models.IntegerField(max_length=100, null=True)),
('chat_id', models.IntegerField(max_length=100, null=True)),
('description', models.CharField(max_length=100, null=True)),
('creation_date', models.DateField(blank=True, null=True, verbose_name='Published')),
('expiration_date', models.DateField(blank=True, null=True, verbose_name='Published')),
],
options={
'db_table': 'messages',
},
),
]
@@ -0,0 +1,33 @@
# Generated by Django 4.2.30 on 2026-06-30 12:14
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('telegram', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='telegramdata',
name='chat_id',
field=models.IntegerField(),
),
migrations.AlterField(
model_name='telegramdata',
name='creation_date',
field=models.DateField(blank=True, verbose_name='Published'),
),
migrations.AlterField(
model_name='telegramdata',
name='expiration_date',
field=models.DateField(blank=True, verbose_name='Published'),
),
migrations.AlterField(
model_name='telegramdata',
name='message_id',
field=models.IntegerField(),
),
]
@@ -1,3 +1,12 @@
from django.db import models
# Create your models here.
class TelegramData(models.Model):
message_id = models.IntegerField(null=False)
chat_id = models.IntegerField(null=False)
description = models.CharField(max_length=100, null=True)
creation_date = models.DateField(blank=True, null=False, verbose_name='Published')
expiration_date = models.DateField(blank=True, null=False, verbose_name='Published')
class Meta:
db_table = 'messages'