79 lines
3.5 KiB
Python
79 lines
3.5 KiB
Python
# -*- coding: utf-8 -*-
|
|
# Generated by Django 1.10.5 on 2021-04-22 11:25
|
|
from __future__ import unicode_literals
|
|
|
|
from django.conf import settings
|
|
from django.db import migrations, models
|
|
import django.db.models.deletion
|
|
import orchestra.core.validators
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name='Database',
|
|
fields=[
|
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('name', models.CharField(max_length=64, validators=[orchestra.core.validators.validate_name], verbose_name='name')),
|
|
('type', models.CharField(choices=[('mysql', 'MySQL'), ('postgres', 'PostgreSQL')], default='mysql', max_length=32, verbose_name='type')),
|
|
('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='databases', to=settings.AUTH_USER_MODEL, verbose_name='Account')),
|
|
],
|
|
),
|
|
migrations.CreateModel(
|
|
name='DatabaseUser',
|
|
fields=[
|
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('username', models.CharField(max_length=16, validators=[orchestra.core.validators.validate_name], verbose_name='username')),
|
|
('password', models.CharField(max_length=256, verbose_name='password')),
|
|
('type', models.CharField(choices=[('mysql', 'MySQL'), ('postgres', 'PostgreSQL')], default='mysql', max_length=32, verbose_name='type')),
|
|
('account', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='databaseusers', to=settings.AUTH_USER_MODEL, verbose_name='Account')),
|
|
],
|
|
options={
|
|
'verbose_name_plural': 'DB users',
|
|
},
|
|
),
|
|
migrations.AddField(
|
|
model_name='database',
|
|
name='users',
|
|
field=models.ManyToManyField(blank=True, related_name='databases', to='databases.DatabaseUser', verbose_name='users'),
|
|
),
|
|
migrations.AlterUniqueTogether(
|
|
name='databaseuser',
|
|
unique_together=set([('username', 'type')]),
|
|
),
|
|
migrations.AlterUniqueTogether(
|
|
name='database',
|
|
unique_together=set([('name', 'type')]),
|
|
),
|
|
migrations.AlterField(
|
|
model_name='database',
|
|
name='type',
|
|
field=models.CharField(choices=[('mysql', 'MySQL')], default='mysql', max_length=32, verbose_name='type'),
|
|
),
|
|
migrations.AlterField(
|
|
model_name='databaseuser',
|
|
name='type',
|
|
field=models.CharField(choices=[('mysql', 'MySQL')], default='mysql', max_length=32, verbose_name='type'),
|
|
),
|
|
migrations.AddField(
|
|
model_name='database',
|
|
name='comments',
|
|
field=models.TextField(blank=True, default=''),
|
|
),
|
|
migrations.AlterField(
|
|
model_name='database',
|
|
name='type',
|
|
field=models.CharField(choices=[('mysql', 'MySQL'), ('postgres', 'PostgreSQL')], default='mysql', max_length=32, verbose_name='type'),
|
|
),
|
|
migrations.AlterField(
|
|
model_name='databaseuser',
|
|
name='type',
|
|
field=models.CharField(choices=[('mysql', 'MySQL'), ('postgres', 'PostgreSQL')], default='mysql', max_length=32, verbose_name='type'),
|
|
),
|
|
]
|