# Generated by Django 5.1 on 2024-08-29 13:47

import django.db.models.deletion
import django.utils.timezone
from django.db import migrations, models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Municipality',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=64)),
                ('psgc_code', models.IntegerField(blank=True, null=True)),
                ('city_mun_code', models.IntegerField(blank=True, null=True)),
                ('prov_code', models.IntegerField(blank=True, null=True)),
                ('reg_code', models.IntegerField(blank=True, null=True)),
            ],
            options={
                'verbose_name': 'Municipality',
                'verbose_name_plural': 'Municipalities',
                'db_table': 'db_municipality',
                'ordering': ['-pk'],
            },
        ),
        migrations.CreateModel(
            name='Province',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=64)),
                ('psgc_code', models.IntegerField(blank=True, null=True)),
                ('prov_code', models.IntegerField(blank=True, null=True)),
                ('reg_code', models.IntegerField(blank=True, null=True)),
            ],
            options={
                'verbose_name': 'Province',
                'verbose_name_plural': 'Provinces',
                'db_table': 'db_province',
                'ordering': ['-pk'],
            },
        ),
        migrations.CreateModel(
            name='Region',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=64)),
                ('psgc_code', models.IntegerField(blank=True, null=True)),
                ('reg_code', models.IntegerField(unique=True)),
                ('country', models.CharField(choices=[('PH', 'Philippines')], default='PH', max_length=4, verbose_name='Country')),
            ],
            options={
                'verbose_name': 'Region',
                'verbose_name_plural': 'Regions',
                'db_table': 'db_region',
                'ordering': ['-pk'],
            },
        ),
        migrations.CreateModel(
            name='Barangay',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=64)),
                ('brgy_code', models.IntegerField(blank=True, null=True)),
                ('city_mun_code', models.IntegerField(blank=True, null=True)),
                ('prov_code', models.IntegerField(blank=True, null=True)),
                ('reg_code', models.IntegerField(blank=True, null=True)),
                ('municipality', models.ForeignKey(db_column='municipality_id', on_delete=django.db.models.deletion.CASCADE, related_name='barangay_municipality', to='phil_loc.municipality', verbose_name='Municipality')),
            ],
            options={
                'verbose_name': 'Barangay',
                'verbose_name_plural': 'Barangays',
                'db_table': 'db_barangay',
                'ordering': ['-pk'],
            },
        ),
        migrations.AddField(
            model_name='municipality',
            name='province',
            field=models.ForeignKey(db_column='province_id', on_delete=django.db.models.deletion.CASCADE, related_name='municipality_province', to='phil_loc.province', verbose_name='Province'),
        ),
        migrations.AddField(
            model_name='province',
            name='region',
            field=models.ForeignKey(db_column='region_id', on_delete=django.db.models.deletion.CASCADE, related_name='province_region', to='phil_loc.region', verbose_name='Region'),
        ),
        migrations.CreateModel(
            name='PhAddress',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('country', models.CharField(choices=[('PH', 'Philippines')], default='PH', max_length=4, verbose_name='Country')),
                ('unit_home_street', models.CharField(default=None, max_length=256, null=True)),
                ('zip_code', models.IntegerField(blank=True, default=None, null=True)),
                ('district_id', models.IntegerField(blank=True, default=None, null=True)),
                ('created_at', models.DateTimeField(default=django.utils.timezone.now)),
                ('updated_at', models.DateTimeField(auto_now_add=True)),
                ('barangay_district', models.ForeignKey(blank=True, db_column='barangay_id', null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='address_barangay', to='phil_loc.barangay', verbose_name='Barangay')),
                ('municipality', models.ForeignKey(db_column='municipality_id', on_delete=django.db.models.deletion.DO_NOTHING, related_name='ph_addresses', to='phil_loc.municipality', verbose_name='Municipality')),
                ('province', models.ForeignKey(db_column='province_id', on_delete=django.db.models.deletion.DO_NOTHING, related_name='address_province', to='phil_loc.province', verbose_name='Province')),
                ('region', models.ForeignKey(db_column='region_id', on_delete=django.db.models.deletion.DO_NOTHING, related_name='address_region', to='phil_loc.region', verbose_name='Region')),
            ],
            options={
                'verbose_name': 'Phillipines Address',
                'verbose_name_plural': 'Phillipines Addresses',
                'db_table': 'db_ph_address',
                'ordering': ['-pk'],
            },
        ),
    ]
