103 lines
5.4 KiB
Python
103 lines
5.4 KiB
Python
# Generated by Django 3.0.5 on 2020-06-04 00:39
|
|
|
|
from django.conf import settings
|
|
from django.db import migrations, models
|
|
import django.db.models.deletion
|
|
import jsonfield.fields
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
initial = True
|
|
|
|
dependencies = [
|
|
('contenttypes', '0002_remove_content_type_name'),
|
|
('connection', '__first__'),
|
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name='Account',
|
|
fields=[
|
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('name', models.CharField(max_length=250)),
|
|
('admin_users', models.ManyToManyField(blank=True, related_name='admin_accounts', to=settings.AUTH_USER_MODEL)),
|
|
('owner', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='owned_accounts', to=settings.AUTH_USER_MODEL)),
|
|
('view_users', models.ManyToManyField(blank=True, related_name='view_accounts', to=settings.AUTH_USER_MODEL)),
|
|
],
|
|
),
|
|
migrations.CreateModel(
|
|
name='Bank',
|
|
fields=[
|
|
('acc_id', models.CharField(max_length=250, primary_key=True, serialize=False)),
|
|
('nickname', models.CharField(max_length=250)),
|
|
('official_name', models.CharField(blank=True, max_length=250, null=True)),
|
|
('balance_limit', models.DecimalField(blank=True, decimal_places=3, max_digits=100, null=True)),
|
|
('balance', models.DecimalField(decimal_places=3, max_digits=100)),
|
|
('ac_type', models.CharField(blank=True, max_length=250)),
|
|
('ac_subtype', models.CharField(blank=True, max_length=250)),
|
|
('mask', models.CharField(blank=True, max_length=4)),
|
|
('connection', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='connection.Connection')),
|
|
],
|
|
),
|
|
migrations.CreateModel(
|
|
name='Institution',
|
|
fields=[
|
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('name', models.CharField(max_length=255)),
|
|
],
|
|
),
|
|
migrations.CreateModel(
|
|
name='Schedule',
|
|
fields=[
|
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('name', models.CharField(max_length=255)),
|
|
],
|
|
),
|
|
migrations.CreateModel(
|
|
name='Slice',
|
|
fields=[
|
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('name', models.CharField(max_length=250)),
|
|
('icon', models.CharField(max_length=250)),
|
|
('budget', models.DecimalField(decimal_places=3, max_digits=100)),
|
|
('parent_id', models.PositiveIntegerField()),
|
|
('is_unsliced', models.BooleanField(default=False)),
|
|
('parent_type', models.ForeignKey(limit_choices_to=models.Q(models.Q(('app_label', 'qrtr_account'), ('model', 'bank')), models.Q(('app_label', 'qrtr_account'), ('model', 'slice')), _connector='OR'), on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType')),
|
|
],
|
|
),
|
|
migrations.CreateModel(
|
|
name='Transaction',
|
|
fields=[
|
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('datetime', models.DateTimeField()),
|
|
('details', jsonfield.fields.JSONField(default=dict)),
|
|
('Bank', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='transactions', to='qrtr_account.Bank')),
|
|
('Slice', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='qrtr_account.Slice')),
|
|
],
|
|
),
|
|
migrations.CreateModel(
|
|
name='Rule',
|
|
fields=[
|
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('kind', models.CharField(choices=[('refill', 'Refill'), ('increase', 'Increase'), ('goal', 'Goal')], max_length=255)),
|
|
('amount_type', models.CharField(choices=[('quantity', 'Quantity'), ('round', 'Round'), ('percent', 'Percent')], default='quantity', max_length=20)),
|
|
('amount', models.DecimalField(decimal_places=3, max_digits=100)),
|
|
('destination', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='rule_destination_set', to='qrtr_account.Slice')),
|
|
('source', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='rule_source_set', to='qrtr_account.Slice')),
|
|
('when_to_run', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='qrtr_account.Schedule')),
|
|
],
|
|
),
|
|
migrations.AddField(
|
|
model_name='bank',
|
|
name='institution',
|
|
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='banks', to='qrtr_account.Institution'),
|
|
),
|
|
migrations.AddField(
|
|
model_name='bank',
|
|
name='qrtr_account',
|
|
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='qrtr_account.Account'),
|
|
),
|
|
]
|