Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring/migrations cleanup #4420

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 3.2.19 on 2023-06-10 13:03
# Generated by Django 3.2.25 on 2024-11-07 12:18

from django.conf import settings
from django.db import migrations, models
Expand All @@ -9,12 +9,26 @@

class Migration(migrations.Migration):

initial = True

dependencies = [
('core', '0044_migration_squashed_0057_migration'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]

operations = [
migrations.CreateModel(
name='APILogEntry',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('timestamp', models.DateTimeField(default=django.utils.timezone.now)),
('url', models.URLField()),
('method', models.CharField(max_length=10)),
('status_code', models.IntegerField()),
],
options={
'verbose_name_plural': 'Api Log Entries',
},
),
migrations.CreateModel(
name='APIToken',
fields=[
Expand All @@ -23,20 +37,8 @@ class Migration(migrations.Migration):
('allowed_ips', models.CharField(blank=True, max_length=200, null=True, verbose_name='IPs')),
('valid_from', models.DateField(default=django.utils.timezone.now)),
('valid_to', models.DateField(blank=True, null=True)),
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
('valid_for', models.ManyToManyField(to='core.BusinessArea')),
('grants', hct_mis_api.apps.account.fields.ChoiceArrayField(base_field=models.CharField(choices=[('API_READ_ONLY', 'API_READ_ONLY'), ('API_RDI_UPLOAD', 'API_RDI_UPLOAD'), ('API_RDI_CREATE', 'API_RDI_CREATE'), ('API_PROGRAM_CREATE', 'API_PROGRAM_CREATE')], max_length=255), size=None)),
],
),
migrations.CreateModel(
name='APILogEntry',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('timestamp', models.DateTimeField(default=django.utils.timezone.now)),
('url', models.URLField()),
('method', models.CharField(max_length=10)),
('status_code', models.IntegerField()),
('token', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='api.apitoken')),
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
]
22 changes: 16 additions & 6 deletions src/hct_mis_api/api/migrations/0002_migration.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,27 @@
# Generated by Django 3.2.20 on 2023-09-26 10:13
# Generated by Django 3.2.25 on 2024-11-07 12:18

from django.db import migrations
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

initial = True

dependencies = [
('api', '0001_migration_squashed_0003_migration'),
('core', '0001_migration'),
('api', '0001_migration'),
]

operations = [
migrations.AlterModelOptions(
name='apilogentry',
options={'verbose_name_plural': 'Api Log Entries'},
migrations.AddField(
model_name='apitoken',
name='valid_for',
field=models.ManyToManyField(to='core.BusinessArea'),
),
migrations.AddField(
model_name='apilogentry',
name='token',
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='api.apitoken'),
),
]
113 changes: 113 additions & 0 deletions src/hct_mis_api/apps/account/migrations/0001_migration.py

Large diffs are not rendered by default.

This file was deleted.

101 changes: 101 additions & 0 deletions src/hct_mis_api/apps/account/migrations/0002_migration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# Generated by Django 3.2.25 on 2024-11-07 12:18

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import mptt.fields


class Migration(migrations.Migration):

initial = True

dependencies = [
('core', '0001_migration'),
('auth', '0012_alter_user_first_name_max_length'),
('account', '0001_migration'),
]

operations = [
migrations.AddField(
model_name='userrole',
name='business_area',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='user_roles', to='core.businessarea'),
),
migrations.AddField(
model_name='userrole',
name='role',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='user_roles', to='account.role'),
),
migrations.AddField(
model_name='userrole',
name='user',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='user_roles', to=settings.AUTH_USER_MODEL),
),
migrations.AddField(
model_name='usergroup',
name='business_area',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='user_groups', to='core.businessarea'),
),
migrations.AddField(
model_name='usergroup',
name='group',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='user_groups', to='auth.group'),
),
migrations.AddField(
model_name='usergroup',
name='user',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='user_groups', to=settings.AUTH_USER_MODEL),
),
migrations.AlterUniqueTogether(
name='role',
unique_together={('name', 'subsystem')},
),
migrations.AddField(
model_name='partner',
name='allowed_business_areas',
field=models.ManyToManyField(blank=True, to='core.BusinessArea'),
),
migrations.AddField(
model_name='partner',
name='parent',
field=mptt.fields.TreeForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='account.partner', verbose_name='Parent'),
),
migrations.AddField(
model_name='incompatibleroles',
name='role_one',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='incompatible_roles_one', to='account.role'),
),
migrations.AddField(
model_name='incompatibleroles',
name='role_two',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='incompatible_roles_two', to='account.role'),
),
migrations.AddField(
model_name='user',
name='groups',
field=models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups'),
),
migrations.AddField(
model_name='user',
name='partner',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.PROTECT, to='account.partner'),
),
migrations.AddField(
model_name='user',
name='user_permissions',
field=models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions'),
),
migrations.AlterUniqueTogether(
name='userrole',
unique_together={('business_area', 'user', 'role')},
),
migrations.AlterUniqueTogether(
name='usergroup',
unique_together={('business_area', 'user', 'group')},
),
migrations.AlterUniqueTogether(
name='incompatibleroles',
unique_together={('role_one', 'role_two')},
),
]

This file was deleted.

This file was deleted.

19 changes: 0 additions & 19 deletions src/hct_mis_api/apps/account/migrations/0051_migration.py

This file was deleted.

Loading
Loading