UPDATE
This commit is contained in:
@@ -0,0 +1,125 @@
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
initial = True
|
||||
|
||||
dependencies = []
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name="SimulationScenario",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.BigAutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
("name", models.CharField(blank=True, default="", max_length=255)),
|
||||
(
|
||||
"scenario_type",
|
||||
models.CharField(
|
||||
choices=[
|
||||
("single", "Single Simulation"),
|
||||
("crop_comparison", "Crop Comparison"),
|
||||
("fertilization_comparison", "Fertilization Comparison"),
|
||||
],
|
||||
db_index=True,
|
||||
default="single",
|
||||
max_length=64,
|
||||
),
|
||||
),
|
||||
(
|
||||
"model_name",
|
||||
models.CharField(default="Wofost72_WLP_CWB", max_length=128),
|
||||
),
|
||||
(
|
||||
"status",
|
||||
models.CharField(
|
||||
choices=[
|
||||
("pending", "Pending"),
|
||||
("running", "Running"),
|
||||
("success", "Success"),
|
||||
("failure", "Failure"),
|
||||
],
|
||||
db_index=True,
|
||||
default="pending",
|
||||
max_length=32,
|
||||
),
|
||||
),
|
||||
("input_payload", models.JSONField(blank=True, default=dict)),
|
||||
("result_payload", models.JSONField(blank=True, default=dict)),
|
||||
("error_message", models.TextField(blank=True, default="")),
|
||||
("created_at", models.DateTimeField(auto_now_add=True, db_index=True)),
|
||||
("updated_at", models.DateTimeField(auto_now=True)),
|
||||
],
|
||||
options={
|
||||
"ordering": ["-created_at"],
|
||||
"verbose_name": "Simulation Scenario",
|
||||
"verbose_name_plural": "Simulation Scenarios",
|
||||
},
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name="SimulationRun",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.BigAutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
("run_key", models.CharField(max_length=64)),
|
||||
("label", models.CharField(max_length=255)),
|
||||
(
|
||||
"status",
|
||||
models.CharField(
|
||||
choices=[
|
||||
("pending", "Pending"),
|
||||
("running", "Running"),
|
||||
("success", "Success"),
|
||||
("failure", "Failure"),
|
||||
],
|
||||
db_index=True,
|
||||
default="pending",
|
||||
max_length=32,
|
||||
),
|
||||
),
|
||||
("weather_payload", models.JSONField(blank=True, default=list)),
|
||||
("soil_payload", models.JSONField(blank=True, default=dict)),
|
||||
("crop_payload", models.JSONField(blank=True, default=dict)),
|
||||
("site_payload", models.JSONField(blank=True, default=dict)),
|
||||
("agromanagement_payload", models.JSONField(blank=True, default=list)),
|
||||
("result_payload", models.JSONField(blank=True, default=dict)),
|
||||
("error_message", models.TextField(blank=True, default="")),
|
||||
("created_at", models.DateTimeField(auto_now_add=True)),
|
||||
("updated_at", models.DateTimeField(auto_now=True)),
|
||||
(
|
||||
"scenario",
|
||||
models.ForeignKey(
|
||||
on_delete=models.deletion.CASCADE,
|
||||
related_name="runs",
|
||||
to="crop_simulation.simulationscenario",
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
"ordering": ["scenario_id", "id"],
|
||||
"verbose_name": "Simulation Run",
|
||||
"verbose_name_plural": "Simulation Runs",
|
||||
},
|
||||
),
|
||||
migrations.AddConstraint(
|
||||
model_name="simulationrun",
|
||||
constraint=models.UniqueConstraint(
|
||||
fields=("scenario", "run_key"),
|
||||
name="crop_simulation_unique_run_key_per_scenario",
|
||||
),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,15 @@
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("crop_simulation", "0001_initial"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="simulationscenario",
|
||||
name="model_name",
|
||||
field=models.CharField(default="Wofost81_NWLP_CWB_CNB", max_length=128),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
Reference in New Issue
Block a user