# Generated by Django 5.0.3 on 2024-09-19 11:56

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('contenttypes', '0002_remove_content_type_name'),
    ]

    operations = [
        migrations.CreateModel(
            name='Server',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('host', models.CharField(max_length=256)),
                ('default_db_name', models.CharField(default='defaultdb', max_length=128)),
                ('db_user', models.CharField(max_length=256)),
                ('db_password', models.CharField(max_length=256)),
                ('db_port', models.CharField(max_length=256)),
                ('is_accessible', models.BooleanField(default=True)),
                ('last_accessed', models.DateTimeField(auto_now_add=True)),
                ('name', models.CharField(default='default_server', max_length=64)),
            ],
        ),
        migrations.CreateModel(
            name='BackupEntry',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('object_id', models.PositiveIntegerField()),
                ('file', models.FileField(upload_to='')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.contenttype')),
            ],
        ),
        migrations.CreateModel(
            name='Database',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('db_host', models.CharField(max_length=256)),
                ('db_name', models.CharField(max_length=256)),
                ('db_user', models.CharField(max_length=256)),
                ('db_password', models.CharField(max_length=256)),
                ('db_port', models.CharField(max_length=256)),
                ('server', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='databases', to='backups.server')),
            ],
        ),
        migrations.CreateModel(
            name='Table',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=256)),
                ('database', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='tables', to='backups.database')),
            ],
        ),
        migrations.AddConstraint(
            model_name='database',
            constraint=models.UniqueConstraint(fields=('server', 'db_name'), name='unique_server_db_name_combination'),
        ),
    ]
