# Generated by Django 5.2.1 on 2025-06-06 00:12

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


class Migration(migrations.Migration):

    dependencies = [
        ("groups", "0003_alter_membership_options_alter_post_author_and_more"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name="PostLike",
            fields=[
                (
                    "id",
                    models.BigAutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "created_at",
                    models.DateTimeField(auto_now_add=True, verbose_name="点赞时间"),
                ),
                (
                    "post",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="likes",
                        to="groups.post",
                        verbose_name="被点赞的帖子",
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="post_likes",
                        to=settings.AUTH_USER_MODEL,
                        verbose_name="点赞用户",
                    ),
                ),
            ],
            options={
                "verbose_name": "帖子点赞",
                "verbose_name_plural": "帖子点赞们",
                "ordering": ["-created_at"],
                "unique_together": {("user", "post")},
            },
        ),
    ]
