Skip to content

Commit 5784e37

Browse files
chore: apply code review suggestions
1 parent 093ff54 commit 5784e37

3 files changed

Lines changed: 63 additions & 33 deletions

File tree

bc_obps/registration/migrations/0183_update_registration_metadata.py

Lines changed: 61 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1973,7 +1973,7 @@ class Migration(migrations.Migration):
19731973
name='meets_producing_gger_schedule_a1_regulated_product',
19741974
field=models.BooleanField(
19751975
blank=True,
1976-
db_comment='Does this operation produce a regulated product listed in Table 2 of Schedule A.1 of the GGERR (Greenhouse Gas Emission Reporting Regulation)?',
1976+
db_comment="Does this operation produce a regulated product listed in Table 2 of Schedule A.1 of the GGERR (Greenhouse Gas Emission Reporting Regulation https://www.bclaws.gov.bc.ca/civix/document/id/lc/statreg/249_2015)?",
19771977
null=True,
19781978
),
19791979
),
@@ -2229,7 +2229,7 @@ class Migration(migrations.Migration):
22292229
model_name='historicalregulatedproduct',
22302230
name='name',
22312231
field=models.CharField(
2232-
db_comment="The name of the product as listed in Schedule A.1 of the GHGIRCA (Greenhouse Gas Industrial Reporting and Control Act) (e.g. 'Cement equivalent', 'Mining: coal', 'Sold electricity').",
2232+
db_comment="The name of the product as listed in Schedule A.1 of the GGIRCA (Greenhouse Gas Industrial Reporting and Control Act https://www.bclaws.gov.bc.ca/civix/document/id/complete/statreg/14029_01) (e.g. 'Cement equivalent', 'Mining: coal', 'Sold electricity').",
22332233
max_length=1000,
22342234
),
22352235
),
@@ -3009,15 +3009,25 @@ class Migration(migrations.Migration):
30093009
to='registration.naicscode',
30103010
),
30113011
),
3012-
migrations.AlterField(
3013-
model_name='operation',
3014-
name='operator',
3015-
field=models.ForeignKey(
3016-
db_comment='The operator that owns this operation. Foreign key to erc.operator',
3017-
on_delete=django.db.models.deletion.PROTECT,
3018-
related_name='operations',
3019-
to='registration.operator',
3020-
),
3012+
migrations.SeparateDatabaseAndState(
3013+
database_operations=[
3014+
migrations.RunSQL(
3015+
sql="COMMENT ON COLUMN erc.operation.operator_id IS 'The operator that owns this operation. Foreign key to erc.operator'",
3016+
reverse_sql="COMMENT ON COLUMN erc.operation.operator_id IS NULL",
3017+
),
3018+
],
3019+
state_operations=[
3020+
migrations.AlterField(
3021+
model_name='operation',
3022+
name='operator',
3023+
field=models.ForeignKey(
3024+
db_comment='The operator that owns this operation. Foreign key to erc.operator',
3025+
on_delete=django.db.models.deletion.PROTECT,
3026+
related_name='operations',
3027+
to='registration.operator',
3028+
),
3029+
),
3030+
],
30213031
),
30223032
migrations.AlterField(
30233033
model_name='operation',
@@ -3352,7 +3362,7 @@ class Migration(migrations.Migration):
33523362
name='meets_producing_gger_schedule_a1_regulated_product',
33533363
field=models.BooleanField(
33543364
blank=True,
3355-
db_comment='Does this operation produce a regulated product listed in Table 2 of Schedule A.1 of the GGERR (Greenhouse Gas Emission Reporting Regulation)?',
3365+
db_comment="Does this operation produce a regulated product listed in Table 2 of Schedule A.1 of the GGERR (Greenhouse Gas Emission Reporting Regulation https://www.bclaws.gov.bc.ca/civix/document/id/lc/statreg/249_2015)?",
33563366
null=True,
33573367
),
33583368
),
@@ -3589,7 +3599,7 @@ class Migration(migrations.Migration):
35893599
model_name='regulatedproduct',
35903600
name='name',
35913601
field=models.CharField(
3592-
db_comment="The name of the product as listed in Schedule A.1 of the GHGIRCA (Greenhouse Gas Industrial Reporting and Control Act) (e.g. 'Cement equivalent', 'Mining: coal', 'Sold electricity').",
3602+
db_comment="The name of the product as listed in Schedule A.1 of the GGIRCA (Greenhouse Gas Industrial Reporting and Control Act https://www.bclaws.gov.bc.ca/civix/document/id/complete/statreg/14029_01) (e.g. 'Cement equivalent', 'Mining: coal', 'Sold electricity').",
35933603
max_length=1000,
35943604
),
35953605
),
@@ -4015,15 +4025,25 @@ class Migration(migrations.Migration):
40154025
to='registration.user',
40164026
),
40174027
),
4018-
migrations.AlterField(
4019-
model_name='useroperator',
4020-
name='operator',
4021-
field=models.ForeignKey(
4022-
db_comment='The operator this user is requesting or has access to. Foreign key to erc.operator',
4023-
on_delete=django.db.models.deletion.DO_NOTHING,
4024-
related_name='user_operators',
4025-
to='registration.operator',
4026-
),
4028+
migrations.SeparateDatabaseAndState(
4029+
database_operations=[
4030+
migrations.RunSQL(
4031+
sql="COMMENT ON COLUMN erc.user_operator.operator_id IS 'The operator this user is requesting or has access to. Foreign key to erc.operator'",
4032+
reverse_sql="COMMENT ON COLUMN erc.user_operator.operator_id IS NULL",
4033+
),
4034+
],
4035+
state_operations=[
4036+
migrations.AlterField(
4037+
model_name='useroperator',
4038+
name='operator',
4039+
field=models.ForeignKey(
4040+
db_comment='The operator this user is requesting or has access to. Foreign key to erc.operator',
4041+
on_delete=django.db.models.deletion.DO_NOTHING,
4042+
related_name='user_operators',
4043+
to='registration.operator',
4044+
),
4045+
),
4046+
],
40274047
),
40284048
migrations.AlterField(
40294049
model_name='useroperator',
@@ -4044,15 +4064,25 @@ class Migration(migrations.Migration):
40444064
to='registration.user',
40454065
),
40464066
),
4047-
migrations.AlterField(
4048-
model_name='useroperator',
4049-
name='user',
4050-
field=models.ForeignKey(
4051-
db_comment='The user requesting or having access to this operator. Foreign key to erc.user',
4052-
on_delete=django.db.models.deletion.DO_NOTHING,
4053-
related_name='user_operators',
4054-
to='registration.user',
4055-
),
4067+
migrations.SeparateDatabaseAndState(
4068+
database_operations=[
4069+
migrations.RunSQL(
4070+
sql="COMMENT ON COLUMN erc.user_operator.user_id IS 'The user requesting or having access to this operator. Foreign key to erc.user'",
4071+
reverse_sql="COMMENT ON COLUMN erc.user_operator.user_id IS NULL",
4072+
),
4073+
],
4074+
state_operations=[
4075+
migrations.AlterField(
4076+
model_name='useroperator',
4077+
name='user',
4078+
field=models.ForeignKey(
4079+
db_comment='The user requesting or having access to this operator. Foreign key to erc.user',
4080+
on_delete=django.db.models.deletion.DO_NOTHING,
4081+
related_name='user_operators',
4082+
to='registration.user',
4083+
),
4084+
),
4085+
],
40564086
),
40574087
migrations.AlterField(
40584088
model_name='useroperator',

bc_obps/registration/models/opted_in_operation_detail.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class OptedInOperationDetail(TimeStampedModel):
3333
meets_producing_gger_schedule_a1_regulated_product = models.BooleanField(
3434
blank=True,
3535
null=True,
36-
db_comment="Does this operation produce a regulated product listed in Table 2 of Schedule A.1 of the GGERR (Greenhouse Gas Emission Reporting Regulation)?",
36+
db_comment="Does this operation produce a regulated product listed in Table 2 of Schedule A.1 of the GGERR (Greenhouse Gas Emission Reporting Regulation https://www.bclaws.gov.bc.ca/civix/document/id/lc/statreg/249_2015)?",
3737
)
3838
meets_reporting_and_regulated_obligations = models.BooleanField(
3939
blank=True,

bc_obps/registration/models/regulated_product.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
class RegulatedProduct(BaseModel):
1212
name = models.CharField(
1313
max_length=1000,
14-
db_comment="The name of the product as listed in Schedule A.1 of the GHGIRCA (Greenhouse Gas Industrial Reporting and Control Act) (e.g. 'Cement equivalent', 'Mining: coal', 'Sold electricity').",
14+
db_comment="The name of the product as listed in Schedule A.1 of the GGIRCA (Greenhouse Gas Industrial Reporting and Control Act https://www.bclaws.gov.bc.ca/civix/document/id/complete/statreg/14029_01) (e.g. 'Cement equivalent', 'Mining: coal', 'Sold electricity').",
1515
)
1616
unit = models.CharField(max_length=1000, default="N/A", db_comment="The unit of measure for a regulated product")
1717
is_regulated = models.BooleanField(db_comment="Indicates if a product is regulated")

0 commit comments

Comments
 (0)