"""
Phase 6 — Notes.

Generated by `makemigrations` and left as generated: this one creates a table
and touches nothing that already exists, so there is no data to rescue and no
hand-written step. Compare `0003` and `0004`, both of which converted an
integer column into a foreign key and had to null the dangling values first.

The one thing worth reading off it: `sheets` is a single `JSONField` holding
every sheet and every block. That is the decision `models/notes.py` argues, and
the shape of this migration is what it costs — one column, and a global search
that ranks by which block matched is a later migration, taken deliberately.
"""

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


class Migration(migrations.Migration):

    dependencies = [
        ('lifey_api', '0004_calendar_event'),
    ]

    operations = [
        migrations.CreateModel(
            name='Note',
            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)),
                ('icon', models.JSONField(blank=True, null=True)),
                ('cover', models.JSONField(blank=True, null=True)),
                ('cover_off', models.BooleanField(default=False)),
                ('tags', models.JSONField(blank=True, default=list)),
                ('date', models.DateField(blank=True, null=True)),
                ('pinned', models.BooleanField(default=False)),
                ('sheets', models.JSONField(blank=True, default=list)),
                ('source', models.JSONField(blank=True, null=True)),
                ('is_sample', models.BooleanField(default=False)),
                ('calendar_event', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='linked_notes', to='lifey_api.event')),
                ('calendar_page', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='linked_notes', to='lifey_api.page')),
                ('page', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='notes', to='lifey_api.page')),
            ],
            options={
                'ordering': ['-updated_at', '-id'],
                'indexes': [models.Index(fields=['page', '-updated_at'], name='lifey_api_n_page_id_153899_idx'), models.Index(fields=['page', 'pinned'], name='lifey_api_n_page_id_313367_idx')],
            },
        ),
    ]
