IdHub/idhub/migrations/0001_initial.py

346 lines
12 KiB
Python
Raw Normal View History

2023-12-11 11:11:18 +00:00
# Generated by Django 4.2.5 on 2023-12-11 08:35
2023-10-03 03:47:00 +00:00
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 = [
2023-11-15 10:43:13 +00:00
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,
),
),
],
),
2023-10-03 03:47:00 +00:00
migrations.CreateModel(
2023-10-25 15:49:17 +00:00
name='File_datas',
2023-10-03 03:47:00 +00:00
fields=[
2023-10-16 17:08:18 +00:00
(
2023-10-25 15:49:17 +00:00
'id',
2023-10-16 17:08:18 +00:00
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
2023-10-25 15:49:17 +00:00
verbose_name='ID',
2023-10-16 17:08:18 +00:00
),
),
2023-10-25 15:49:17 +00:00
('file_name', models.CharField(max_length=250)),
('success', models.BooleanField(default=True)),
('created_at', models.DateTimeField(auto_now=True)),
2023-10-03 03:47:00 +00:00
],
),
migrations.CreateModel(
2023-10-25 15:49:17 +00:00
name='Rol',
2023-10-03 03:47:00 +00:00
fields=[
2023-10-16 17:08:18 +00:00
(
2023-10-25 15:49:17 +00:00
'id',
2023-10-16 17:08:18 +00:00
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
2023-10-25 15:49:17 +00:00
verbose_name='ID',
),
),
2023-11-14 16:45:08 +00:00
('name', models.CharField(max_length=250, verbose_name='name')),
(
'description',
models.CharField(
max_length=250, null=True, verbose_name='Description'
),
),
2023-10-25 15:49:17 +00:00
],
),
migrations.CreateModel(
name='Schemas',
fields=[
(
'id',
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name='ID',
),
),
2023-11-29 16:29:31 +00:00
('type', models.CharField(max_length=250)),
2023-10-25 15:49:17 +00:00
('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',
),
),
2023-11-14 16:45:08 +00:00
('domain', models.CharField(max_length=250, verbose_name='Domain')),
(
'description',
models.CharField(max_length=250, verbose_name='Description'),
),
2023-10-25 15:49:17 +00:00
('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(
2023-10-30 12:53:19 +00:00
name='VerificableCredential',
2023-10-25 15:49:17 +00:00
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)),
2023-11-14 16:45:08 +00:00
('issued_on', models.DateTimeField(null=True)),
2023-10-25 15:49:17 +00:00
('data', models.TextField()),
2023-11-14 17:50:23 +00:00
('csv_data', models.TextField()),
2023-10-26 11:33:13 +00:00
(
'status',
models.PositiveSmallIntegerField(
choices=[
2023-11-02 16:13:49 +00:00
(1, 'Enabled'),
2023-10-26 11:33:13 +00:00
(2, 'Issued'),
(3, 'Revoked'),
(4, 'Expired'),
],
default=1,
),
),
2023-11-15 10:43:13 +00:00
(
'issuer_did',
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name='vcredentials',
to='idhub.did',
),
),
2023-11-14 17:50:23 +00:00
(
'schema',
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name='vcredentials',
to='idhub.schemas',
),
),
2023-12-01 18:31:09 +00:00
(
'subject_did',
models.ForeignKey(
2023-12-04 08:51:08 +00:00
null=True,
2023-12-01 18:31:09 +00:00
on_delete=django.db.models.deletion.CASCADE,
related_name='subject_credentials',
to='idhub.did',
),
),
2023-10-25 15:49:17 +00:00
(
'user',
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name='vcredentials',
to=settings.AUTH_USER_MODEL,
),
),
],
),
migrations.CreateModel(
2023-11-14 16:45:08 +00:00
name='Membership',
2023-10-25 15:49:17 +00:00
fields=[
(
'id',
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name='ID',
),
),
(
2023-11-14 16:45:08 +00:00
'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',
2023-10-16 17:08:18 +00:00
),
),
(
2023-10-25 15:49:17 +00:00
'user',
2023-10-16 17:08:18 +00:00
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
2023-11-14 16:45:08 +00:00
related_name='memberships',
2023-10-16 17:08:18 +00:00
to=settings.AUTH_USER_MODEL,
),
),
2023-10-03 03:47:00 +00:00
],
),
migrations.CreateModel(
2023-11-14 16:45:08 +00:00
name='Event',
2023-10-03 03:47:00 +00:00
fields=[
2023-10-16 17:08:18 +00:00
(
2023-10-25 15:49:17 +00:00
'id',
2023-10-16 17:08:18 +00:00
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
2023-10-25 15:49:17 +00:00
verbose_name='ID',
2023-10-16 17:08:18 +00:00
),
),
2023-11-14 16:45:08 +00:00
('created', models.DateTimeField(auto_now=True)),
('message', models.CharField(max_length=350)),
2023-10-16 17:08:18 +00:00
(
2023-10-25 15:49:17 +00:00
'type',
2023-10-16 17:08:18 +00:00
models.PositiveSmallIntegerField(
2023-11-14 16:45:08 +00:00
choices=[
2023-11-29 16:29:31 +00:00
(1, 'User registered'),
(2, 'User welcomed'),
(3, 'Data update requested by user'),
(
4,
'Data update requested. Pending approval by administrator',
),
(5, "User's data updated by admin"),
(6, 'Your data updated by admin'),
(7, 'User deactivated by admin'),
(8, 'DID created by user'),
(9, 'DID created'),
(10, 'DID deleted'),
(11, 'Credential deleted by user'),
(12, 'Credential deleted'),
(13, 'Credential issued for user'),
(14, 'Credential issued'),
(15, 'Credential presented by user'),
(16, 'Credential presented'),
(17, 'Credential enabled'),
(18, 'Credential available'),
(19, 'Credential revoked by admin'),
(20, 'Credential revoked'),
(21, 'Role created by admin'),
(22, 'Role modified by admin'),
(23, 'Role deleted by admin'),
(24, 'Service created by admin'),
(25, 'Service modified by admin'),
(26, 'Service deleted by admin'),
(27, 'Organisational DID created by admin'),
(28, 'Organisational DID deleted by admin'),
(29, 'User deactivated'),
(30, 'User activated'),
2023-11-14 16:45:08 +00:00
]
2023-10-16 17:08:18 +00:00
),
),
(
2023-11-14 16:45:08 +00:00
'user',
models.ForeignKey(
2023-10-16 17:08:18 +00:00
null=True,
2023-11-14 16:45:08 +00:00
on_delete=django.db.models.deletion.CASCADE,
related_name='events',
to=settings.AUTH_USER_MODEL,
2023-10-16 17:08:18 +00:00
),
),
2023-11-14 16:45:08 +00:00
],
),
2023-10-03 03:47:00 +00:00
migrations.CreateModel(
2023-11-14 16:45:08 +00:00
name='UserRol',
2023-10-03 03:47:00 +00:00
fields=[
2023-10-16 17:08:18 +00:00
(
2023-10-25 15:49:17 +00:00
'id',
2023-10-16 17:08:18 +00:00
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
2023-10-25 15:49:17 +00:00
verbose_name='ID',
2023-10-16 17:08:18 +00:00
),
),
2023-11-14 16:45:08 +00:00
(
'service',
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
related_name='users',
to='idhub.service',
),
),
2023-10-16 17:08:18 +00:00
(
2023-10-25 15:49:17 +00:00
'user',
2023-10-16 17:08:18 +00:00
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
2023-11-14 16:45:08 +00:00
related_name='roles',
2023-10-16 17:08:18 +00:00
to=settings.AUTH_USER_MODEL,
),
),
2023-10-03 03:47:00 +00:00
],
2023-11-14 16:45:08 +00:00
options={
'unique_together': {('user', 'service')},
},
2023-10-03 03:47:00 +00:00
),
]