Files
accounting-backend/accounting/migrations/0002_seed_chart_of_accounts.py
2026-07-01 00:29:25 +03:30

28 lines
704 B
Python

from django.db import migrations
from accounting.seeding import seed_default_data
def seed(apps, schema_editor):
Account = apps.get_model('accounting', 'Account')
CompanySettings = apps.get_model('accounting', 'CompanySettings')
seed_default_data(Account, CompanySettings)
def unseed(apps, schema_editor):
Account = apps.get_model('accounting', 'Account')
CompanySettings = apps.get_model('accounting', 'CompanySettings')
CompanySettings.objects.all().delete()
Account.objects.all().delete()
class Migration(migrations.Migration):
dependencies = [
('accounting', '0001_initial'),
]
operations = [
migrations.RunPython(seed, unseed),
]