Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Increase voucher code limit (#8519)

Dawid Matuszczykcb7d8552dde4
diff --git a/saleor/discount/migrations/0029_alter_voucher_code.py b/saleor/discount/migrations/0029_alter_voucher_code.py
new file mode 100644
index 0000000000..8c43ea3169
--- /dev/null
+++ b/saleor/discount/migrations/0029_alter_voucher_code.py
@@ -0,0 +1,18 @@
+# Generated by Django 3.2.8 on 2021-11-04 11:48
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ("discount", "0028_auto_20210817_1015"),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name="voucher",
+ name="code",
+ field=models.CharField(db_index=True, max_length=255, unique=True),
+ ),
+ ]
diff --git a/saleor/discount/migrations/0031_merge_0029_alter_voucher_code_0030_discount_variants.py b/saleor/discount/migrations/0031_merge_0029_alter_voucher_code_0030_discount_variants.py
new file mode 100644
index 0000000000..97f8368daa
--- /dev/null
+++ b/saleor/discount/migrations/0031_merge_0029_alter_voucher_code_0030_discount_variants.py
@@ -0,0 +1,13 @@
+# Generated by Django 3.2.8 on 2021-11-05 12:34
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ("discount", "0029_alter_voucher_code"),
+ ("discount", "0030_discount_variants"),
+ ]
+
+ operations = []
diff --git a/saleor/discount/models.py b/saleor/discount/models.py
index 56f4530bb1..ea9ef7e95a 100644
--- a/saleor/discount/models.py
+++ b/saleor/discount/models.py
@@ -63,7 +63,7 @@ class Voucher(ModelWithMetadata):
max_length=20, choices=VoucherType.CHOICES, default=VoucherType.ENTIRE_ORDER
)
name = models.CharField(max_length=255, null=True, blank=True)
- code = models.CharField(max_length=16, unique=True, db_index=True)
+ code = models.CharField(max_length=255, unique=True, db_index=True)
usage_limit = models.PositiveIntegerField(null=True, blank=True)
used = models.PositiveIntegerField(default=0, editable=False)
start_date = models.DateTimeField(default=timezone.now)