# Generated by Django 4.2.3 on 2023-07-26 05:52 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Department', fields=[ ('department_id', models.AutoField(db_index=True, primary_key=True, serialize=False)), ('department_name', models.CharField(max_length=255, unique=True)), ], ), migrations.CreateModel( name='FlatRate', fields=[ ('id', models.AutoField(primary_key=True, serialize=False)), ('name', models.CharField(max_length=255)), ], ), migrations.CreateModel( name='FlatRateAdditional', fields=[ ('id', models.AutoField(primary_key=True, serialize=False)), ('additional', models.FloatField()), ('rate', models.IntegerField()), ], ), migrations.CreateModel( name='FlatRateRange', fields=[ ('id', models.AutoField(primary_key=True, serialize=False)), ('upto', models.IntegerField()), ('rate', models.IntegerField()), ], ), migrations.CreateModel( name='FlatRateToRoom', fields=[ ('flat_rate_to_room_id', models.AutoField(primary_key=True, serialize=False)), ], ), migrations.CreateModel( name='Meter', fields=[ ('meter_id', models.AutoField(primary_key=True, serialize=False)), ('initial_reading', models.FloatField()), ], ), migrations.CreateModel( name='MeteredBill', fields=[ ('metered_bill_id', models.AutoField(primary_key=True, serialize=False)), ('user_name', models.CharField(max_length=255)), ('full_name', models.CharField(max_length=255)), ('email', models.CharField(max_length=255)), ('user_department', models.CharField(max_length=255)), ('opening_balance', models.FloatField()), ('room_number', models.IntegerField()), ('quarter_type', models.CharField(max_length=255)), ('sanctioned_load', models.FloatField()), ('units_consumed', models.FloatField()), ('meter_rate_name', models.CharField(max_length=255)), ('energy_charges', models.FloatField()), ('demand_charges', models.FloatField()), ('duty_charges', models.FloatField()), ('month', models.IntegerField()), ('year', models.IntegerField()), ], ), migrations.CreateModel( name='MeterRate', fields=[ ('id', models.AutoField(primary_key=True, serialize=False)), ('name', models.CharField(max_length=255)), ('fixed_charges', models.IntegerField()), ], ), migrations.CreateModel( name='MeterRateRange', fields=[ ('id', models.AutoField(primary_key=True, serialize=False)), ('upto', models.IntegerField()), ('rate', models.IntegerField()), ], ), migrations.CreateModel( name='MeterRateToRoom', fields=[ ('meter_rate_to_room_id', models.AutoField(primary_key=True, serialize=False)), ], ), migrations.CreateModel( name='MeterToRoom', fields=[ ('meter_to_room_id', models.AutoField(primary_key=True, serialize=False)), ], ), migrations.CreateModel( name='QuarterType', fields=[ ('quarter_id', models.AutoField(primary_key=True, serialize=False)), ('quarter_name', models.CharField(max_length=255, unique=True)), ], ), migrations.CreateModel( name='Reading', fields=[ ('reading_id', models.AutoField(primary_key=True, serialize=False)), ('month', models.IntegerField()), ('year', models.IntegerField()), ('units_consumed', models.FloatField()), ('locked', models.BooleanField(default=False)), ], ), migrations.CreateModel( name='Room', fields=[ ('room_id', models.AutoField(primary_key=True, serialize=False)), ('room_number', models.IntegerField()), ('is_metered', models.BooleanField()), ('sanctioned_load', models.FloatField()), ], ), migrations.CreateModel( name='UnmeteredBill', fields=[ ('unmetered_bill_id', models.AutoField(primary_key=True, serialize=False)), ('user_name', models.CharField(max_length=255)), ('full_name', models.CharField(max_length=255)), ('email', models.CharField(max_length=255)), ('user_department', models.CharField(max_length=255)), ('opening_balance', models.FloatField()), ('room_number', models.IntegerField()), ('quarter_type', models.CharField(max_length=255)), ('sanctioned_load', models.FloatField()), ('flat_rate_name', models.CharField(max_length=255)), ('energy_charges', models.FloatField()), ('demand_charges', models.FloatField()), ('month', models.IntegerField()), ('year', models.IntegerField()), ], ), migrations.CreateModel( name='UserDetails', fields=[ ('user_id', models.AutoField(primary_key=True, serialize=False)), ('username', models.CharField(max_length=255, unique=True)), ('email', models.CharField(max_length=255, unique=True)), ('full_name', models.CharField(max_length=255)), ('access', models.CharField(choices=[('admin', 'Admin'), ('operator', 'Operator'), ('user', 'User')], default='user', max_length=255)), ('user_type', models.CharField(choices=[('simple', 'Simple'), ('outsource', 'Outsource')], default='simple', max_length=255)), ('balance', models.FloatField(default=0)), ('disabled', models.BooleanField(default=False)), ], ), migrations.CreateModel( name='UsersToRoom', fields=[ ('user_to_room_id', models.AutoField(primary_key=True, serialize=False)), ('room_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='billing.room', unique=True)), ('user_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='billing.userdetails', unique=True)), ], ), migrations.CreateModel( name='UsersToDepartment', fields=[ ('user_to_department_id', models.AutoField(primary_key=True, serialize=False)), ('department_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='billing.department')), ('user_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='billing.userdetails')), ], ), migrations.AddConstraint( model_name='unmeteredbill', constraint=models.CheckConstraint(check=models.Q(('month__gte', 1), ('month__lte', 12)), name='check_month_unmetered_bill'), ), migrations.AddConstraint( model_name='unmeteredbill', constraint=models.CheckConstraint(check=models.Q(('year__gt', 0)), name='check_year_unmetered_bill'), ), migrations.AddField( model_name='room', name='quarter_type_id', field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='billing.quartertype'), ), migrations.AddField( model_name='reading', name='meter_id', field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='billing.meter'), ), migrations.AddField( model_name='metertoroom', name='meter_id', field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='billing.meter', unique=True), ), migrations.AddField( model_name='metertoroom', name='room_id', field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='billing.room', unique=True), ), migrations.AddField( model_name='meterratetoroom', name='meter_rate_id', field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='billing.meterrate'), ), migrations.AddField( model_name='meterratetoroom', name='room_id', field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='billing.room', unique=True), ), migrations.AddField( model_name='meterraterange', name='meter_rate', field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='billing.meterrate'), ), migrations.AddConstraint( model_name='meteredbill', constraint=models.CheckConstraint(check=models.Q(('month__gte', 1), ('month__lte', 12)), name='check_month_metered_bill'), ), migrations.AddConstraint( model_name='meteredbill', constraint=models.CheckConstraint(check=models.Q(('year__gt', 0)), name='check_year_metered_bill'), ), migrations.AlterUniqueTogether( name='meteredbill', unique_together={('room_number', 'quarter_type', 'month', 'year')}, ), migrations.AddField( model_name='flatratetoroom', name='flat_rate_id', field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='billing.flatrate'), ), migrations.AddField( model_name='flatratetoroom', name='room_id', field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='billing.room', unique=True), ), migrations.AddField( model_name='flatraterange', name='flat_rate', field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='billing.flatrate'), ), migrations.AddField( model_name='flatrateadditional', name='flat_rate_range', field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='billing.flatraterange'), ), migrations.AlterUniqueTogether( name='room', unique_together={('quarter_type_id', 'room_number')}, ), migrations.AddConstraint( model_name='reading', constraint=models.CheckConstraint(check=models.Q(('month__gte', 1), ('month__lte', 12)), name='check_month_reading'), ), migrations.AddConstraint( model_name='reading', constraint=models.CheckConstraint(check=models.Q(('units_consumed__gte', 0)), name='check_units_consumed'), ), ]