125 lines
6.9 KiB
Python
125 lines
6.9 KiB
Python
# Generated by Django 4.1.7 on 2023-03-19 13:39
|
|
|
|
import datetime
|
|
from django.conf import settings
|
|
import django.core.validators
|
|
from django.db import migrations, models
|
|
import django.db.models.deletion
|
|
import django.utils.timezone
|
|
import foldbank.utils
|
|
import uuid
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
initial = True
|
|
|
|
dependencies = [
|
|
('auth', '0012_alter_user_first_name_max_length'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name='User',
|
|
fields=[
|
|
('password', models.CharField(max_length=128, verbose_name='password')),
|
|
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
|
|
('username', models.CharField(blank=True, help_text='only allows letters, numbers and underscores', max_length=32, null=True, unique=True, validators=[django.core.validators.RegexValidator('^[a-zA-Z0-9_]*$', message='only allows letters, numbers and underscores')])),
|
|
('name', models.CharField(blank=True, max_length=128, null=True)),
|
|
('is_active', models.BooleanField(default=True)),
|
|
('is_staff', models.BooleanField(default=False)),
|
|
('is_superuser', models.BooleanField(default=False)),
|
|
('date_joined', models.DateTimeField(auto_now_add=True)),
|
|
('last_login', models.DateTimeField(default=django.utils.timezone.now)),
|
|
('last_updated', models.DateTimeField(auto_now=True)),
|
|
('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.group', verbose_name='groups')),
|
|
('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.permission', verbose_name='user permissions')),
|
|
],
|
|
options={
|
|
'abstract': False,
|
|
},
|
|
),
|
|
migrations.CreateModel(
|
|
name='Account',
|
|
fields=[
|
|
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
|
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
|
('account_number', models.CharField(blank=True, max_length=64, null=True)),
|
|
('account_type', models.CharField(choices=[('SA', 'Savings Account'), ('CA', 'Current Account')], default='SA', max_length=2)),
|
|
('ifsc_code', models.CharField(blank=True, max_length=64, null=True)),
|
|
('swift_bic', models.CharField(blank=True, max_length=64, null=True)),
|
|
('holders_name', models.CharField(blank=True, max_length=64, null=True)),
|
|
('account_owner_type', models.CharField(choices=[('UA', 'User Account'), ('OA', 'Organization Account')], default='UA', max_length=2)),
|
|
('balance', models.FloatField(blank=True, null=True)),
|
|
],
|
|
),
|
|
migrations.CreateModel(
|
|
name='Bank',
|
|
fields=[
|
|
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
|
|
('name', models.CharField(blank=True, max_length=64, null=True)),
|
|
('logo', models.FileField(blank=True, default=None, null=True, upload_to=foldbank.utils.get_bank_logo_file_path)),
|
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
|
],
|
|
),
|
|
migrations.CreateModel(
|
|
name='RecurringPayment',
|
|
fields=[
|
|
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
|
|
('frequency', models.DurationField(default=datetime.timedelta(days=30))),
|
|
('amount', models.FloatField(blank=True, null=True)),
|
|
('due_on', models.DateTimeField(auto_now_add=True)),
|
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
|
('from_account', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='recurring_payment_from', to='foldbank.account')),
|
|
],
|
|
),
|
|
migrations.CreateModel(
|
|
name='Tag',
|
|
fields=[
|
|
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
|
|
('title', models.CharField(blank=True, max_length=64, null=True)),
|
|
('sub_category', models.CharField(blank=True, max_length=64, null=True)),
|
|
('icon_type', models.CharField(blank=True, max_length=64, null=True)),
|
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
|
],
|
|
),
|
|
migrations.CreateModel(
|
|
name='Transaction',
|
|
fields=[
|
|
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
|
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
|
('amount', models.FloatField(blank=True, null=True)),
|
|
('from_account', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='transactions_from', to='foldbank.account')),
|
|
('tag', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='foldbank.tag')),
|
|
('to_account', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='transactions_to', to='foldbank.account')),
|
|
],
|
|
),
|
|
migrations.CreateModel(
|
|
name='RecurringPaymentTransactionLink',
|
|
fields=[
|
|
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
|
|
('recurring_payment', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='foldbank.recurringpayment')),
|
|
('transaction', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='foldbank.transaction')),
|
|
],
|
|
),
|
|
migrations.AddField(
|
|
model_name='recurringpayment',
|
|
name='tag',
|
|
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='foldbank.tag'),
|
|
),
|
|
migrations.AddField(
|
|
model_name='recurringpayment',
|
|
name='to_account',
|
|
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='recurring_payment_to', to='foldbank.account'),
|
|
),
|
|
migrations.AddField(
|
|
model_name='account',
|
|
name='bank',
|
|
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='foldbank.bank'),
|
|
),
|
|
migrations.AddField(
|
|
model_name='account',
|
|
name='user',
|
|
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL),
|
|
),
|
|
]
|