diff --git a/company_site/financial/migrations/0016_billing_invoices_subscriptions.py b/company_site/financial/migrations/0016_billing_invoices_subscriptions.py new file mode 100644 index 0000000..de4f739 --- /dev/null +++ b/company_site/financial/migrations/0016_billing_invoices_subscriptions.py @@ -0,0 +1,88 @@ +# Generated by Django 5.0 on 2026-07-31 11:31 + +import django.db.models.deletion +import django.utils.timezone +from django.conf import settings +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('financial', '0015_userprofile'), + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.CreateModel( + name='BillingCustomer', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('created', models.DateTimeField(default=django.utils.timezone.now)), + ('last_modified', models.DateTimeField(default=django.utils.timezone.now)), + ('slug', models.SlugField(blank=True, null=True, unique=True)), + ('name', models.CharField(max_length=200)), + ('email', models.EmailField(max_length=254)), + ('company', models.CharField(blank=True, max_length=200)), + ('stripe_customer_id', models.CharField(blank=True, default='', max_length=255)), + ('notes', models.TextField(blank=True)), + ('created_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)), + ('last_modified_BY', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)), + ], + options={ + 'ordering': ['name'], + }, + ), + migrations.CreateModel( + name='Invoice', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('created', models.DateTimeField(default=django.utils.timezone.now)), + ('last_modified', models.DateTimeField(default=django.utils.timezone.now)), + ('slug', models.SlugField(blank=True, null=True, unique=True)), + ('description', models.CharField(max_length=500)), + ('amount_cents', models.PositiveIntegerField(help_text='Amount in cents (USD)')), + ('currency', models.CharField(default='usd', max_length=3)), + ('status', models.CharField(choices=[('draft', 'Draft'), ('open', 'Open'), ('paid', 'Paid'), ('void', 'Void'), ('uncollectible', 'Uncollectible'), ('failed', 'Failed')], default='draft', max_length=20)), + ('due_date', models.DateField(blank=True, null=True)), + ('notes', models.TextField(blank=True)), + ('stripe_invoice_id', models.CharField(blank=True, default='', max_length=255)), + ('hosted_invoice_url', models.URLField(blank=True, default='', max_length=500)), + ('invoice_pdf_url', models.URLField(blank=True, default='', max_length=500)), + ('pay_link_emailed_at', models.DateTimeField(blank=True, null=True)), + ('created_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)), + ('customer', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='invoices', to='financial.billingcustomer')), + ('last_modified_BY', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)), + ], + options={ + 'ordering': ['-created'], + }, + ), + migrations.CreateModel( + name='RecurringSubscription', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('created', models.DateTimeField(default=django.utils.timezone.now)), + ('last_modified', models.DateTimeField(default=django.utils.timezone.now)), + ('slug', models.SlugField(blank=True, null=True, unique=True)), + ('description', models.CharField(max_length=500)), + ('amount_cents', models.PositiveIntegerField(help_text='Amount per period in cents (USD)')), + ('currency', models.CharField(default='usd', max_length=3)), + ('interval', models.CharField(choices=[('month', 'Monthly'), ('year', 'Yearly'), ('week', 'Weekly')], default='month', max_length=10)), + ('status', models.CharField(choices=[('incomplete', 'Incomplete'), ('active', 'Active'), ('past_due', 'Past due'), ('canceled', 'Canceled'), ('unpaid', 'Unpaid'), ('trialing', 'Trialing'), ('paused', 'Paused')], default='incomplete', max_length=20)), + ('notes', models.TextField(blank=True)), + ('stripe_product_id', models.CharField(blank=True, default='', max_length=255)), + ('stripe_price_id', models.CharField(blank=True, default='', max_length=255)), + ('stripe_subscription_id', models.CharField(blank=True, default='', max_length=255)), + ('checkout_session_id', models.CharField(blank=True, default='', max_length=255)), + ('checkout_url', models.URLField(blank=True, default='', max_length=500)), + ('pay_link_emailed_at', models.DateTimeField(blank=True, null=True)), + ('created_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)), + ('customer', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='subscriptions', to='financial.billingcustomer')), + ('last_modified_BY', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)), + ], + options={ + 'ordering': ['-created'], + }, + ), + ]