diff --git a/bloclink/apps/bis/migrations/0002_auto_20191220_2125.py b/bloclink/apps/bis/migrations/0002_auto_20191220_2125.py new file mode 100644 index 0000000000000000000000000000000000000000..f9814585c20635e03d7d4ff3a5ffc8aaf024a476 --- /dev/null +++ b/bloclink/apps/bis/migrations/0002_auto_20191220_2125.py @@ -0,0 +1,88 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.6 on 2019-12-20 21:25 +from __future__ import unicode_literals + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('bis', '0001_initial'), + ] + + operations = [ + migrations.CreateModel( + name='BuildingSubmission', + fields=[ + ('id', models.AutoField(primary_key=True, serialize=False)), + ('building_id', models.IntegerField()), + ('report_name', models.TextField()), + ('creation_timestamp', models.TextField()), + ('user_id', models.ForeignKey(db_column='user_id', on_delete=django.db.models.deletion.CASCADE, to='bis.Users')), + ], + options={ + 'db_table': 'building_submissions', + 'managed': True, + }, + ), + migrations.CreateModel( + name='Ecm', + fields=[ + ('id', models.AutoField(primary_key=True, serialize=False)), + ('ecm_name', models.TextField()), + ('short_description', models.TextField()), + ('long_description', models.TextField()), + ], + options={ + 'db_table': 'ecms', + 'managed': True, + }, + ), + migrations.CreateModel( + name='EcmCategory', + fields=[ + ('id', models.AutoField(primary_key=True, serialize=False)), + ('category_name', models.TextField()), + ], + options={ + 'db_table': 'ecm_categories', + 'managed': True, + }, + ), + migrations.CreateModel( + name='RecommendationSet', + fields=[ + ('id', models.AutoField(primary_key=True, serialize=False)), + ('recommendation_name', models.TextField()), + ], + options={ + 'db_table': 'recommendation_sets', + 'managed': True, + }, + ), + migrations.CreateModel( + name='RecommendationSetMap', + fields=[ + ('id', models.AutoField(primary_key=True, serialize=False)), + ('building_type_id', models.IntegerField()), + ('building_sub_type_id', models.IntegerField()), + ('recommendation_id', models.ForeignKey(db_column='recommendation_id', on_delete=django.db.models.deletion.CASCADE, to='bis.RecommendationSet')), + ], + options={ + 'db_table': 'recommendation_set_maps', + 'managed': True, + }, + ), + migrations.AddField( + model_name='ecm', + name='category_id', + field=models.ForeignKey(db_column='category_id', on_delete=django.db.models.deletion.CASCADE, to='bis.EcmCategory'), + ), + migrations.AddField( + model_name='ecm', + name='recommendation_id', + field=models.ForeignKey(db_column='recommendation_id', on_delete=django.db.models.deletion.CASCADE, to='bis.RecommendationSet'), + ), + ] diff --git a/bloclink/apps/bis/models.py b/bloclink/apps/bis/models.py index 5b0f3de7bb63bfa4d31ac9b659831606838b7b2e..ef54dc4fccb0c8fc82cab83deb27c08b76b53107 100644 --- a/bloclink/apps/bis/models.py +++ b/bloclink/apps/bis/models.py @@ -84,4 +84,48 @@ class Report(models.Model): survey_id = models.ForeignKey('SubmittedSurvey', db_column='survey_id') class Meta: managed = True - db_table = 'report' \ No newline at end of file + db_table = 'report' + +class EcmCategory(models.Model): + id = models.AutoField(primary_key=True) + category_name = models.TextField() + class Meta: + managed = True + db_table = 'ecm_categories' + +class RecommendationSet(models.Model): + id = models.AutoField(primary_key=True) + recommendation_name = models.TextField() + class Meta: + managed = True + db_table = 'recommendation_sets' + +class Ecm(models.Model): + id = models.AutoField(primary_key=True) + ecm_name = models.TextField() + short_description = models.TextField() + long_description = models.TextField() + category_id = models.ForeignKey('EcmCategory', db_column='category_id') + recommendation_id = models.ForeignKey('RecommendationSet', db_column='recommendation_id') + class Meta: + managed = True + db_table = 'ecms' + +class RecommendationSetMap(models.Model): + id = models.AutoField(primary_key=True) + building_type_id = models.IntegerField() + building_sub_type_id = models.IntegerField() + recommendation_id = models.ForeignKey('RecommendationSet', db_column='recommendation_id') + class Meta: + managed = True + db_table = 'recommendation_set_maps' + +class BuildingSubmission(models.Model): + id = models.AutoField(primary_key=True) + user_id = models.ForeignKey('Users', db_column='user_id') + building_id = models.IntegerField() + report_name = models.TextField() + creation_timestamp = models.TextField() + class Meta: + managed = True + db_table = 'building_submissions'