Skip to content

Commit

Permalink
add department history migration
Browse files Browse the repository at this point in the history
  • Loading branch information
claire-peters committed Dec 13, 2023
1 parent c9739b5 commit 0da9b21
Showing 1 changed file with 65 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Generated by Django 3.2.17 on 2023-12-13 00:59

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import simple_history.models


class Migration(migrations.Migration):

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('ifxuser', '0014_auto_20221220_1921'),
('department', '0003_auto_20230515_1832'),
]

operations = [
migrations.CreateModel(
name='HistoricalDepartmentMember',
fields=[
('id', models.IntegerField(auto_created=True, blank=True, db_index=True, verbose_name='ID')),
('role', models.CharField(choices=[('pi', 'PI'), ('member', 'Member'), ('approver', 'Approver'), ('lab_manager', 'Lab Manager')], default='member', max_length=50)),
('active', models.BooleanField(default=True)),
('history_id', models.AutoField(primary_key=True, serialize=False)),
('history_date', models.DateTimeField(db_index=True)),
('history_change_reason', models.CharField(max_length=100, null=True)),
('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)),
('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
('organization', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='ifxuser.organization')),
('user', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to=settings.AUTH_USER_MODEL)),
],
options={
'verbose_name': 'historical department member',
'verbose_name_plural': 'historical department members',
'ordering': ('-history_date', '-history_id'),
'get_latest_by': ('history_date', 'history_id'),
},
bases=(simple_history.models.HistoricalChanges, models.Model),
),
migrations.CreateModel(
name='HistoricalDepartment',
fields=[
('id', models.IntegerField(auto_created=True, blank=True, db_index=True, verbose_name='ID')),
('ifxorg', models.CharField(blank=True, db_index=True, default=None, help_text='Org identifier', max_length=16, null=True)),
('name', models.CharField(default=None, help_text='Name of the organizational unit', max_length=100)),
('rank', models.CharField(choices=[('school', 'School'), ('department', 'Department'), ('center', 'Center'), ('lab', 'Laboratory'), ('institute', 'Institute'), ('museum', 'Museum'), ('institution', 'Institution'), ('facility', 'Facility'), ('program', 'Program'), ('division', 'Division'), ('group', 'Group'), ('office', 'Office'), ('company', 'Company'), ('rc_storage_billing_department', 'RC Storage Billing Department')], default=None, help_text='Type of org unit (e.g. Institution)', max_length=50)),
('org_tree', models.CharField(default=None, help_text='Grouping of org units', max_length=50)),
('slug', models.CharField(blank=True, help_text='Combination of org_tree, rank and name (e.g. CNS Institution Harvard (AA)', max_length=255, null=True)),
('code', models.CharField(blank=True, max_length=30, null=True)),
('application_key', models.CharField(blank=True, help_text='Alternate key for the organization (e.g. objectSid).', max_length=100, null=True)),
('history_id', models.AutoField(primary_key=True, serialize=False)),
('history_date', models.DateTimeField(db_index=True)),
('history_change_reason', models.CharField(max_length=100, null=True)),
('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)),
('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
],
options={
'verbose_name': 'historical department',
'verbose_name_plural': 'historical departments',
'ordering': ('-history_date', '-history_id'),
'get_latest_by': ('history_date', 'history_id'),
},
bases=(simple_history.models.HistoricalChanges, models.Model),
),
]

0 comments on commit 0da9b21

Please sign in to comment.