AkomptaBackend / api /migrations /0001_initial.py
rinogeek's picture
first commit
ef287e1
# Generated by Django 5.2.8 on 2025-11-28 00:35
import django.contrib.auth.models
import django.db.models.deletion
import django.utils.timezone
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('auth', '0012_alter_user_first_name_max_length'),
]
operations = [
migrations.CreateModel(
name='User',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('password', models.CharField(max_length=128, verbose_name='password')),
('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
('first_name', models.CharField(blank=True, max_length=150, verbose_name='first name')),
('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')),
('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
('email', models.EmailField(max_length=254, unique=True, verbose_name='Email')),
('phone_number', models.CharField(blank=True, max_length=20)),
('avatar', models.ImageField(blank=True, null=True, upload_to='avatars/')),
('account_type', models.CharField(choices=[('personal', 'Personnel'), ('business', 'Professionnel')], default='personal', max_length=10)),
('is_premium', models.BooleanField(default=False)),
('business_name', models.CharField(blank=True, max_length=255)),
('sector', models.CharField(blank=True, max_length=100)),
('location', models.CharField(blank=True, max_length=255)),
('ifu', models.CharField(blank=True, max_length=50, verbose_name='Identifiant Fiscal Unique')),
('business_logo', models.ImageField(blank=True, null=True, upload_to='business_logos/')),
('currency', models.CharField(default='XOF', max_length=10)),
('language', models.CharField(default='FR', max_length=5)),
('dark_mode', models.BooleanField(default=False)),
('agreed_terms', models.BooleanField(default=False)),
('business_agreed', models.BooleanField(default=False)),
('business_agreed_at', models.DateTimeField(blank=True, null=True)),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', 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={
'verbose_name': 'Utilisateur',
'verbose_name_plural': 'Utilisateurs',
},
managers=[
('objects', django.contrib.auth.models.UserManager()),
],
),
migrations.CreateModel(
name='Ad',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('product_name', models.CharField(max_length=255)),
('owner_name', models.CharField(max_length=255)),
('description', models.TextField()),
('image', models.ImageField(upload_to='ads/')),
('whatsapp', models.CharField(max_length=20)),
('website', models.URLField(blank=True, null=True)),
('location', models.CharField(max_length=255)),
('is_verified', models.BooleanField(default=False)),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='ads', to=settings.AUTH_USER_MODEL)),
],
options={
'verbose_name': 'Annonce',
'verbose_name_plural': 'Annonces',
'ordering': ['-created_at'],
},
),
migrations.CreateModel(
name='Product',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255)),
('description', models.TextField(blank=True)),
('price', models.DecimalField(decimal_places=2, max_digits=15)),
('unit', models.CharField(default='Unité', max_length=50)),
('image', models.ImageField(blank=True, null=True, upload_to='products/')),
('category', models.CharField(choices=[('vente', 'Vente'), ('depense', 'Dépense'), ('stock', 'Stock')], max_length=20)),
('stock_status', models.CharField(choices=[('ok', 'OK'), ('low', 'Faible'), ('rupture', 'Rupture')], default='ok', max_length=10)),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='products', to=settings.AUTH_USER_MODEL)),
],
options={
'verbose_name': 'Produit',
'verbose_name_plural': 'Produits',
'ordering': ['-created_at'],
},
),
migrations.CreateModel(
name='Budget',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('category', models.CharField(max_length=100)),
('limit', models.DecimalField(decimal_places=2, max_digits=15)),
('color', models.CharField(default='#4F46E5', max_length=7)),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='budgets', to=settings.AUTH_USER_MODEL)),
],
options={
'verbose_name': 'Budget',
'verbose_name_plural': 'Budgets',
'unique_together': {('user', 'category')},
},
),
migrations.CreateModel(
name='Transaction',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=255)),
('amount', models.DecimalField(decimal_places=2, max_digits=15)),
('type', models.CharField(choices=[('income', 'Revenu'), ('expense', 'Dépense')], max_length=10)),
('category', models.CharField(max_length=100)),
('date', models.DateTimeField()),
('currency', models.CharField(default='FCFA', max_length=10)),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='transactions', to=settings.AUTH_USER_MODEL)),
],
options={
'verbose_name': 'Transaction',
'verbose_name_plural': 'Transactions',
'ordering': ['-date'],
'indexes': [models.Index(fields=['user', 'type'], name='api_transac_user_id_687bb9_idx'), models.Index(fields=['user', 'date'], name='api_transac_user_id_aacb53_idx'), models.Index(fields=['user', 'category'], name='api_transac_user_id_a594d0_idx')],
},
),
]