aboutsummaryrefslogtreecommitdiffstats
path: root/alphabetlearning/payments/migrations
diff options
context:
space:
mode:
Diffstat (limited to 'alphabetlearning/payments/migrations')
-rw-r--r--alphabetlearning/payments/migrations/0001_initial.py103
-rw-r--r--alphabetlearning/payments/migrations/0002_subscriptionplan_and_more.py36
-rw-r--r--alphabetlearning/payments/migrations/0003_product_price.py53
-rw-r--r--alphabetlearning/payments/migrations/0004_rename_stripe_product_id_price_stripe_price_id.py18
-rw-r--r--alphabetlearning/payments/migrations/0005_remove_subscriptionplan_stripe_plan_id.py17
-rw-r--r--alphabetlearning/payments/migrations/0006_subscription_plan.py24
-rw-r--r--alphabetlearning/payments/migrations/0007_remove_cartitem_quantity_and_more.py23
-rw-r--r--alphabetlearning/payments/migrations/__init__.py0
8 files changed, 274 insertions, 0 deletions
diff --git a/alphabetlearning/payments/migrations/0001_initial.py b/alphabetlearning/payments/migrations/0001_initial.py
new file mode 100644
index 0000000..33b7602
--- /dev/null
+++ b/alphabetlearning/payments/migrations/0001_initial.py
@@ -0,0 +1,103 @@
+# Generated by Django 5.0.4 on 2024-09-03 19:21
+
+import django.db.models.deletion
+from django.conf import settings
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ initial = True
+
+ dependencies = [
+ ("resources", "0019_alter_pdfpagesnapshot_options_and_more"),
+ migrations.swappable_dependency(settings.AUTH_USER_MODEL),
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name="ShoppingCart",
+ fields=[
+ (
+ "id",
+ models.BigAutoField(
+ auto_created=True,
+ primary_key=True,
+ serialize=False,
+ verbose_name="ID",
+ ),
+ ),
+ ("created_at", models.DateTimeField(auto_now_add=True)),
+ ("updated_at", models.DateTimeField(auto_now=True)),
+ (
+ "user",
+ models.OneToOneField(
+ on_delete=django.db.models.deletion.CASCADE,
+ to=settings.AUTH_USER_MODEL,
+ ),
+ ),
+ ],
+ ),
+ migrations.CreateModel(
+ name="Subscription",
+ fields=[
+ (
+ "id",
+ models.BigAutoField(
+ auto_created=True,
+ primary_key=True,
+ serialize=False,
+ verbose_name="ID",
+ ),
+ ),
+ ("is_active", models.BooleanField(default=False)),
+ ("start_date", models.DateTimeField(blank=True, null=True)),
+ ("end_date", models.DateTimeField(blank=True, null=True)),
+ (
+ "stripe_subscription_id",
+ models.CharField(blank=True, max_length=255, null=True),
+ ),
+ (
+ "user",
+ models.OneToOneField(
+ on_delete=django.db.models.deletion.CASCADE,
+ to=settings.AUTH_USER_MODEL,
+ ),
+ ),
+ ],
+ ),
+ migrations.CreateModel(
+ name="CartItem",
+ fields=[
+ (
+ "id",
+ models.BigAutoField(
+ auto_created=True,
+ primary_key=True,
+ serialize=False,
+ verbose_name="ID",
+ ),
+ ),
+ ("quantity", models.PositiveIntegerField(default=1)),
+ ("added_at", models.DateTimeField(auto_now_add=True)),
+ (
+ "resource",
+ models.ForeignKey(
+ on_delete=django.db.models.deletion.CASCADE,
+ to="resources.resource",
+ ),
+ ),
+ (
+ "cart",
+ models.ForeignKey(
+ on_delete=django.db.models.deletion.CASCADE,
+ related_name="items",
+ to="payments.shoppingcart",
+ ),
+ ),
+ ],
+ options={
+ "unique_together": {("cart", "resource")},
+ },
+ ),
+ ]
diff --git a/alphabetlearning/payments/migrations/0002_subscriptionplan_and_more.py b/alphabetlearning/payments/migrations/0002_subscriptionplan_and_more.py
new file mode 100644
index 0000000..cab49b5
--- /dev/null
+++ b/alphabetlearning/payments/migrations/0002_subscriptionplan_and_more.py
@@ -0,0 +1,36 @@
+# Generated by Django 5.0.4 on 2024-09-03 19:32
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ("payments", "0001_initial"),
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name="SubscriptionPlan",
+ fields=[
+ (
+ "id",
+ models.BigAutoField(
+ auto_created=True,
+ primary_key=True,
+ serialize=False,
+ verbose_name="ID",
+ ),
+ ),
+ ("name", models.CharField(max_length=255)),
+ ("price", models.DecimalField(decimal_places=2, max_digits=6)),
+ ("description", models.TextField()),
+ ("allowed_downloads", models.PositiveIntegerField()),
+ ("stripe_plan_id", models.CharField(max_length=255)),
+ ],
+ ),
+ migrations.RemoveField(
+ model_name="subscription",
+ name="stripe_subscription_id",
+ ),
+ ]
diff --git a/alphabetlearning/payments/migrations/0003_product_price.py b/alphabetlearning/payments/migrations/0003_product_price.py
new file mode 100644
index 0000000..b12d5dc
--- /dev/null
+++ b/alphabetlearning/payments/migrations/0003_product_price.py
@@ -0,0 +1,53 @@
+# Generated by Django 5.0.4 on 2024-09-04 19:01
+
+import django.db.models.deletion
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ("payments", "0002_subscriptionplan_and_more"),
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name="Product",
+ fields=[
+ (
+ "id",
+ models.BigAutoField(
+ auto_created=True,
+ primary_key=True,
+ serialize=False,
+ verbose_name="ID",
+ ),
+ ),
+ ("name", models.CharField(max_length=255)),
+ ("stripe_product_id", models.CharField(max_length=100)),
+ ],
+ ),
+ migrations.CreateModel(
+ name="Price",
+ fields=[
+ (
+ "id",
+ models.BigAutoField(
+ auto_created=True,
+ primary_key=True,
+ serialize=False,
+ verbose_name="ID",
+ ),
+ ),
+ ("price", models.IntegerField(default=0)),
+ ("stripe_product_id", models.CharField(max_length=100)),
+ (
+ "product",
+ models.ForeignKey(
+ on_delete=django.db.models.deletion.CASCADE,
+ to="payments.product",
+ ),
+ ),
+ ],
+ ),
+ ]
diff --git a/alphabetlearning/payments/migrations/0004_rename_stripe_product_id_price_stripe_price_id.py b/alphabetlearning/payments/migrations/0004_rename_stripe_product_id_price_stripe_price_id.py
new file mode 100644
index 0000000..e5a339f
--- /dev/null
+++ b/alphabetlearning/payments/migrations/0004_rename_stripe_product_id_price_stripe_price_id.py
@@ -0,0 +1,18 @@
+# Generated by Django 5.0.4 on 2024-09-04 19:17
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ("payments", "0003_product_price"),
+ ]
+
+ operations = [
+ migrations.RenameField(
+ model_name="price",
+ old_name="stripe_product_id",
+ new_name="stripe_price_id",
+ ),
+ ]
diff --git a/alphabetlearning/payments/migrations/0005_remove_subscriptionplan_stripe_plan_id.py b/alphabetlearning/payments/migrations/0005_remove_subscriptionplan_stripe_plan_id.py
new file mode 100644
index 0000000..1e642b4
--- /dev/null
+++ b/alphabetlearning/payments/migrations/0005_remove_subscriptionplan_stripe_plan_id.py
@@ -0,0 +1,17 @@
+# Generated by Django 5.0.4 on 2024-09-08 19:23
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ("payments", "0004_rename_stripe_product_id_price_stripe_price_id"),
+ ]
+
+ operations = [
+ migrations.RemoveField(
+ model_name="subscriptionplan",
+ name="stripe_plan_id",
+ ),
+ ]
diff --git a/alphabetlearning/payments/migrations/0006_subscription_plan.py b/alphabetlearning/payments/migrations/0006_subscription_plan.py
new file mode 100644
index 0000000..f54b5f9
--- /dev/null
+++ b/alphabetlearning/payments/migrations/0006_subscription_plan.py
@@ -0,0 +1,24 @@
+# Generated by Django 5.0.4 on 2024-09-08 20:21
+
+import django.db.models.deletion
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ("payments", "0005_remove_subscriptionplan_stripe_plan_id"),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name="subscription",
+ name="plan",
+ field=models.ForeignKey(
+ default=1,
+ on_delete=django.db.models.deletion.CASCADE,
+ to="payments.subscriptionplan",
+ ),
+ preserve_default=False,
+ ),
+ ]
diff --git a/alphabetlearning/payments/migrations/0007_remove_cartitem_quantity_and_more.py b/alphabetlearning/payments/migrations/0007_remove_cartitem_quantity_and_more.py
new file mode 100644
index 0000000..e976059
--- /dev/null
+++ b/alphabetlearning/payments/migrations/0007_remove_cartitem_quantity_and_more.py
@@ -0,0 +1,23 @@
+# Generated by Django 5.0.4 on 2024-09-14 14:40
+
+from django.conf import settings
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('payments', '0006_subscription_plan'),
+ migrations.swappable_dependency(settings.AUTH_USER_MODEL),
+ ]
+
+ operations = [
+ migrations.RemoveField(
+ model_name='cartitem',
+ name='quantity',
+ ),
+ migrations.AddConstraint(
+ model_name='subscription',
+ constraint=models.UniqueConstraint(fields=('user', 'plan'), name='unique_user_plan'),
+ ),
+ ]
diff --git a/alphabetlearning/payments/migrations/__init__.py b/alphabetlearning/payments/migrations/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/alphabetlearning/payments/migrations/__init__.py