bloombase/plants/migrations/0001_initial.py
Stephan Kerkman 2c61b03519 feat: add Species, Plant, PruningLog models
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-27 19:51:11 +02:00

70 lines
3 KiB
Python

# Generated by Django 5.1.15 on 2026-05-27 17:50
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Plant',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=200)),
('location', models.CharField(max_length=200)),
('is_indoor', models.BooleanField(default=False)),
('pruning_months', models.JSONField(default=list)),
('photo', models.ImageField(blank=True, upload_to='plants/')),
('notes', models.TextField(blank=True)),
('date_added', models.DateField(auto_now_add=True)),
],
options={
'ordering': ['name'],
},
),
migrations.CreateModel(
name='Species',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('common_name', models.CharField(max_length=200)),
('scientific_name', models.CharField(blank=True, max_length=200)),
('description', models.TextField(blank=True)),
('watering', models.CharField(blank=True, max_length=100)),
('sunlight', models.CharField(blank=True, max_length=200)),
('shadow_tolerance', models.CharField(blank=True, max_length=100)),
('max_height_cm', models.IntegerField(blank=True, null=True)),
('growth_rate', models.CharField(blank=True, max_length=100)),
('growth_season', models.CharField(blank=True, max_length=100)),
('pruning_months', models.JSONField(default=list)),
('api_image_url', models.URLField(blank=True)),
('perenual_id', models.IntegerField(blank=True, null=True, unique=True)),
],
options={
'verbose_name_plural': 'species',
'ordering': ['common_name'],
},
),
migrations.CreateModel(
name='PruningLog',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('pruned_on', models.DateField()),
('notes', models.TextField(blank=True)),
('plant', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='pruninglogs', to='plants.plant')),
],
options={
'ordering': ['-pruned_on'],
},
),
migrations.AddField(
model_name='plant',
name='species',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='plants', to='plants.species'),
),
]