55 lines
2.4 KiB
Python
55 lines
2.4 KiB
Python
# -*- coding: utf-8 -*-
|
|
from __future__ import unicode_literals
|
|
|
|
from django.db import models, migrations
|
|
import django.utils.timezone
|
|
import model_utils.fields
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
('osusers', '0004_auto_20150104_1751'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name='DatabaseUser',
|
|
fields=[
|
|
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
|
('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, verbose_name='created', editable=False)),
|
|
('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, verbose_name='modified', editable=False)),
|
|
('name', models.CharField(max_length=63, verbose_name='username')),
|
|
('db_type', models.PositiveSmallIntegerField(verbose_name='database type', choices=[(0, 'PostgreSQL'), (1, 'MySQL')])),
|
|
('osuser', models.ForeignKey(to='osusers.User')),
|
|
],
|
|
options={
|
|
'verbose_name': 'database user',
|
|
'verbose_name_plural': 'database users',
|
|
},
|
|
bases=(models.Model,),
|
|
),
|
|
migrations.CreateModel(
|
|
name='UserDatabase',
|
|
fields=[
|
|
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
|
('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, verbose_name='created', editable=False)),
|
|
('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, verbose_name='modified', editable=False)),
|
|
('db_name', models.CharField(max_length=63, verbose_name='database name')),
|
|
('db_user', models.ForeignKey(verbose_name='database user', to='userdbs.DatabaseUser')),
|
|
],
|
|
options={
|
|
'verbose_name': 'user database',
|
|
'verbose_name_plural': 'user specific database',
|
|
},
|
|
bases=(models.Model,),
|
|
),
|
|
migrations.AlterUniqueTogether(
|
|
name='userdatabase',
|
|
unique_together=set([('db_name', 'db_user')]),
|
|
),
|
|
migrations.AlterUniqueTogether(
|
|
name='databaseuser',
|
|
unique_together=set([('name', 'db_type')]),
|
|
),
|
|
]
|