38652-vm/core/migrations/0001_initial.py
2026-02-20 20:50:37 +00:00

57 lines
2.5 KiB
Python

# Generated by Django 5.2.7 on 2026-02-20 18:37
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Category',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=100)),
('slug', models.SlugField(blank=True, unique=True)),
('icon', models.CharField(blank=True, help_text='FontAwesome icon class', max_length=50)),
],
options={
'verbose_name_plural': 'Categories',
},
),
migrations.CreateModel(
name='Vendor',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=200)),
('slug', models.SlugField(blank=True, unique=True)),
('description', models.TextField(blank=True)),
('whatsapp_number', models.CharField(help_text='Format: 628123456789', max_length=20)),
('address', models.TextField(blank=True)),
('logo', models.ImageField(blank=True, null=True, upload_to='vendors/')),
('created_at', models.DateTimeField(auto_now_add=True)),
],
),
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)),
('slug', models.SlugField(blank=True, unique=True)),
('description', models.TextField()),
('price', models.DecimalField(decimal_places=2, max_digits=12)),
('image', models.ImageField(blank=True, null=True, upload_to='products/')),
('stock', models.PositiveIntegerField(default=1)),
('is_active', models.BooleanField(default=True)),
('created_at', models.DateTimeField(auto_now_add=True)),
('category', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='products', to='core.category')),
('vendor', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='products', to='core.vendor')),
],
),
]