IdHub/idhub/migrations/0001_initial.py
2023-11-15 11:43:13 +01:00

355 lines
13 KiB
Python

# Generated by Django 4.2.5 on 2023-11-15 09:58
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='DID',
fields=[
(
'id',
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name='ID',
),
),
('created_at', models.DateTimeField(auto_now=True)),
('label', models.CharField(max_length=50)),
('did', models.CharField(max_length=250)),
('key_material', models.CharField(max_length=250)),
(
'user',
models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name='dids',
to=settings.AUTH_USER_MODEL,
),
),
],
),
migrations.CreateModel(
name='File_datas',
fields=[
(
'id',
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name='ID',
),
),
('file_name', models.CharField(max_length=250)),
('success', models.BooleanField(default=True)),
('created_at', models.DateTimeField(auto_now=True)),
],
),
migrations.CreateModel(
name='Organization',
fields=[
(
'id',
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name='ID',
),
),
('name', models.CharField(max_length=250)),
(
'url',
models.CharField(
help_text='Url where to send the presentation', max_length=250
),
),
],
),
migrations.CreateModel(
name='Rol',
fields=[
(
'id',
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name='ID',
),
),
('name', models.CharField(max_length=250, verbose_name='name')),
(
'description',
models.CharField(
max_length=250, null=True, verbose_name='Description'
),
),
],
),
migrations.CreateModel(
name='Schemas',
fields=[
(
'id',
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name='ID',
),
),
('file_schema', models.CharField(max_length=250)),
('data', models.TextField()),
('created_at', models.DateTimeField(auto_now=True)),
],
),
migrations.CreateModel(
name='Service',
fields=[
(
'id',
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name='ID',
),
),
('domain', models.CharField(max_length=250, verbose_name='Domain')),
(
'description',
models.CharField(max_length=250, verbose_name='Description'),
),
('rol', models.ManyToManyField(to='idhub.rol')),
],
),
migrations.CreateModel(
name='VCTemplate',
fields=[
(
'id',
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name='ID',
),
),
('wkit_template_id', models.CharField(max_length=250)),
('data', models.TextField()),
],
),
migrations.CreateModel(
name='VerificableCredential',
fields=[
(
'id',
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name='ID',
),
),
('id_string', models.CharField(max_length=250)),
('verified', models.BooleanField()),
('created_on', models.DateTimeField(auto_now=True)),
('issued_on', models.DateTimeField(null=True)),
('subject_did', models.CharField(max_length=250)),
('data', models.TextField()),
('csv_data', models.TextField()),
(
'status',
models.PositiveSmallIntegerField(
choices=[
(1, 'Enabled'),
(2, 'Issued'),
(3, 'Revoked'),
(4, 'Expired'),
],
default=1,
),
),
(
'issuer_did',
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name='vcredentials',
to='idhub.did',
),
),
(
'schema',
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name='vcredentials',
to='idhub.schemas',
),
),
(
'user',
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name='vcredentials',
to=settings.AUTH_USER_MODEL,
),
),
],
),
migrations.CreateModel(
name='Membership',
fields=[
(
'id',
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name='ID',
),
),
(
'type',
models.PositiveSmallIntegerField(
choices=[(1, 'Beneficiary'), (2, 'Employee'), (3, 'Member')],
verbose_name='Type of membership',
),
),
(
'start_date',
models.DateField(
blank=True,
help_text='What date did the membership start?',
null=True,
verbose_name='Start date',
),
),
(
'end_date',
models.DateField(
blank=True,
help_text='What date will the membership end?',
null=True,
verbose_name='End date',
),
),
(
'user',
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name='memberships',
to=settings.AUTH_USER_MODEL,
),
),
],
),
migrations.CreateModel(
name='Event',
fields=[
(
'id',
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name='ID',
),
),
('created', models.DateTimeField(auto_now=True)),
('message', models.CharField(max_length=350)),
(
'type',
models.PositiveSmallIntegerField(
choices=[
(1, 'EV_USR_REGISTERED'),
(2, 'EV_USR_WELCOME'),
(3, 'EV_DATA_UPDATE_REQUESTED_BY_USER'),
(4, 'EV_DATA_UPDATE_REQUESTED'),
(5, 'EV_USR_UPDATED_BY_ADMIN'),
(6, 'EV_USR_UPDATED'),
(7, 'EV_USR_DELETED_BY_ADMIN'),
(8, 'EV_DID_CREATED_BY_USER'),
(9, 'EV_DID_CREATED'),
(10, 'EV_DID_DELETED'),
(11, 'EV_CREDENTIAL_DELETED_BY_ADMIN'),
(12, 'EV_CREDENTIAL_DELETED'),
(13, 'EV_CREDENTIAL_ISSUED_FOR_USER'),
(14, 'EV_CREDENTIAL_ISSUED'),
(15, 'EV_CREDENTIAL_PRESENTED_BY_USER'),
(16, 'EV_CREDENTIAL_PRESENTED'),
(17, 'EV_CREDENTIAL_ENABLED'),
(18, 'EV_CREDENTIAL_CAN_BE_REQUESTED'),
(19, 'EV_CREDENTIAL_REVOKED_BY_ADMIN'),
(20, 'EV_CREDENTIAL_REVOKED'),
(21, 'EV_ROLE_CREATED_BY_ADMIN'),
(22, 'EV_ROLE_MODIFIED_BY_ADMIN'),
(23, 'EV_ROLE_DELETED_BY_ADMIN'),
(24, 'EV_SERVICE_CREATED_BY_ADMIN'),
(25, 'EV_SERVICE_MODIFIED_BY_ADMIN'),
(26, 'EV_SERVICE_DELETED_BY_ADMIN'),
(27, 'EV_ORG_DID_CREATED_BY_ADMIN'),
(28, 'EV_ORG_DID_DELETED_BY_ADMIN'),
(29, 'EV_USR_DEACTIVATED_BY_ADMIN'),
(30, 'EV_USR_ACTIVATED_BY_ADMIN'),
]
),
),
(
'user',
models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.CASCADE,
related_name='events',
to=settings.AUTH_USER_MODEL,
),
),
],
),
migrations.CreateModel(
name='UserRol',
fields=[
(
'id',
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name='ID',
),
),
(
'service',
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name='users',
to='idhub.service',
),
),
(
'user',
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name='roles',
to=settings.AUTH_USER_MODEL,
),
),
],
options={
'unique_together': {('user', 'service')},
},
),
]