cmsmanage/rentals/migrations/0001_initial.py

135 lines
4.4 KiB
Python

# Generated by Django 4.0.2 on 2022-02-16 21:19
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
("membershipworks", "0001_initial"),
]
operations = [
migrations.CreateModel(
name="LockerBank",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("name", models.CharField(max_length=200)),
("location", models.CharField(max_length=200)),
("slug", models.SlugField(unique=True)),
],
),
migrations.CreateModel(
name="LockerUnit",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("index", models.PositiveIntegerField()),
(
"first_letter",
models.CharField(
max_length=1,
unique=True,
validators=[django.core.validators.RegexValidator("[A-Z]")],
),
),
("first_number", models.PositiveIntegerField()),
("rows", models.PositiveIntegerField(default=5)),
("columns", models.PositiveIntegerField(default=2)),
(
"bank",
models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="units",
to="rentals.lockerbank",
),
),
],
options={
"ordering": ["index"],
},
),
migrations.CreateModel(
name="LockerInfo",
fields=[
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("column", models.PositiveIntegerField()),
("row", models.PositiveIntegerField()),
(
"blind_code",
models.CharField(
blank=True,
help_text="Stamped on some keys. Usually D###A.",
max_length=5,
),
),
(
"bitting_code",
models.CharField(
blank=True,
help_text="National Disc Tumbler, depths 1-4. Read bow-to-tip.",
max_length=5,
),
),
(
"locker_unit",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name="lockers",
to="rentals.lockerunit",
),
),
(
"renter",
models.ForeignKey(
blank=True,
db_constraint=False,
null=True,
on_delete=django.db.models.deletion.CASCADE,
to="membershipworks.member",
),
),
],
),
migrations.AddConstraint(
model_name="lockerunit",
constraint=models.UniqueConstraint(
fields=("bank", "index"), name="unique_bank_index"
),
),
migrations.AddConstraint(
model_name="lockerinfo",
constraint=models.UniqueConstraint(
fields=("locker_unit", "column", "row"), name="unique_locker_info"
),
),
]