dynamicweb2/hosting/migrations/0001_initial.py

262 lines
15 KiB
Python
Raw Normal View History

2023-12-13 14:29:42 +00:00
# Generated by Django 4.2.7 on 2023-12-07 10:47
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import utils.mixins
class Migration(migrations.Migration):
initial = True
dependencies = [
('datacenterlight', '0008_dclcalculatorpluginmodel_vm_templates_to_show'),
('membership', '0001_initial'),
('utils', '__first__'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='GenericProduct',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('product_name', models.CharField(default='', max_length=128)),
('product_slug', models.SlugField(help_text='An mandatory unique slug for the product', unique=True)),
('product_description', models.CharField(default='', max_length=500)),
('created_at', models.DateTimeField(auto_now_add=True)),
('product_price', models.DecimalField(decimal_places=2, max_digits=6)),
('product_vat', models.DecimalField(decimal_places=4, default=0, max_digits=6)),
('product_is_subscription', models.BooleanField(default=True)),
('product_subscription_interval', models.CharField(default='month', help_text='Choose between `year` and `month`', max_length=10)),
('exclude_vat_calculations', models.BooleanField(default=False, help_text='When checked VAT calculations are excluded for this product')),
],
bases=(utils.mixins.AssignPermissionsMixin, models.Model),
),
migrations.CreateModel(
name='HostingOrder',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('vm_id', models.IntegerField(default=0)),
('created_at', models.DateTimeField(auto_now_add=True)),
('approved', models.BooleanField(default=False)),
('last4', models.CharField(max_length=4)),
('cc_brand', models.CharField(max_length=128)),
('stripe_charge_id', models.CharField(max_length=100, null=True)),
('price', models.FloatField()),
('subscription_id', models.CharField(max_length=100, null=True)),
('generic_payment_description', models.CharField(max_length=500, null=True)),
('billing_address', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='utils.billingaddress')),
('customer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='membership.stripecustomer')),
('generic_product', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, to='hosting.genericproduct')),
],
options={
'permissions': (('pr_view_hostingorder', 'View Hosting Order'),),
},
bases=(utils.mixins.AssignPermissionsMixin, models.Model),
),
migrations.CreateModel(
name='HostingPlan',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('disk_size', models.FloatField(default=0.0)),
('cpu_cores', models.FloatField(default=0.0)),
('memory', models.FloatField(default=0.0)),
],
),
migrations.CreateModel(
name='IncompletePaymentIntents',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('completed_at', models.DateTimeField(null=True)),
('created_at', models.DateTimeField(auto_now_add=True)),
('payment_intent_id', models.CharField(max_length=100)),
('request', models.TextField()),
('stripe_api_cus_id', models.CharField(max_length=30)),
('card_details_response', models.TextField()),
('stripe_subscription_id', models.CharField(max_length=100, null=True)),
('stripe_charge_id', models.CharField(max_length=100, null=True)),
('gp_details', models.TextField()),
('billing_address_data', models.TextField()),
],
bases=(utils.mixins.AssignPermissionsMixin, models.Model),
),
migrations.CreateModel(
name='IncompleteSubscriptions',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created_at', models.DateTimeField(auto_now_add=True)),
('completed_at', models.DateTimeField(null=True)),
('subscription_id', models.CharField(max_length=100)),
('subscription_status', models.CharField(max_length=30)),
('name', models.CharField(max_length=50)),
('email', models.EmailField(max_length=254)),
('request', models.TextField()),
('stripe_api_cus_id', models.CharField(max_length=30)),
('card_details_response', models.TextField()),
('stripe_subscription_obj', models.TextField()),
('stripe_onetime_charge', models.TextField()),
('gp_details', models.TextField()),
('specs', models.TextField()),
('vm_template_id', models.PositiveIntegerField(default=0)),
('template', models.TextField()),
('billing_address_data', models.TextField()),
],
bases=(utils.mixins.AssignPermissionsMixin, models.Model),
),
migrations.CreateModel(
name='StripeTaxRate',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('tax_rate_id', models.CharField(max_length=100, unique=True)),
('jurisdiction', models.CharField(max_length=10)),
('inclusive', models.BooleanField(default=False)),
('display_name', models.CharField(max_length=100)),
('percentage', models.FloatField(default=0)),
('description', models.CharField(max_length=100)),
],
bases=(utils.mixins.AssignPermissionsMixin, models.Model),
),
migrations.CreateModel(
name='VATRates',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('start_date', models.DateField(blank=True, null=True)),
('stop_date', models.DateField(blank=True, null=True)),
('territory_codes', models.TextField(blank=True, default='')),
('currency_code', models.CharField(max_length=10)),
('rate', models.FloatField()),
('rate_type', models.TextField(blank=True, default='')),
('description', models.TextField(blank=True, default='')),
],
bases=(utils.mixins.AssignPermissionsMixin, models.Model),
),
migrations.CreateModel(
name='VMDetail',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('vm_id', models.IntegerField(default=0)),
('disk_size', models.FloatField(default=0.0)),
('cores', models.FloatField(default=0.0)),
('memory', models.FloatField(default=0.0)),
('configuration', models.CharField(default='', max_length=128)),
('ipv4', models.TextField(default='')),
('ipv6', models.TextField(default='')),
('created_at', models.DateTimeField(auto_now_add=True)),
('terminated_at', models.DateTimeField(null=True)),
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel(
name='UserHostingKey',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('public_key', models.TextField()),
('private_key', models.FileField(blank=True, upload_to='private_keys')),
('created_at', models.DateTimeField(auto_now_add=True)),
('name', models.CharField(max_length=100)),
('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel(
name='UserCardDetail',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('last4', models.CharField(max_length=4)),
('brand', models.CharField(max_length=128)),
('card_id', models.CharField(blank=True, default='', max_length=100)),
('fingerprint', models.CharField(max_length=100)),
('exp_month', models.IntegerField()),
('exp_year', models.IntegerField()),
('preferred', models.BooleanField(default=False)),
('stripe_customer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='membership.stripecustomer')),
],
options={
'permissions': (('pr_view_usercarddetail', 'View User Card'),),
},
bases=(utils.mixins.AssignPermissionsMixin, models.Model),
),
migrations.CreateModel(
name='OrderDetail',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('cores', models.IntegerField(default=0)),
('memory', models.IntegerField(default=0)),
('hdd_size', models.IntegerField(default=0)),
('ssd_size', models.IntegerField(default=0)),
('vm_template', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, to='datacenterlight.vmtemplate')),
],
bases=(utils.mixins.AssignPermissionsMixin, models.Model),
),
migrations.CreateModel(
name='MonthlyHostingBill',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created', models.DateTimeField(help_text='When the invoice was created')),
('receipt_number', models.CharField(help_text='The receipt number that is generated on Stripe', max_length=100)),
('invoice_number', models.CharField(help_text='The invoice number that is generated on Stripe', max_length=100)),
('paid_at', models.DateTimeField(help_text='Date on which the bill was paid')),
('period_start', models.DateTimeField()),
('period_end', models.DateTimeField()),
('billing_reason', models.CharField(max_length=25)),
('discount', models.PositiveIntegerField()),
('total', models.IntegerField()),
('lines_data_count', models.IntegerField()),
('invoice_id', models.CharField(max_length=100, unique=True)),
('lines_meta_data_csv', models.TextField(default='')),
('subscription_ids_csv', models.TextField(default='')),
('customer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='membership.stripecustomer')),
('order', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='hosting.hostingorder')),
],
options={
'permissions': (('pr_view_monthlyhostingbill', 'View Monthly Hosting'),),
},
bases=(utils.mixins.AssignPermissionsMixin, models.Model),
),
migrations.AddField(
model_name='hostingorder',
name='order_detail',
field=models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, to='hosting.orderdetail'),
),
migrations.AddField(
model_name='hostingorder',
name='vm_pricing',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='datacenterlight.vmpricing'),
),
migrations.CreateModel(
name='HostingBillLineItem',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('amount', models.IntegerField()),
('description', models.CharField(max_length=255)),
('discountable', models.BooleanField()),
('metadata', models.CharField(max_length=128)),
('period_start', models.DateTimeField()),
('period_end', models.DateTimeField()),
('proration', models.BooleanField()),
('quantity', models.PositiveIntegerField()),
('unit_amount', models.PositiveIntegerField()),
('monthly_hosting_bill', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='hosting.monthlyhostingbill')),
('stripe_plan', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='datacenterlight.stripeplan')),
],
options={
'permissions': (('pr_view_hostingbilllineitem', 'View Monthly Hosting Bill Line Item'),),
},
bases=(utils.mixins.AssignPermissionsMixin, models.Model),
),
migrations.CreateModel(
name='HostingBill',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('total_price', models.FloatField(default=0.0)),
('billing_address', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='utils.billingaddress')),
('customer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='membership.stripecustomer')),
],
options={
'permissions': (('pr_view_hostingbill', 'View Hosting Bill'),),
},
bases=(utils.mixins.AssignPermissionsMixin, models.Model),
),
]