# Generated migration for ArticleLike model

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone


class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('blog', '0005_add_social_features'),
    ]

    operations = [
        migrations.CreateModel(
            name='ArticleLike',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('creation_time', models.DateTimeField(db_index=True, default=django.utils.timezone.now, verbose_name='creation time')),
                ('article', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='liked_by', to='blog.article', verbose_name='article')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='likes', to=settings.AUTH_USER_MODEL, verbose_name='user')),
            ],
            options={
                'verbose_name': 'article like',
                'verbose_name_plural': 'article likes',
                'ordering': ['-creation_time'],
            },
        ),
        migrations.AddIndex(
            model_name='articlelike',
            index=models.Index(fields=['user', '-creation_time'], name='like_user_time_idx'),
        ),
        migrations.AddIndex(
            model_name='articlelike',
            index=models.Index(fields=['article', '-creation_time'], name='like_article_time_idx'),
        ),
        migrations.AlterUniqueTogether(
            name='articlelike',
            unique_together={('user', 'article')},
        ),
    ]
