From 08acfa327c2629d86aec6acd5ab1a961b0ac5f27 Mon Sep 17 00:00:00 2001 From: Alek Ratzloff Date: Sun, 17 Jul 2022 19:50:47 -0700 Subject: [PATCH] Add initial migrations I was putting this off during initial development so that experiments and toying around with models would not be saved in the history, especially if rebuilding the entire database was required. Now that the models are in a more stable place, we can start tracking migrations. Signed-off-by: Alek Ratzloff --- board/migrations/0001_initial.py | 335 +++++++++++++++++++++++++++++++ 1 file changed, 335 insertions(+) create mode 100644 board/migrations/0001_initial.py diff --git a/board/migrations/0001_initial.py b/board/migrations/0001_initial.py new file mode 100644 index 0000000..e2fc850 --- /dev/null +++ b/board/migrations/0001_initial.py @@ -0,0 +1,335 @@ +# Generated by Django 4.1b1 on 2022-07-18 02:50 + +import board.models +import colorfield.fields +import datetime +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [] + + operations = [ + migrations.CreateModel( + name="Board", + fields=[ + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("url", models.CharField(max_length=255, unique=True)), + ("name", models.CharField(max_length=255)), + ("max_pages", models.IntegerField(default=10)), + ("threads_per_page", models.IntegerField(default=10)), + ( + "post_cooldown", + models.DurationField(default=datetime.timedelta(seconds=60)), + ), + ( + "report_cooldown", + models.DurationField(default=datetime.timedelta(seconds=15)), + ), + ("autosink", models.IntegerField(default=300)), + ("readonly", models.BooleanField(default=False)), + ], + ), + migrations.CreateModel( + name="Capcode", + fields=[ + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("suffix", models.CharField(max_length=100)), + ( + "color", + colorfield.fields.ColorField( + default="#FFFFFF", image_field=None, max_length=18, samples=None + ), + ), + ], + options={ + "permissions": (("use_capcode", "Can use capcode"),), + }, + ), + migrations.CreateModel( + name="NewsPost", + fields=[ + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("created", models.DateTimeField(auto_now_add=True)), + ("title", models.CharField(max_length=300)), + ("author", models.CharField(blank=True, max_length=100)), + ("body", models.TextField(blank=True)), + ], + ), + migrations.CreateModel( + name="Post", + fields=[ + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("name", models.CharField(blank=True, max_length=255, null=True)), + ("subject", models.CharField(blank=True, max_length=255, null=True)), + ("text", models.TextField(blank=True, max_length=2000)), + ("ip", models.GenericIPAddressField()), + ("sticky", models.BooleanField(blank=True, default=False)), + ("lock", models.BooleanField(blank=True, default=False)), + ("created", models.DateTimeField(auto_now_add=True)), + ("last_bump", models.DateTimeField(auto_now_add=True)), + ( + "image", + models.ImageField( + blank=True, + height_field="image_height", + null=True, + upload_to=board.models.image_upload, + width_field="image_width", + ), + ), + ("bump", models.BooleanField(default=True)), + ( + "thumbnail", + models.ImageField( + editable=False, null=True, upload_to=board.models.thumbs_upload + ), + ), + ( + "original_image_name", + models.CharField(blank=True, max_length=255, null=True), + ), + ("image_width", models.IntegerField(blank=True, null=True)), + ("image_height", models.IntegerField(blank=True, null=True)), + ("user_token", models.CharField(max_length=30, null=True)), + ( + "board", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, to="board.board" + ), + ), + ( + "capcode", + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + to="board.capcode", + ), + ), + ( + "op", + models.ForeignKey( + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="replies", + to="board.post", + ), + ), + ], + options={ + "permissions": [ + ("set_sticky", "Can sticky post"), + ("set_bump", "Can bumplock post"), + ("set_lock", "Can lock post"), + ("wipe_user", "Can wipe all posts by a user"), + ], + }, + ), + migrations.CreateModel( + name="ReportRecord", + fields=[ + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("weight", models.IntegerField(default=0)), + ("urgent", models.BooleanField(default=False)), + ( + "post", + models.OneToOneField( + on_delete=django.db.models.deletion.CASCADE, to="board.post" + ), + ), + ], + ), + migrations.CreateModel( + name="ReportReason", + fields=[ + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("reason", models.CharField(max_length=255)), + ("weight", models.IntegerField(default=1)), + ("urgent", models.BooleanField(default=False)), + ( + "board", + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + to="board.board", + ), + ), + ], + ), + migrations.CreateModel( + name="RangeBan", + fields=[ + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("ban_reason", models.TextField()), + ("created", models.DateTimeField(auto_now_add=True)), + ("expires", models.DateTimeField(blank=True, null=True)), + ("post_id", models.IntegerField(blank=True, null=True)), + ("start", models.GenericIPAddressField()), + ("end", models.GenericIPAddressField()), + ( + "board", + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + to="board.board", + ), + ), + ], + options={ + "abstract": False, + }, + ), + migrations.CreateModel( + name="BanTemplate", + fields=[ + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("name", models.CharField(max_length=100)), + ("ban_reason", models.TextField()), + ("duration", models.IntegerField(blank=True, null=True)), + ( + "board", + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + to="board.board", + ), + ), + ], + ), + migrations.CreateModel( + name="Ban", + fields=[ + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("ban_reason", models.TextField()), + ("created", models.DateTimeField(auto_now_add=True)), + ("expires", models.DateTimeField(blank=True, null=True)), + ("post_id", models.IntegerField(blank=True, null=True)), + ("ip", models.GenericIPAddressField()), + ( + "board", + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + to="board.board", + ), + ), + ], + options={ + "abstract": False, + }, + ), + migrations.CreateModel( + name="Report", + fields=[ + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("ip", models.GenericIPAddressField()), + ("created", models.DateTimeField(auto_now_add=True)), + ( + "reason", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to="board.reportreason", + ), + ), + ( + "record", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to="board.reportrecord", + ), + ), + ], + options={ + "unique_together": {("record", "ip")}, + }, + ), + ]