Skip to content

Commit

Permalink
Move Table definition in Migrations into Sequel.do
Browse files Browse the repository at this point in the history
This is to prevent warnings due to redefinition of a variable since
it looks like the migrations get mashed together inside the sequel
library
  • Loading branch information
FloThinksPi committed Aug 24, 2023
1 parent 35632b3 commit c10eb1f
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 56 deletions.
56 changes: 28 additions & 28 deletions db/migrations/20230822153000_streamline_annotation_key_prefix.rb
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
TABLE_BASE_NAMES = %w[
app
build
buildpack
deployment
domain
droplet
isolation_segment
organization
package
process
revision
route_binding
route
service_binding
service_broker
service_broker_update_request
service_instance
service_key
service_offering
service_plan
space
stack
task
user
].freeze
annotation_tables = TABLE_BASE_NAMES.map { |tbn| "#{tbn}_annotations" }.freeze

Sequel.migration do
table_base_names = %w[
app
build
buildpack
deployment
domain
droplet
isolation_segment
organization
package
process
revision
route_binding
route
service_binding
service_broker
service_broker_update_request
service_instance
service_key
service_offering
service_plan
space
stack
task
user
].freeze
annotation_tables = table_base_names.map { |tbn| "#{tbn}_annotations" }.freeze

up do
annotation_tables.each do |table|
# Output all annotations with a forward Slash
Expand Down
56 changes: 28 additions & 28 deletions db/migrations/20230822173000_add_migration_views_for_annotations.rb
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
TABLE_BASE_NAMES = %w[
app
build
buildpack
deployment
domain
droplet
isolation_segment
organization
package
process
revision
route_binding
route
service_binding
service_broker
service_broker_update_request
service_instance
service_key
service_offering
service_plan
space
stack
task
user
].freeze
annotation_tables = TABLE_BASE_NAMES.map { |tbn| "#{tbn}_annotations" }.freeze

Sequel.migration do
table_base_names = %w[
app
build
buildpack
deployment
domain
droplet
isolation_segment
organization
package
process
revision
route_binding
route
service_binding
service_broker
service_broker_update_request
service_instance
service_key
service_offering
service_plan
space
stack
task
user
].freeze
annotation_tables = table_base_names.map { |tbn| "#{tbn}_annotations" }.freeze

up do
annotation_tables.each do |table|
create_view("#{table}_migration_view".to_sym, self[table.to_sym].select { [id, guid, created_at, updated_at, resource_guid, key_prefix, key.as(key_name), value] })
Expand Down

0 comments on commit c10eb1f

Please sign in to comment.