mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-25 22:22:26 +00:00
Fix error on migration 48 and split for pg_triggers reason
This commit is contained in:
parent
d8bc523827
commit
01af6ea927
2 changed files with 49 additions and 32 deletions
|
@ -13,38 +13,14 @@ class Migration(migrations.Migration):
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
def set_value_to_0(apps, schema_editor):
|
def set_value_to_zero(apps, schema_editor):
|
||||||
ventes = apps.get_model("cotisations", "Vente")
|
db_alias = schema_editor.connection.alias
|
||||||
ventes.filter(duration_connection__isnull=True).update(duration_connection=0)
|
Vente = apps.get_model("cotisations", "Vente")
|
||||||
ventes.filter(duration_days_connection__isnull=True).update(duration_days_connection=0)
|
Vente.objects.using(db_alias).filter(duration_connection__isnull=True).update(duration_connection=0)
|
||||||
ventes.filter(duration_membership__isnull=True).update(duration_membership=0)
|
Vente.objects.using(db_alias).filter(duration_days_connection__isnull=True).update(duration_days_connection=0)
|
||||||
ventes.filter(duration_days_membership__isnull=True).update(duration_days_membership=0)
|
Vente.objects.using(db_alias).filter(duration_membership__isnull=True).update(duration_membership=0)
|
||||||
|
Vente.objects.using(db_alias).filter(duration_days_membership__isnull=True).update(duration_days_membership=0)
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.RunPython(set_value_to_0),
|
migrations.RunPython(set_value_to_zero),
|
||||||
migrations.AlterField(
|
|
||||||
model_name='article',
|
|
||||||
name='need_membership',
|
|
||||||
field=models.BooleanField(default=True, verbose_name='need membership to be purchased'),
|
|
||||||
),
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='vente',
|
|
||||||
name='duration_connection',
|
|
||||||
field=models.PositiveIntegerField(default=0, verbose_name='duration of the connection (in months)'),
|
|
||||||
),
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='vente',
|
|
||||||
name='duration_days_connection',
|
|
||||||
field=models.PositiveIntegerField(default=0, validators=[django.core.validators.MinValueValidator(0)], verbose_name='duration of the connection (in days, will be added to duration in months)'),
|
|
||||||
),
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='vente',
|
|
||||||
name='duration_days_membership',
|
|
||||||
field=models.PositiveIntegerField(default=0, validators=[django.core.validators.MinValueValidator(0)], verbose_name='duration of the membership (in days, will be added to duration in months)'),
|
|
||||||
),
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='vente',
|
|
||||||
name='duration_membership',
|
|
||||||
field=models.PositiveIntegerField(default=0, verbose_name='duration of the membership (in months)'),
|
|
||||||
),
|
|
||||||
]
|
]
|
||||||
|
|
41
cotisations/migrations/0049_auto_20201102_2305.py
Normal file
41
cotisations/migrations/0049_auto_20201102_2305.py
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by Django 1.11.29 on 2020-11-02 22:05
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import django.core.validators
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('cotisations', '0048_auto_20201017_0018'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='article',
|
||||||
|
name='need_membership',
|
||||||
|
field=models.BooleanField(default=True, verbose_name='need membership to be purchased'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='vente',
|
||||||
|
name='duration_connection',
|
||||||
|
field=models.PositiveIntegerField(default=0, verbose_name='duration of the connection (in months)'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='vente',
|
||||||
|
name='duration_days_connection',
|
||||||
|
field=models.PositiveIntegerField(default=0, validators=[django.core.validators.MinValueValidator(0)], verbose_name='duration of the connection (in days, will be added to duration in months)'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='vente',
|
||||||
|
name='duration_days_membership',
|
||||||
|
field=models.PositiveIntegerField(default=0, validators=[django.core.validators.MinValueValidator(0)], verbose_name='duration of the membership (in days, will be added to duration in months)'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='vente',
|
||||||
|
name='duration_membership',
|
||||||
|
field=models.PositiveIntegerField(default=0, verbose_name='duration of the membership (in months)'),
|
||||||
|
),
|
||||||
|
]
|
Loading…
Reference in a new issue