Skip to content

Commit

Permalink
fix reo2 migrations for dev/stage/prod databases
Browse files Browse the repository at this point in the history
to fix your local database:
psql
drop database reopt;
create database reopt;
\q
python manage.py migrate
  • Loading branch information
Nick Laws committed Jan 20, 2022
1 parent 1c29f5f commit 1d5cba8
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 43 deletions.
44 changes: 1 addition & 43 deletions job/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 3.1.13 on 2021-12-15 02:42
# Generated by Django 3.1.13 on 2021-10-18 18:53

import django.contrib.postgres.fields
import django.core.validators
Expand Down Expand Up @@ -145,34 +145,6 @@ class Migration(migrations.Migration):
],
bases=(job.models.BaseModel, models.Model),
),
migrations.CreateModel(
name='ExistingBoilerInputs',
fields=[
('meta', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, primary_key=True, related_name='ExistingBoilerInputs', serialize=False, to='job.apimeta')),
('max_thermal_factor_on_peak_load', models.FloatField(blank=True, default=1.25, help_text='Factor on peak thermal load that the boiler can supply', validators=[django.core.validators.MinValueValidator(1.0), django.core.validators.MaxValueValidator(5.0)])),
('production_type', models.TextField(blank=True, choices=[('hot_water', 'Hot Water'), ('steam', 'Steam')], default='hot_water', help_text='Boiler thermal production type, `hot_water` or `steam`.')),
('efficiency', models.FloatField(blank=True, default=0, help_text='Existing boiler system efficiency - conversion of fuel to usable heating thermal energy. Default value depends on `production_type`. Provide non-zero value to over-ride default.')),
],
bases=(job.models.BaseModel, models.Model),
),
migrations.CreateModel(
name='ExistingBoilerOutputs',
fields=[
('meta', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, primary_key=True, related_name='ExistingBoilerOutputs', serialize=False, to='job.apimeta')),
('year_one_fuel_consumption_mmbtu_per_hr', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(blank=True, null=True), blank=True, default=list, null=True, size=None)),
('year_one_thermal_production_mmbtu_per_hr', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(blank=True, null=True), blank=True, default=list, null=True, size=None)),
('year_one_thermal_to_load_mmbtu_per_hour', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(blank=True, null=True), blank=True, default=list, null=True, size=None)),
('year_one_thermal_to_tes_mmbtu_per_hour', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(blank=True, null=True), blank=True, default=list, null=True, size=None)),
('year_one_thermal_to_steamturbine_mmbtu_per_hour', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(blank=True, null=True), blank=True, default=list, null=True, size=None)),
('year_one_fuel_consumption_mmbtu', models.FloatField(blank=True, null=True)),
('year_one_thermal_production_mmbtu', models.FloatField(blank=True, null=True)),
('year_one_emissions_lb_C02', models.FloatField(blank=True, null=True)),
('year_one_emissions_bau_lb_C02', models.FloatField(blank=True, null=True)),
('lifecycle_fuel_cost', models.FloatField(blank=True, null=True)),
('year_one_fuel_cost', models.FloatField(blank=True, null=True)),
],
bases=(job.models.BaseModel, models.Model),
),
migrations.CreateModel(
name='FinancialInputs',
fields=[
Expand Down Expand Up @@ -219,7 +191,6 @@ class Migration(migrations.Migration):
('offtaker_discounted_annual_free_cashflows_bau', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(blank=True, null=True), blank=True, default=list, help_text='Annual discounted free cashflow for the host in the business-as-usual case for all analysis years, including year 0. Future years have been discounted to account for the time value of money. Only calculated in the non-third-party case.', null=True, size=None)),
('developer_annual_free_cashflows', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(blank=True), blank=True, default=list, help_text='Annual free cashflow for the developer in the business-as-usual third party case for all analysis years, including year 0. Future years have not been discounted to account for the time value of money. Only calculated in the third-party case.', size=None)),
('developer_om_and_replacement_present_cost_after_tax', models.FloatField(blank=True, help_text='Net O&M and replacement costs in present value, after-tax for the third-party developer.Only calculated in the third-party case.', null=True)),
('lifecycle_fuel_costs_after_tax', models.FloatField(blank=True, help_text="Net present fuel costs for all fuel burning technologies after tax (using offtaker's tax rate).", null=True)),
],
bases=(job.models.BaseModel, models.Model),
),
Expand Down Expand Up @@ -317,19 +288,6 @@ class Migration(migrations.Migration):
],
bases=(job.models.BaseModel, models.Model),
),
migrations.CreateModel(
name='SpaceHeatingLoadInputs',
fields=[
('meta', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, primary_key=True, related_name='SpaceHeatingLoadInputs', serialize=False, to='job.apimeta')),
('annual_mmbtu', models.FloatField(blank=True, help_text="Annual electric chiller electric consumption, in mmbtu, used to scale simulated default boiler load profile for the site's climate zone. If no value is provided then the DoE Commercial Reference Building value is used.", null=True, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(100000000.0)])),
('monthly_mmbtu', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(blank=True, validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(100000000.0)]), blank=True, default=list, help_text="Monthly boiler energy consumption series (an array 12 entries long), in mmbtu, used to scale simulated default boiler load profile for the site's climate zone. If no values are provided then the DoE Commercial Reference Building values are used.", size=None)),
('doe_reference_name', models.TextField(blank=True, choices=[('FastFoodRest', 'Fastfoodrest'), ('FullServiceRest', 'Fullservicerest'), ('Hospital', 'Hospital'), ('LargeHotel', 'Largehotel'), ('LargeOffice', 'Largeoffice'), ('MediumOffice', 'Mediumoffice'), ('MidriseApartment', 'Midriseapartment'), ('Outpatient', 'Outpatient'), ('PrimarySchool', 'Primaryschool'), ('RetailStore', 'Retailstore'), ('SecondarySchool', 'Secondaryschool'), ('SmallHotel', 'Smallhotel'), ('SmallOffice', 'Smalloffice'), ('StripMall', 'Stripmall'), ('Supermarket', 'Supermarket'), ('Warehouse', 'Warehouse'), ('FlatLoad', 'Flatload'), ('FlatLoad_24_5', 'Flatload 24 5'), ('FlatLoad_16_7', 'Flatload 16 7'), ('FlatLoad_16_5', 'Flatload 16 5'), ('FlatLoad_8_7', 'Flatload 8 7'), ('FlatLoad_8_5', 'Flatload 8 5')], help_text='Simulated load profile from DOE Commercial Reference Buildings. If no value is provided then the `doe_reference_name` from the `ElectricLoad` is used. https://energy.gov/eere/buildings/commercial-reference-buildings')),
('fuel_loads_mmbtu_per_hour', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(blank=True), blank=True, default=list, help_text='Typical boiler fuel load for all hours in one year. Over-rides `doe_reference_name` and other values if provided.', size=None)),
('blended_doe_reference_names', django.contrib.postgres.fields.ArrayField(base_field=models.TextField(blank=True, choices=[('FastFoodRest', 'Fastfoodrest'), ('FullServiceRest', 'Fullservicerest'), ('Hospital', 'Hospital'), ('LargeHotel', 'Largehotel'), ('LargeOffice', 'Largeoffice'), ('MediumOffice', 'Mediumoffice'), ('MidriseApartment', 'Midriseapartment'), ('Outpatient', 'Outpatient'), ('PrimarySchool', 'Primaryschool'), ('RetailStore', 'Retailstore'), ('SecondarySchool', 'Secondaryschool'), ('SmallHotel', 'Smallhotel'), ('SmallOffice', 'Smalloffice'), ('StripMall', 'Stripmall'), ('Supermarket', 'Supermarket'), ('Warehouse', 'Warehouse'), ('FlatLoad', 'Flatload'), ('FlatLoad_24_5', 'Flatload 24 5'), ('FlatLoad_16_7', 'Flatload 16 7'), ('FlatLoad_16_5', 'Flatload 16 5'), ('FlatLoad_8_7', 'Flatload 8 7'), ('FlatLoad_8_5', 'Flatload 8 5')]), blank=True, default=list, help_text='Used in concert with blended_doe_reference_percents to create a blended load profile from multiple DoE Commercial Reference Buildings.', size=None)),
('blended_doe_reference_percents', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(1.0)]), blank=True, default=list, help_text='Used in concert with blended_doe_reference_names to create a blended load profile from multiple DoE Commercial Reference Buildings. Must sum to 1.0.', size=None)),
],
bases=(job.models.BaseModel, models.Model),
),
migrations.CreateModel(
name='StorageInputs',
fields=[
Expand Down
63 changes: 63 additions & 0 deletions job/migrations/0002_auto_20220120_1643.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Generated by Django 3.1.14 on 2022-01-20 16:43

import django.contrib.postgres.fields
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import job.models


class Migration(migrations.Migration):

dependencies = [
('job', '0001_initial'),
]

operations = [
migrations.CreateModel(
name='ExistingBoilerInputs',
fields=[
('meta', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, primary_key=True, related_name='ExistingBoilerInputs', serialize=False, to='job.apimeta')),
('max_thermal_factor_on_peak_load', models.FloatField(blank=True, default=1.25, help_text='Factor on peak thermal load that the boiler can supply', validators=[django.core.validators.MinValueValidator(1.0), django.core.validators.MaxValueValidator(5.0)])),
('production_type', models.TextField(blank=True, choices=[('hot_water', 'Hot Water'), ('steam', 'Steam')], default='hot_water', help_text='Boiler thermal production type, `hot_water` or `steam`.')),
('efficiency', models.FloatField(blank=True, default=0, help_text='Existing boiler system efficiency - conversion of fuel to usable heating thermal energy. Default value depends on `production_type`. Provide non-zero value to over-ride default.')),
],
bases=(job.models.BaseModel, models.Model),
),
migrations.CreateModel(
name='ExistingBoilerOutputs',
fields=[
('meta', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, primary_key=True, related_name='ExistingBoilerOutputs', serialize=False, to='job.apimeta')),
('year_one_fuel_consumption_mmbtu_per_hr', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(blank=True, null=True), blank=True, default=list, null=True, size=None)),
('year_one_thermal_production_mmbtu_per_hr', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(blank=True, null=True), blank=True, default=list, null=True, size=None)),
('year_one_thermal_to_load_mmbtu_per_hour', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(blank=True, null=True), blank=True, default=list, null=True, size=None)),
('year_one_thermal_to_tes_mmbtu_per_hour', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(blank=True, null=True), blank=True, default=list, null=True, size=None)),
('year_one_thermal_to_steamturbine_mmbtu_per_hour', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(blank=True, null=True), blank=True, default=list, null=True, size=None)),
('year_one_fuel_consumption_mmbtu', models.FloatField(blank=True, null=True)),
('year_one_thermal_production_mmbtu', models.FloatField(blank=True, null=True)),
('year_one_emissions_lb_C02', models.FloatField(blank=True, null=True)),
('year_one_emissions_bau_lb_C02', models.FloatField(blank=True, null=True)),
('lifecycle_fuel_cost', models.FloatField(blank=True, null=True)),
('year_one_fuel_cost', models.FloatField(blank=True, null=True)),
],
bases=(job.models.BaseModel, models.Model),
),
migrations.CreateModel(
name='SpaceHeatingLoadInputs',
fields=[
('meta', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, primary_key=True, related_name='SpaceHeatingLoadInputs', serialize=False, to='job.apimeta')),
('annual_mmbtu', models.FloatField(blank=True, help_text="Annual electric chiller electric consumption, in mmbtu, used to scale simulated default boiler load profile for the site's climate zone. If no value is provided then the DoE Commercial Reference Building value is used.", null=True, validators=[django.core.validators.MinValueValidator(1), django.core.validators.MaxValueValidator(100000000.0)])),
('monthly_mmbtu', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(blank=True, validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(100000000.0)]), blank=True, default=list, help_text="Monthly boiler energy consumption series (an array 12 entries long), in mmbtu, used to scale simulated default boiler load profile for the site's climate zone. If no values are provided then the DoE Commercial Reference Building values are used.", size=None)),
('doe_reference_name', models.TextField(blank=True, choices=[('FastFoodRest', 'Fastfoodrest'), ('FullServiceRest', 'Fullservicerest'), ('Hospital', 'Hospital'), ('LargeHotel', 'Largehotel'), ('LargeOffice', 'Largeoffice'), ('MediumOffice', 'Mediumoffice'), ('MidriseApartment', 'Midriseapartment'), ('Outpatient', 'Outpatient'), ('PrimarySchool', 'Primaryschool'), ('RetailStore', 'Retailstore'), ('SecondarySchool', 'Secondaryschool'), ('SmallHotel', 'Smallhotel'), ('SmallOffice', 'Smalloffice'), ('StripMall', 'Stripmall'), ('Supermarket', 'Supermarket'), ('Warehouse', 'Warehouse'), ('FlatLoad', 'Flatload'), ('FlatLoad_24_5', 'Flatload 24 5'), ('FlatLoad_16_7', 'Flatload 16 7'), ('FlatLoad_16_5', 'Flatload 16 5'), ('FlatLoad_8_7', 'Flatload 8 7'), ('FlatLoad_8_5', 'Flatload 8 5')], help_text='Simulated load profile from DOE Commercial Reference Buildings. If no value is provided then the `doe_reference_name` from the `ElectricLoad` is used. https://energy.gov/eere/buildings/commercial-reference-buildings')),
('fuel_loads_mmbtu_per_hour', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(blank=True), blank=True, default=list, help_text='Typical boiler fuel load for all hours in one year. Over-rides `doe_reference_name` and other values if provided.', size=None)),
('blended_doe_reference_names', django.contrib.postgres.fields.ArrayField(base_field=models.TextField(blank=True, choices=[('FastFoodRest', 'Fastfoodrest'), ('FullServiceRest', 'Fullservicerest'), ('Hospital', 'Hospital'), ('LargeHotel', 'Largehotel'), ('LargeOffice', 'Largeoffice'), ('MediumOffice', 'Mediumoffice'), ('MidriseApartment', 'Midriseapartment'), ('Outpatient', 'Outpatient'), ('PrimarySchool', 'Primaryschool'), ('RetailStore', 'Retailstore'), ('SecondarySchool', 'Secondaryschool'), ('SmallHotel', 'Smallhotel'), ('SmallOffice', 'Smalloffice'), ('StripMall', 'Stripmall'), ('Supermarket', 'Supermarket'), ('Warehouse', 'Warehouse'), ('FlatLoad', 'Flatload'), ('FlatLoad_24_5', 'Flatload 24 5'), ('FlatLoad_16_7', 'Flatload 16 7'), ('FlatLoad_16_5', 'Flatload 16 5'), ('FlatLoad_8_7', 'Flatload 8 7'), ('FlatLoad_8_5', 'Flatload 8 5')]), blank=True, default=list, help_text='Used in concert with blended_doe_reference_percents to create a blended load profile from multiple DoE Commercial Reference Buildings.', size=None)),
('blended_doe_reference_percents', django.contrib.postgres.fields.ArrayField(base_field=models.FloatField(blank=True, null=True, validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(1.0)]), blank=True, default=list, help_text='Used in concert with blended_doe_reference_names to create a blended load profile from multiple DoE Commercial Reference Buildings. Must sum to 1.0.', size=None)),
],
bases=(job.models.BaseModel, models.Model),
),
migrations.AddField(
model_name='financialoutputs',
name='lifecycle_fuel_costs_after_tax',
field=models.FloatField(blank=True, help_text="Net present fuel costs for all fuel burning technologies after tax (using offtaker's tax rate).", null=True),
),
]

0 comments on commit 1d5cba8

Please sign in to comment.