aboutsummaryrefslogtreecommitdiffstats
path: root/alphabetlearning/payments/migrations
diff options
context:
space:
mode:
authorMatthew Lemon <y@yulqen.org>2024-12-31 16:01:12 +0000
committerMatthew Lemon <y@yulqen.org>2024-12-31 16:01:12 +0000
commitc74ea9e6b4af97be26029334868fa3264032c2d3 (patch)
tree6d0dcc825f9c4d70f543eeb1817d664e5e358320 /alphabetlearning/payments/migrations
parentb00665b30423e4818afafdec305202797638e145 (diff)
Major refactoring and removal of junk
This commit includes significant refactoring, cleanup, and updates across various components of the Django project. The following changes were made: - **Database Migration Updates:** - Removed unnecessary migrations in the `alphabetlearning.contrib.sites` and `alphabetlearning.payments` apps, consolidating them into cleaner initial migration files. - Altered the `Site` model in `alphabetlearning.contrib.sites` to streamline its fields and default settings. - Introduced new models in `alphabetlearning.payments` related to email signups and verification, reflecting a shift in focus and better alignment with current business logic. - **Django Settings Changes:** - Updated the database settings to use SQLite for local development, while commenting out production-specific configurations. - Managed third-party dependencies within `requirements.txt` and `pyproject.toml`, ensuring alignment with the latest Django version (5.1.4) and removing obsolete dependencies (e.g., `celery`, `django-celery-beat`, `flower`, etc.). - **Docker and Compose Clean-up:** - Removed old Dockerfiles and unnecessary services from the `docker-compose` configuration, streamlining the local and production setups. - Updated the Dockerfile configuration for local development, focusing on essential services only. - **General Code Clean-up:** - Removed unused tasks, views, tests, and files related to the Celery and Redis frameworks. - Cleaned up various model definitions and their related migrations for consistency and clarity. - **Documentation and Comments:** - Updated comments and code documentation where necessary to reflect the changes made during this cleanup process. This major refactor aims to enhance project maintainability and streamline the development experience while preparing for future feature expansions and improvements.
Diffstat (limited to 'alphabetlearning/payments/migrations')
-rw-r--r--alphabetlearning/payments/migrations/0001_initial.py138
-rw-r--r--alphabetlearning/payments/migrations/0002_initial.py46
-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/0008_remove_price_product_price_resource.py25
-rw-r--r--alphabetlearning/payments/migrations/0009_emailsignup_alter_price_resource.py28
-rw-r--r--alphabetlearning/payments/migrations/0010_pendingemailverification.py26
-rw-r--r--alphabetlearning/payments/migrations/0011_remove_pendingemailverification_first_name_and_more.py21
-rw-r--r--alphabetlearning/payments/migrations/0012_rename_pendingemailverification_emailverification.py17
-rw-r--r--alphabetlearning/payments/migrations/0013_alter_emailverification_email.py18
14 files changed, 107 insertions, 383 deletions
diff --git a/alphabetlearning/payments/migrations/0001_initial.py b/alphabetlearning/payments/migrations/0001_initial.py
index 33b7602..136aef1 100644
--- a/alphabetlearning/payments/migrations/0001_initial.py
+++ b/alphabetlearning/payments/migrations/0001_initial.py
@@ -1,7 +1,7 @@
-# Generated by Django 5.0.4 on 2024-09-03 19:21
+# Generated by Django 5.1.4 on 2024-12-31 15:26
import django.db.models.deletion
-from django.conf import settings
+import uuid
from django.db import migrations, models
@@ -10,94 +10,78 @@ class Migration(migrations.Migration):
initial = True
dependencies = [
- ("resources", "0019_alter_pdfpagesnapshot_options_and_more"),
- migrations.swappable_dependency(settings.AUTH_USER_MODEL),
+ ('resources', '0001_initial'),
]
operations = [
migrations.CreateModel(
- name="ShoppingCart",
+ name='EmailSignup',
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,
- ),
- ),
+ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('email', models.EmailField(max_length=254, unique=True)),
+ ('date_added', models.DateTimeField(auto_now_add=True)),
],
),
migrations.CreateModel(
- name="Subscription",
+ name='EmailVerification',
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,
- ),
- ),
+ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('email', models.EmailField(max_length=254, unique=True)),
+ ('verification_token', models.UUIDField(default=uuid.uuid4, editable=False)),
+ ('created_at', models.DateTimeField(auto_now_add=True)),
+ ('is_verified', models.BooleanField(default=False)),
],
),
migrations.CreateModel(
- name="CartItem",
+ name='Product',
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",
- ),
- ),
+ ('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='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)),
+ ],
+ ),
+ 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)),
+ ],
+ ),
+ 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()),
+ ],
+ ),
+ migrations.CreateModel(
+ name='CartItem',
+ fields=[
+ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
+ ('added_at', models.DateTimeField(auto_now_add=True)),
+ ('resource', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='resources.resource')),
+ ],
+ ),
+ 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_price_id', models.CharField(max_length=100)),
+ ('resource', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='price_obj', to='resources.resource')),
],
- options={
- "unique_together": {("cart", "resource")},
- },
),
]
diff --git a/alphabetlearning/payments/migrations/0002_initial.py b/alphabetlearning/payments/migrations/0002_initial.py
new file mode 100644
index 0000000..04df889
--- /dev/null
+++ b/alphabetlearning/payments/migrations/0002_initial.py
@@ -0,0 +1,46 @@
+# Generated by Django 5.1.4 on 2024-12-31 15:26
+
+import django.db.models.deletion
+from django.conf import settings
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ initial = True
+
+ dependencies = [
+ ('payments', '0001_initial'),
+ migrations.swappable_dependency(settings.AUTH_USER_MODEL),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='shoppingcart',
+ name='user',
+ field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
+ ),
+ migrations.AddField(
+ model_name='cartitem',
+ name='cart',
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='items', to='payments.shoppingcart'),
+ ),
+ migrations.AddField(
+ model_name='subscription',
+ name='user',
+ field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
+ ),
+ migrations.AddField(
+ model_name='subscription',
+ name='plan',
+ field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='payments.subscriptionplan'),
+ ),
+ migrations.AlterUniqueTogether(
+ name='cartitem',
+ unique_together={('cart', 'resource')},
+ ),
+ migrations.AddConstraint(
+ model_name='subscription',
+ constraint=models.UniqueConstraint(fields=('user', 'plan'), name='unique_user_plan'),
+ ),
+ ]
diff --git a/alphabetlearning/payments/migrations/0002_subscriptionplan_and_more.py b/alphabetlearning/payments/migrations/0002_subscriptionplan_and_more.py
deleted file mode 100644
index cab49b5..0000000
--- a/alphabetlearning/payments/migrations/0002_subscriptionplan_and_more.py
+++ /dev/null
@@ -1,36 +0,0 @@
-# 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
deleted file mode 100644
index b12d5dc..0000000
--- a/alphabetlearning/payments/migrations/0003_product_price.py
+++ /dev/null
@@ -1,53 +0,0 @@
-# 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
deleted file mode 100644
index e5a339f..0000000
--- a/alphabetlearning/payments/migrations/0004_rename_stripe_product_id_price_stripe_price_id.py
+++ /dev/null
@@ -1,18 +0,0 @@
-# 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
deleted file mode 100644
index 1e642b4..0000000
--- a/alphabetlearning/payments/migrations/0005_remove_subscriptionplan_stripe_plan_id.py
+++ /dev/null
@@ -1,17 +0,0 @@
-# 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
deleted file mode 100644
index f54b5f9..0000000
--- a/alphabetlearning/payments/migrations/0006_subscription_plan.py
+++ /dev/null
@@ -1,24 +0,0 @@
-# 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
deleted file mode 100644
index e976059..0000000
--- a/alphabetlearning/payments/migrations/0007_remove_cartitem_quantity_and_more.py
+++ /dev/null
@@ -1,23 +0,0 @@
-# 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/0008_remove_price_product_price_resource.py b/alphabetlearning/payments/migrations/0008_remove_price_product_price_resource.py
deleted file mode 100644
index 9d52284..0000000
--- a/alphabetlearning/payments/migrations/0008_remove_price_product_price_resource.py
+++ /dev/null
@@ -1,25 +0,0 @@
-# Generated by Django 5.0.4 on 2024-10-19 15:11
-
-import django.db.models.deletion
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('payments', '0007_remove_cartitem_quantity_and_more'),
- ('resources', '0020_remove_resource_price_resource_stripe_product_id'),
- ]
-
- operations = [
- migrations.RemoveField(
- model_name='price',
- name='product',
- ),
- migrations.AddField(
- model_name='price',
- name='resource',
- field=models.ForeignKey(default=66, on_delete=django.db.models.deletion.CASCADE, related_name='price', to='resources.resource'),
- preserve_default=False,
- ),
- ]
diff --git a/alphabetlearning/payments/migrations/0009_emailsignup_alter_price_resource.py b/alphabetlearning/payments/migrations/0009_emailsignup_alter_price_resource.py
deleted file mode 100644
index 4be05a2..0000000
--- a/alphabetlearning/payments/migrations/0009_emailsignup_alter_price_resource.py
+++ /dev/null
@@ -1,28 +0,0 @@
-# Generated by Django 5.0.4 on 2024-11-25 11:32
-
-import django.db.models.deletion
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('payments', '0008_remove_price_product_price_resource'),
- ('resources', '0020_remove_resource_price_resource_stripe_product_id'),
- ]
-
- operations = [
- migrations.CreateModel(
- name='EmailSignup',
- fields=[
- ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('email', models.EmailField(max_length=254, unique=True)),
- ('date_added', models.DateTimeField(auto_now_add=True)),
- ],
- ),
- migrations.AlterField(
- model_name='price',
- name='resource',
- field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='price_obj', to='resources.resource'),
- ),
- ]
diff --git a/alphabetlearning/payments/migrations/0010_pendingemailverification.py b/alphabetlearning/payments/migrations/0010_pendingemailverification.py
deleted file mode 100644
index c49a2cb..0000000
--- a/alphabetlearning/payments/migrations/0010_pendingemailverification.py
+++ /dev/null
@@ -1,26 +0,0 @@
-# Generated by Django 5.0.4 on 2024-12-03 16:18
-
-import uuid
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('payments', '0009_emailsignup_alter_price_resource'),
- ]
-
- operations = [
- migrations.CreateModel(
- name='PendingEmailVerification',
- fields=[
- ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
- ('email', models.EmailField(max_length=254)),
- ('first_name', models.CharField(max_length=100)),
- ('last_name', models.CharField(max_length=100)),
- ('verification_token', models.UUIDField(default=uuid.uuid4, editable=False)),
- ('created_at', models.DateTimeField(auto_now_add=True)),
- ('is_verified', models.BooleanField(default=False)),
- ],
- ),
- ]
diff --git a/alphabetlearning/payments/migrations/0011_remove_pendingemailverification_first_name_and_more.py b/alphabetlearning/payments/migrations/0011_remove_pendingemailverification_first_name_and_more.py
deleted file mode 100644
index e13f6d3..0000000
--- a/alphabetlearning/payments/migrations/0011_remove_pendingemailverification_first_name_and_more.py
+++ /dev/null
@@ -1,21 +0,0 @@
-# Generated by Django 5.0.4 on 2024-12-03 16:38
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('payments', '0010_pendingemailverification'),
- ]
-
- operations = [
- migrations.RemoveField(
- model_name='pendingemailverification',
- name='first_name',
- ),
- migrations.RemoveField(
- model_name='pendingemailverification',
- name='last_name',
- ),
- ]
diff --git a/alphabetlearning/payments/migrations/0012_rename_pendingemailverification_emailverification.py b/alphabetlearning/payments/migrations/0012_rename_pendingemailverification_emailverification.py
deleted file mode 100644
index 770aee5..0000000
--- a/alphabetlearning/payments/migrations/0012_rename_pendingemailverification_emailverification.py
+++ /dev/null
@@ -1,17 +0,0 @@
-# Generated by Django 5.0.4 on 2024-12-03 17:23
-
-from django.db import migrations
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('payments', '0011_remove_pendingemailverification_first_name_and_more'),
- ]
-
- operations = [
- migrations.RenameModel(
- old_name='PendingEmailVerification',
- new_name='EmailVerification',
- ),
- ]
diff --git a/alphabetlearning/payments/migrations/0013_alter_emailverification_email.py b/alphabetlearning/payments/migrations/0013_alter_emailverification_email.py
deleted file mode 100644
index 5d537bb..0000000
--- a/alphabetlearning/payments/migrations/0013_alter_emailverification_email.py
+++ /dev/null
@@ -1,18 +0,0 @@
-# Generated by Django 5.0.4 on 2024-12-05 16:16
-
-from django.db import migrations, models
-
-
-class Migration(migrations.Migration):
-
- dependencies = [
- ('payments', '0012_rename_pendingemailverification_emailverification'),
- ]
-
- operations = [
- migrations.AlterField(
- model_name='emailverification',
- name='email',
- field=models.EmailField(max_length=254, unique=True),
- ),
- ]