uncloud/uncloud_pay/migrations/0028_auto_20201006_1529.py
2020-10-06 18:53:13 +02:00

36 lines
1.4 KiB
Python

# Generated by Django 3.1 on 2020-10-06 15:29
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('uncloud_pay', '0027_auto_20201006_1319'),
]
operations = [
migrations.RemoveField(
model_name='product',
name='default_recurring_period',
),
migrations.CreateModel(
name='ProductToRecurringPeriod',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('is_default', models.BooleanField(default=False)),
('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='uncloud_pay.product')),
('recurring_period', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='uncloud_pay.recurringperiod')),
],
),
migrations.AddField(
model_name='product',
name='recurring_periods',
field=models.ManyToManyField(through='uncloud_pay.ProductToRecurringPeriod', to='uncloud_pay.RecurringPeriod'),
),
migrations.AddConstraint(
model_name='producttorecurringperiod',
constraint=models.UniqueConstraint(condition=models.Q(is_default=True), fields=('recurring_period', 'product'), name='one_default_recurring_period_per_product'),
),
]