Skip to content

Commit 259ef91

Browse files
committed
Address review comments
1 parent 4c3f886 commit 259ef91

4 files changed

Lines changed: 2 additions & 28 deletions

File tree

‎app/models/runtime/app_model.rb‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,6 @@ def validate
9797
validates_includes Lifecycles::TYPES, :lifecycle_type
9898
end
9999

100-
def lifecycle_type
101-
self[:lifecycle_type]
102-
end
103-
104100
def lifecycle_data
105101
# The lifecycle_data row can be destroyed independently of this
106102
# app; fall back to a frozen empty instance so callers never see

‎app/models/runtime/build_model.rb‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,6 @@ def validate
5555
validates_includes Lifecycles::TYPES, :lifecycle_type
5656
end
5757

58-
def before_create
59-
# Inherit lifecycle_type from associated app if not explicitly set
60-
self[:lifecycle_type] = app&.lifecycle_type if self[:lifecycle_type].blank?
61-
62-
super
63-
end
64-
65-
def lifecycle_type
66-
self[:lifecycle_type]
67-
end
68-
6958
def buildpack_lifecycle?
7059
lifecycle_type == BuildpackLifecycleDataModel::LIFECYCLE_TYPE
7160
end

‎app/models/runtime/droplet_model.rb‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,6 @@ class DropletModel < Sequel::Model(:droplets)
4949
serializes_via_json :process_types
5050
serializes_via_json :sidecars
5151

52-
def before_create
53-
# Inherit lifecycle_type from associated app if not explicitly set
54-
self[:lifecycle_type] = app&.lifecycle_type if self[:lifecycle_type].blank?
55-
56-
super
57-
end
58-
5952
def around_destroy
6053
yield
6154
rescue Sequel::ForeignKeyConstraintViolation => e
@@ -175,10 +168,6 @@ def fail_to_stage!(reason='StagingError', details='staging failed')
175168
save_changes(raise_on_save_failure: true)
176169
end
177170

178-
def lifecycle_type
179-
self[:lifecycle_type]
180-
end
181-
182171
def lifecycle_data
183172
# The lifecycle_data row can be destroyed independently of this
184173
# droplet; fall back to a frozen empty instance so callers never

‎db/migrations/20260825120100_make_lifecycle_type_non_nullable.rb‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
transaction do
88
run("ALTER TABLE #{table} ALTER COLUMN lifecycle_type SET DEFAULT 'buildpack'")
99
alter_table(table) do
10-
add_constraint({ name: :"#{table}_lifecycle_type_not_null", not_valid: true }) do
10+
add_constraint({ name: :"#{table}_lifecycle_type_not_null", not_valid: true, if_not_exists: true }) do
1111
Sequel.lit('lifecycle_type IS NOT NULL')
1212
end
1313
end
@@ -19,7 +19,7 @@
1919

2020
transaction do
2121
run("ALTER TABLE #{table} ALTER COLUMN lifecycle_type SET NOT NULL")
22-
alter_table(table) { drop_constraint(:"#{table}_lifecycle_type_not_null") }
22+
alter_table(table) { drop_constraint(:"#{table}_lifecycle_type_not_null", if_exists: true) }
2323
end
2424
else
2525
alter_table(table) do

0 commit comments

Comments
 (0)