dsite/recipe/migrations/0004_ingredient_recipeingredient.py
Ching 54819c6861 feat(recipe model;recipe api): 增加 ingredient 和 recipe-ingredient model; 增加相关 API
增加 ingredient 和 recipe-ingredient model; 增加相关 API

Signed-off-by: Ching <loooching@gmail.com>
2022-02-13 01:18:02 +08:00

46 lines
1.6 KiB
Python

# Generated by Django 3.2.6 on 2022-02-12 13:43
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [('recipe', '0003_recipe_status')]
operations = [
migrations.CreateModel(
name='Ingredient',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=128)),
('unit', models.CharField(max_length=32)),
('status', models.CharField(default='active', max_length=32)),
],
),
migrations.CreateModel(
name='RecipeIngredient',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('quantity', models.FloatField()),
(
'ingredient',
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name='recipe_ingredients',
to='recipe.ingredient',
),
),
(
'recipe',
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name='recipe_ingredients',
to='recipe.recipe',
),
),
('status', models.CharField(default='active', max_length=32)),
],
),
]