2015-01-04 20:24:56 +01:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
import django.utils.timezone
|
|
|
|
import model_utils.fields
|
2018-11-19 23:28:40 +01:00
|
|
|
from django.db import migrations, models
|
2015-01-04 20:24:56 +01:00
|
|
|
|
|
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
2023-02-18 22:46:48 +01:00
|
|
|
("osusers", "0004_auto_20150104_1751"),
|
2015-01-04 20:24:56 +01:00
|
|
|
]
|
|
|
|
|
|
|
|
operations = [
|
|
|
|
migrations.CreateModel(
|
2023-02-18 22:46:48 +01:00
|
|
|
name="DatabaseUser",
|
2015-01-04 20:24:56 +01:00
|
|
|
fields=[
|
2023-02-18 22:46:48 +01:00
|
|
|
(
|
|
|
|
"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", on_delete=models.CASCADE),
|
|
|
|
),
|
2015-01-04 20:24:56 +01:00
|
|
|
],
|
|
|
|
options={
|
2023-02-18 22:46:48 +01:00
|
|
|
"verbose_name": "database user",
|
|
|
|
"verbose_name_plural": "database users",
|
2015-01-04 20:24:56 +01:00
|
|
|
},
|
|
|
|
bases=(models.Model,),
|
|
|
|
),
|
|
|
|
migrations.CreateModel(
|
2023-02-18 22:46:48 +01:00
|
|
|
name="UserDatabase",
|
2015-01-04 20:24:56 +01:00
|
|
|
fields=[
|
2023-02-18 22:46:48 +01:00
|
|
|
(
|
|
|
|
"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",
|
|
|
|
on_delete=models.CASCADE,
|
|
|
|
),
|
|
|
|
),
|
2015-01-04 20:24:56 +01:00
|
|
|
],
|
|
|
|
options={
|
2023-02-18 22:46:48 +01:00
|
|
|
"verbose_name": "user database",
|
|
|
|
"verbose_name_plural": "user specific database",
|
2015-01-04 20:24:56 +01:00
|
|
|
},
|
|
|
|
bases=(models.Model,),
|
|
|
|
),
|
|
|
|
migrations.AlterUniqueTogether(
|
2023-02-18 22:46:48 +01:00
|
|
|
name="userdatabase",
|
|
|
|
unique_together={("db_name", "db_user")},
|
2015-01-04 20:24:56 +01:00
|
|
|
),
|
|
|
|
migrations.AlterUniqueTogether(
|
2023-02-18 22:46:48 +01:00
|
|
|
name="databaseuser",
|
|
|
|
unique_together={("name", "db_type")},
|
2015-01-04 20:24:56 +01:00
|
|
|
),
|
|
|
|
]
|