38695-vm/core/migrations/0001_initial.py
Flatlogic Bot 03bf5cace7 1.1
2026-02-22 21:23:39 +00:00

50 lines
2.5 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Generated by Django 5.2.7 on 2026-02-22 20:39
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Product',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('wp_id', models.CharField(max_length=50, unique=True, verbose_name='ID WordPress')),
('image', models.URLField(blank=True, max_length=500, null=True, verbose_name='Фото')),
('name', models.CharField(max_length=255, verbose_name='Назва товару')),
('sku', models.CharField(blank=True, max_length=100, null=True, verbose_name='Артикул (SKU)')),
('price', models.DecimalField(decimal_places=2, max_digits=12, verbose_name='Ціна (грн)')),
('stock_status', models.CharField(choices=[('instock', 'В наявності'), ('outofstock', 'Немає в наявності')], max_length=20, verbose_name='Статус')),
('total_sales', models.IntegerField(default=0, verbose_name='Продано')),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
],
options={
'verbose_name': 'Товар',
'verbose_name_plural': 'Товари',
'ordering': ['-total_sales'],
},
),
migrations.CreateModel(
name='Variation',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('size', models.CharField(max_length=50, verbose_name='Розмір')),
('price', models.DecimalField(decimal_places=2, max_digits=12, verbose_name='Ціна варіації')),
('stock_quantity', models.IntegerField(default=0, verbose_name='Залишок на складі')),
('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='variations', to='core.product', verbose_name='Основний товар')),
],
options={
'verbose_name': 'Варіація',
'verbose_name_plural': 'Варіації',
},
),
]