1- # Generated by Django 5.2b1 on 2025-03-25 14:18
1+ # Generated by Django 5.2b1 on 2025-03-30 18:24
22
3+ import django .db .models .deletion
4+ import uuid
35from django .db import migrations , models
46
57
@@ -13,15 +15,6 @@ class Migration(migrations.Migration):
1315 migrations .CreateModel (
1416 name = 'Company' ,
1517 fields = [
16- (
17- 'id' ,
18- models .BigAutoField (
19- auto_created = True ,
20- primary_key = True ,
21- serialize = False ,
22- verbose_name = 'ID' ,
23- ),
24- ),
2518 (
2619 'password' ,
2720 models .CharField (max_length = 128 , verbose_name = 'password' ),
@@ -32,6 +25,16 @@ class Migration(migrations.Migration):
3225 blank = True , null = True , verbose_name = 'last login'
3326 ),
3427 ),
28+ (
29+ 'id' ,
30+ models .UUIDField (
31+ default = uuid .uuid4 ,
32+ editable = False ,
33+ primary_key = True ,
34+ serialize = False ,
35+ verbose_name = 'UUID' ,
36+ ),
37+ ),
3538 ('email' , models .EmailField (max_length = 120 , unique = True )),
3639 ('name' , models .CharField (max_length = 50 )),
3740 ('token_version' , models .IntegerField (default = 0 )),
@@ -42,4 +45,78 @@ class Migration(migrations.Migration):
4245 'abstract' : False ,
4346 },
4447 ),
48+ migrations .CreateModel (
49+ name = 'Promo' ,
50+ fields = [
51+ (
52+ 'id' ,
53+ models .UUIDField (
54+ default = uuid .uuid4 ,
55+ editable = False ,
56+ primary_key = True ,
57+ serialize = False ,
58+ verbose_name = 'UUID' ,
59+ ),
60+ ),
61+ ('description' , models .CharField (max_length = 300 )),
62+ (
63+ 'image_url' ,
64+ models .URLField (blank = True , max_length = 350 , null = True ),
65+ ),
66+ ('target' , models .JSONField (default = dict )),
67+ ('max_count' , models .IntegerField ()),
68+ ('active_from' , models .DateField (blank = True , null = True )),
69+ ('active_until' , models .DateField (blank = True , null = True )),
70+ (
71+ 'mode' ,
72+ models .CharField (
73+ choices = [('COMMON' , 'Common' ), ('UNIQUE' , 'Unique' )],
74+ max_length = 10 ,
75+ ),
76+ ),
77+ (
78+ 'promo_common' ,
79+ models .CharField (blank = True , max_length = 30 , null = True ),
80+ ),
81+ ('active' , models .BooleanField (default = True )),
82+ ('created_at' , models .DateTimeField (auto_now_add = True )),
83+ (
84+ 'company' ,
85+ models .ForeignKey (
86+ blank = True ,
87+ null = True ,
88+ on_delete = django .db .models .deletion .CASCADE ,
89+ to = 'business.company' ,
90+ ),
91+ ),
92+ ],
93+ ),
94+ migrations .CreateModel (
95+ name = 'PromoCode' ,
96+ fields = [
97+ (
98+ 'id' ,
99+ models .BigAutoField (
100+ auto_created = True ,
101+ primary_key = True ,
102+ serialize = False ,
103+ verbose_name = 'ID' ,
104+ ),
105+ ),
106+ ('code' , models .CharField (max_length = 30 )),
107+ ('is_used' , models .BooleanField (default = False )),
108+ ('used_at' , models .DateTimeField (blank = True , null = True )),
109+ (
110+ 'promo' ,
111+ models .ForeignKey (
112+ on_delete = django .db .models .deletion .CASCADE ,
113+ related_name = 'unique_codes' ,
114+ to = 'business.promo' ,
115+ ),
116+ ),
117+ ],
118+ options = {
119+ 'unique_together' : {('promo' , 'code' )},
120+ },
121+ ),
45122 ]
0 commit comments