I am trying to have two tables in one database like below based on development and production environment.
- development
dev_my_comments
- production
my_comments
I tried using environment variable while declaring table like below
class Data_Comments(models.Model):
class Status(models.IntegerChoices):
GENERAL = 0
YELLOW = 1
RED = 2
ord_no = models.ForeignKey(Data_Import, on_delete=models.CASCADE, related_name='comments')
comment = models.CharField(max_length=500, null=True)
strike_comment_type = models.IntegerField(choices=Status.choices, default=0)
strike_date = models.DateTimeField(auto_now=True, blank=True)
updated_by = models.ForeignKey(User, on_delete=models.PROTECT, related_name='comments_user')
class Meta:
db_table = 'my_comments' if settings.ENV_TYPE == 'PRO' else 'dev_my_comments'
app_label = "my_app"
by using this option, make migrations just renames existing tables instead of creating new... (wanted to have both the tables and want to migrate changes on both tables)
is there something I am missing to make it work?