cmsmanage/rentals/migrations/0001_initial.py

57 lines
2.4 KiB
Python
Raw Normal View History

# Generated by Django 3.2.11 on 2022-01-27 22:14
from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
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='LockerRental',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('column', models.PositiveIntegerField()),
('row', models.PositiveIntegerField()),
('locker_unit', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='rentals', to='rentals.lockerunit')),
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
migrations.AddConstraint(
model_name='lockerunit',
constraint=models.UniqueConstraint(fields=('bank', 'index'), name='unique_bank_index'),
),
]