Initial commit
This commit is contained in:
38
subscription/migrations/0001_initial.py
Normal file
38
subscription/migrations/0001_initial.py
Normal file
@@ -0,0 +1,38 @@
|
||||
# Generated by Django 5.2.17 on 2026-08-10 12:00
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Plan',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('title', models.CharField(max_length=50)),
|
||||
('price', models.PositiveIntegerField()),
|
||||
('currency', models.CharField(default='IRT', max_length=10)),
|
||||
('discount_percent', models.PositiveSmallIntegerField(default=0)),
|
||||
('popular', models.BooleanField(default=False)),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Subscription',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('user_id', models.IntegerField(db_index=True, unique=True)),
|
||||
('status', models.CharField(choices=[('pending', 'در انتظار پرداخت'), ('active', 'فعال'), ('expired', 'منقضی'), ('canceled', 'لغوشده')], default='pending', max_length=15)),
|
||||
('started_at', models.DateTimeField(auto_now_add=True)),
|
||||
('expires_at', models.DateTimeField(blank=True, null=True)),
|
||||
('order_id', models.IntegerField(blank=True, null=True)),
|
||||
('plan', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='subscriptions', to='subscription.plan')),
|
||||
],
|
||||
),
|
||||
]
|
||||
18
subscription/migrations/0002_plan_duration_days.py
Normal file
18
subscription/migrations/0002_plan_duration_days.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 5.2.17 on 2026-08-10 17:22
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('subscription', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='plan',
|
||||
name='duration_days',
|
||||
field=models.PositiveIntegerField(default=30),
|
||||
),
|
||||
]
|
||||
0
subscription/migrations/__init__.py
Normal file
0
subscription/migrations/__init__.py
Normal file
Reference in New Issue
Block a user