feat: add initial finance migration
Browse files
finance/migrations/0001_initial.py
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Generated by Django 6.0.2 on 2026-05-17 14:03
|
| 2 |
+
|
| 3 |
+
import django.db.models.deletion
|
| 4 |
+
from django.conf import settings
|
| 5 |
+
from django.db import migrations, models
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
class Migration(migrations.Migration):
|
| 9 |
+
|
| 10 |
+
initial = True
|
| 11 |
+
|
| 12 |
+
dependencies = [
|
| 13 |
+
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
| 14 |
+
]
|
| 15 |
+
|
| 16 |
+
operations = [
|
| 17 |
+
migrations.CreateModel(
|
| 18 |
+
name='Budget',
|
| 19 |
+
fields=[
|
| 20 |
+
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
| 21 |
+
('name', models.CharField(max_length=100)),
|
| 22 |
+
('category_key', models.CharField(max_length=50)),
|
| 23 |
+
('budget_amount', models.DecimalField(decimal_places=2, max_digits=12)),
|
| 24 |
+
('spent_amount', models.DecimalField(decimal_places=2, default=0, max_digits=12)),
|
| 25 |
+
('remaining_amount', models.DecimalField(decimal_places=2, default=0, max_digits=12)),
|
| 26 |
+
('status', models.CharField(default='good', max_length=50)),
|
| 27 |
+
('warning_message', models.TextField(blank=True, null=True)),
|
| 28 |
+
('created_at', models.DateTimeField(auto_now_add=True)),
|
| 29 |
+
('updated_at', models.DateTimeField(auto_now=True)),
|
| 30 |
+
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='budgets', to=settings.AUTH_USER_MODEL)),
|
| 31 |
+
],
|
| 32 |
+
),
|
| 33 |
+
migrations.CreateModel(
|
| 34 |
+
name='Goal',
|
| 35 |
+
fields=[
|
| 36 |
+
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
| 37 |
+
('name', models.CharField(max_length=255)),
|
| 38 |
+
('current_amount', models.DecimalField(decimal_places=2, default=0, max_digits=12)),
|
| 39 |
+
('target_amount', models.DecimalField(decimal_places=2, max_digits=12)),
|
| 40 |
+
('deadline', models.DateField(blank=True, null=True)),
|
| 41 |
+
('monthly_target', models.DecimalField(decimal_places=2, default=0, max_digits=12)),
|
| 42 |
+
('priority', models.CharField(default='medium', max_length=50)),
|
| 43 |
+
('category', models.CharField(blank=True, max_length=100, null=True)),
|
| 44 |
+
('auto_save', models.BooleanField(default=False)),
|
| 45 |
+
('created_at', models.DateTimeField(auto_now_add=True)),
|
| 46 |
+
('updated_at', models.DateTimeField(auto_now=True)),
|
| 47 |
+
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='goals', to=settings.AUTH_USER_MODEL)),
|
| 48 |
+
],
|
| 49 |
+
),
|
| 50 |
+
migrations.CreateModel(
|
| 51 |
+
name='Subscription',
|
| 52 |
+
fields=[
|
| 53 |
+
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
| 54 |
+
('name', models.CharField(max_length=255)),
|
| 55 |
+
('amount', models.DecimalField(decimal_places=2, max_digits=10)),
|
| 56 |
+
('renewal_date', models.DateField(blank=True, null=True)),
|
| 57 |
+
('usage_level', models.CharField(default='Medium', max_length=50)),
|
| 58 |
+
('value_score', models.IntegerField(default=3)),
|
| 59 |
+
('status', models.CharField(default='active', max_length=50)),
|
| 60 |
+
('last_used_date', models.DateField(blank=True, null=True)),
|
| 61 |
+
('warning', models.TextField(blank=True, null=True)),
|
| 62 |
+
('potential_saving', models.DecimalField(decimal_places=2, default=0, max_digits=10)),
|
| 63 |
+
('created_at', models.DateTimeField(auto_now_add=True)),
|
| 64 |
+
('updated_at', models.DateTimeField(auto_now=True)),
|
| 65 |
+
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='subscriptions', to=settings.AUTH_USER_MODEL)),
|
| 66 |
+
],
|
| 67 |
+
),
|
| 68 |
+
migrations.CreateModel(
|
| 69 |
+
name='Transaction',
|
| 70 |
+
fields=[
|
| 71 |
+
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
| 72 |
+
('date', models.DateField()),
|
| 73 |
+
('merchant', models.CharField(max_length=255)),
|
| 74 |
+
('amount', models.DecimalField(decimal_places=2, max_digits=12)),
|
| 75 |
+
('category', models.CharField(max_length=100)),
|
| 76 |
+
('category_key', models.CharField(max_length=50)),
|
| 77 |
+
('time', models.TimeField(blank=True, null=True)),
|
| 78 |
+
('payment_method', models.CharField(blank=True, max_length=100, null=True)),
|
| 79 |
+
('note', models.TextField(blank=True, null=True)),
|
| 80 |
+
('created_at', models.DateTimeField(auto_now_add=True)),
|
| 81 |
+
('updated_at', models.DateTimeField(auto_now=True)),
|
| 82 |
+
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='transactions', to=settings.AUTH_USER_MODEL)),
|
| 83 |
+
],
|
| 84 |
+
options={
|
| 85 |
+
'ordering': ['-date', '-time', '-created_at'],
|
| 86 |
+
},
|
| 87 |
+
),
|
| 88 |
+
]
|