"""
Phase 9 — Bookshelf.

Generated by `makemigrations` and left as generated: one new table, nothing
existing touched.

The column worth reading off it is **`has_cover`, a `BooleanField`.** It is a
flag and never bytes: cover images stay in the renderer's local storage keyed
by the book id, which is also why copying a page re-mints those ids and clears
the flag. Storing the images is a separate decision with real cost on a 20 GB
box, and `models/bookshelf.py` argues it.
"""

# Generated by Django 6.0.6 on 2026-09-18 12:26

import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ('lifey_api', '0007_budget'),
    ]

    operations = [
        migrations.CreateModel(
            name='Book',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('title', models.CharField(blank=True, max_length=300)),
                ('author', models.CharField(blank=True, max_length=200)),
                ('publisher', models.CharField(blank=True, max_length=200)),
                ('status', models.CharField(default='tbr', max_length=16)),
                ('unit', models.CharField(default='pages', max_length=16)),
                ('length', models.IntegerField(blank=True, null=True)),
                ('position', models.IntegerField(default=0)),
                ('genres', models.JSONField(blank=True, default=list)),
                ('rating', models.IntegerField(blank=True, null=True)),
                ('ebook_url', models.URLField(blank=True, max_length=500, null=True)),
                ('notes', models.TextField(blank=True)),
                ('date_started', models.DateField(blank=True, null=True)),
                ('date_finished', models.DateField(blank=True, null=True)),
                ('sessions', models.JSONField(blank=True, default=list)),
                ('quotes', models.JSONField(blank=True, default=list)),
                ('quote_target', models.JSONField(blank=True, null=True)),
                ('has_cover', models.BooleanField(default=False)),
                ('color', models.CharField(blank=True, max_length=16, null=True)),
                ('properties', models.JSONField(blank=True, default=dict)),
                ('is_sample', models.BooleanField(default=False)),
                ('page', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='books', to='lifey_api.page')),
            ],
            options={
                'ordering': ['id'],
                'indexes': [models.Index(fields=['page', 'status'], name='lifey_api_b_page_id_7f99c1_idx'), models.Index(fields=['page', 'date_finished'], name='lifey_api_b_page_id_b14eee_idx')],
            },
        ),
    ]
