Skip to content

Commit

Permalink
OP-1360: set managed to true and upadted Django scheme for all models (
Browse files Browse the repository at this point in the history
…#52)

* OP-1360: set managed to true and upadted Django scheme for all models

* OP-1360: changed dependencies from insuree module

---------

Co-authored-by: lruzicki <[email protected]>
  • Loading branch information
lruzicki and lruzicki authored May 16, 2023
1 parent 5584dcd commit 33f455a
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 2 deletions.
69 changes: 69 additions & 0 deletions policy/migrations/0005_add_foreign_keys.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Generated by Django 3.2.18 on 2023-05-12 08:48

import core.fields
import datetime
from django.db import migrations, models
import django.db.models.deletion
import uuid


class Migration(migrations.Migration):

dependencies = [
('insuree', '0013_auto_20211103_1023'),
('core', '0019_extended_field'),
('product', '0006_insert_ceiling_type'),
('policy', '0004_add_medical_oficer_reading_rights'),
]

operations = [
migrations.RemoveField(
model_name='policy',
name='row_id',
),
migrations.AddField(
model_name='policy',
name='family',
field=models.ForeignKey(db_column='FamilyID', on_delete=django.db.models.deletion.DO_NOTHING, related_name='policies', to='insuree.family'),
),
migrations.AddField(
model_name='policy',
name='officer',
field=models.ForeignKey(blank=True, db_column='OfficerID', null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='policies', to='core.officer'),
),
migrations.AddField(
model_name='policy',
name='product',
field=models.ForeignKey(db_column='ProdID', on_delete=django.db.models.deletion.DO_NOTHING, related_name='policies', to='product.product'),
),
migrations.AddField(
model_name='policy',
name='uuid',
field=models.CharField(db_column='PolicyUUID', default=uuid.uuid4, max_length=36, unique=True),
),
migrations.AddField(
model_name='policyrenewal',
name='insuree',
field=models.ForeignKey(db_column='InsureeID', on_delete=django.db.models.deletion.DO_NOTHING, related_name='policy_renewals', to='insuree.insuree'),
),
migrations.AddField(
model_name='policyrenewal',
name='new_officer',
field=models.ForeignKey(blank=True, db_column='NewOfficerID', null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='policy_renewals', to='core.officer'),
),
migrations.AddField(
model_name='policyrenewal',
name='new_product',
field=models.ForeignKey(db_column='NewProdID', on_delete=django.db.models.deletion.DO_NOTHING, related_name='policy_renewals', to='product.product'),
),
migrations.AddField(
model_name='policyrenewal',
name='policy',
field=models.ForeignKey(db_column='PolicyID', on_delete=django.db.models.deletion.DO_NOTHING, related_name='policy_renewals', to='policy.policy'),
),
migrations.AlterField(
model_name='policy',
name='validity_from',
field=core.fields.DateTimeField(db_column='ValidityFrom', default=datetime.datetime.now),
),
]
21 changes: 21 additions & 0 deletions policy/migrations/0006_set_model_managed_to_true.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Generated by Django 3.2.18 on 2023-05-12 11:34

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('policy', '0005_add_foreign_keys'),
]

operations = [
migrations.AlterModelOptions(
name='policy',
options={'managed': True},
),
migrations.AlterModelOptions(
name='policyrenewal',
options={'managed': True},
),
]
4 changes: 2 additions & 2 deletions policy/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def can_add_insuree(self):
return self.family.members.filter(validity_to__isnull=True).count() < self.product.max_members

class Meta:
managed = False
managed = True
db_table = 'tblPolicy'

STATUS_IDLE = 1
Expand Down Expand Up @@ -106,7 +106,7 @@ class PolicyRenewal(core_models.VersionedModel):
audit_user_id = models.IntegerField(db_column='AuditCreateUser', null=True, blank=True)

class Meta:
managed = False
managed = True
db_table = 'tblPolicyRenewals'


Expand Down

0 comments on commit 33f455a

Please sign in to comment.