66 lines
2.2 KiB
Python
66 lines
2.2 KiB
Python
# Migration: Remove inheritance, add ContentType GenericFK
|
|
import uuid
|
|
from django.db import migrations, models
|
|
import django.db.models.deletion
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
('contenttypes', '0002_remove_content_type_name'),
|
|
('kyc_app', '0001_initial'),
|
|
]
|
|
|
|
operations = [
|
|
# 1. Drop the old inherited table
|
|
migrations.DeleteModel(
|
|
name='KYCRequestRussia',
|
|
),
|
|
|
|
# 2. Remove registration_number from KYCRequest (was for inherited ogrn)
|
|
migrations.RemoveField(
|
|
model_name='kycrequest',
|
|
name='registration_number',
|
|
),
|
|
|
|
# 3. Add ContentType FK to KYCRequest
|
|
migrations.AddField(
|
|
model_name='kycrequest',
|
|
name='content_type',
|
|
field=models.ForeignKey(
|
|
blank=True,
|
|
null=True,
|
|
on_delete=django.db.models.deletion.SET_NULL,
|
|
related_name='kyc_requests',
|
|
to='contenttypes.contenttype',
|
|
),
|
|
),
|
|
|
|
# 4. Add object_id to KYCRequest
|
|
migrations.AddField(
|
|
model_name='kycrequest',
|
|
name='object_id',
|
|
field=models.PositiveIntegerField(blank=True, null=True),
|
|
),
|
|
|
|
# 5. Create new KYCRequestRussia (without inheritance)
|
|
migrations.CreateModel(
|
|
name='KYCRequestRussia',
|
|
fields=[
|
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('company_name', models.CharField(max_length=255)),
|
|
('company_full_name', models.TextField()),
|
|
('inn', models.CharField(max_length=12)),
|
|
('kpp', models.CharField(blank=True, max_length=9)),
|
|
('ogrn', models.CharField(blank=True, max_length=15)),
|
|
('address', models.TextField()),
|
|
('bank_name', models.CharField(max_length=255)),
|
|
('bik', models.CharField(max_length=9)),
|
|
('correspondent_account', models.CharField(blank=True, max_length=20)),
|
|
],
|
|
options={
|
|
'db_table': 'kyc_details_russia',
|
|
},
|
|
),
|
|
]
|