Updating for products/recurring periods
This commit is contained in:
parent
c435639241
commit
9623a77907
7 changed files with 230 additions and 56 deletions
36
uncloud_pay/migrations/0028_auto_20201006_1529.py
Normal file
36
uncloud_pay/migrations/0028_auto_20201006_1529.py
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
# 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'),
|
||||
),
|
||||
]
|
||||
18
uncloud_pay/migrations/0029_auto_20201006_1540.py
Normal file
18
uncloud_pay/migrations/0029_auto_20201006_1540.py
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 3.1 on 2020-10-06 15:40
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('uncloud_pay', '0028_auto_20201006_1529'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='product',
|
||||
name='name',
|
||||
field=models.CharField(max_length=256, unique=True),
|
||||
),
|
||||
]
|
||||
21
uncloud_pay/migrations/0030_auto_20201006_1640.py
Normal file
21
uncloud_pay/migrations/0030_auto_20201006_1640.py
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
# Generated by Django 3.1 on 2020-10-06 16:40
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('uncloud_pay', '0029_auto_20201006_1540'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveConstraint(
|
||||
model_name='producttorecurringperiod',
|
||||
name='one_default_recurring_period_per_product',
|
||||
),
|
||||
migrations.AddConstraint(
|
||||
model_name='producttorecurringperiod',
|
||||
constraint=models.UniqueConstraint(condition=models.Q(is_default=True), fields=('product',), name='one_default_recurring_period_per_product'),
|
||||
),
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue