Initial commit from monorepo
This commit is contained in:
78
billing_app/migrations/0003_refactor_models.py
Normal file
78
billing_app/migrations/0003_refactor_models.py
Normal file
@@ -0,0 +1,78 @@
|
||||
# Generated manually - refactor billing models
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
import uuid
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('billing_app', '0002_remove_account_tigerbeetle_account_id'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
# 1. Delete old models
|
||||
migrations.DeleteModel(
|
||||
name='Operation',
|
||||
),
|
||||
migrations.DeleteModel(
|
||||
name='TransactionReason',
|
||||
),
|
||||
|
||||
# 2. Alter Account model - update account_type choices and remove name help_text
|
||||
migrations.AlterField(
|
||||
model_name='account',
|
||||
name='account_type',
|
||||
field=models.CharField(
|
||||
choices=[('USER', 'User Account'), ('SERVICE', 'Service Account')],
|
||||
default='USER',
|
||||
max_length=50,
|
||||
),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='account',
|
||||
name='name',
|
||||
field=models.CharField(help_text='Название аккаунта', max_length=255),
|
||||
),
|
||||
migrations.AlterModelOptions(
|
||||
name='account',
|
||||
options={'ordering': ['-created_at'], 'verbose_name': 'Account', 'verbose_name_plural': 'Accounts'},
|
||||
),
|
||||
|
||||
# 3. Create OperationCode model
|
||||
migrations.CreateModel(
|
||||
name='OperationCode',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('code', models.PositiveIntegerField(help_text='Числовой код для TigerBeetle', unique=True)),
|
||||
('name', models.CharField(help_text='Название операции', max_length=255, unique=True)),
|
||||
('description', models.TextField(blank=True, null=True)),
|
||||
('created_at', models.DateTimeField(auto_now_add=True)),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Operation Code',
|
||||
'verbose_name_plural': 'Operation Codes',
|
||||
'ordering': ['code'],
|
||||
},
|
||||
),
|
||||
|
||||
# 4. Create ServiceAccount model
|
||||
migrations.CreateModel(
|
||||
name='ServiceAccount',
|
||||
fields=[
|
||||
('account', models.OneToOneField(
|
||||
on_delete=models.deletion.CASCADE,
|
||||
primary_key=True,
|
||||
related_name='service_info',
|
||||
serialize=False,
|
||||
to='billing_app.account'
|
||||
)),
|
||||
('slug', models.SlugField(help_text='Уникальный идентификатор (bank, revenue, etc)', unique=True)),
|
||||
],
|
||||
options={
|
||||
'verbose_name': 'Service Account',
|
||||
'verbose_name_plural': 'Service Accounts',
|
||||
},
|
||||
),
|
||||
]
|
||||
Reference in New Issue
Block a user