source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20180523205142_backfill_web_processes_for_v3_apps.rb
Ruby
apache-2.0
203
main
795
Sequel.migration do up do app_guids_with_web_processes = self[:processes].select(:app_guid).where(type: 'web') app_records_without_web_processes = self[:apps].select(:guid, :desired_state).exclude(guid: app_guids_with_web_processes).all app_records_without_web_processes.each do |app_record| app_gui...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20190110224601_create_isolation_segment_metadata_tables.rb
Ruby
apache-2.0
203
main
418
Sequel.migration do change do create_table(:isolation_segment_annotations) do VCAP::Migration.common(self) VCAP::Migration.annotations_common(self, :isolation_segment_annotations, :isolation_segments) end create_table(:isolation_segment_labels) do VCAP::Migration.common(self) VCAP...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20240115163000_add_delete_cascade_to_foreign_keys.rb
Ruby
apache-2.0
203
main
2,295
require File.expand_path('../helpers/add_delete_cascade_to_foreign_key', __dir__) Sequel.migration do foreign_keys = [ ForeignKey.new(:deployment_processes, :fk_deployment_processes_deployment_guid, :deployment_guid, :deployments, :guid), ForeignKey.new(:deployment_labels, :fk_deployment_labels_resource_guid...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20150130181135_grow_metadata_column.rb
Ruby
apache-2.0
203
main
225
Sequel.migration do up do alter_table :apps do set_column_type :metadata, String, size: 4095, text: true end end down do alter_table :apps do set_column_type :metadata, String end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20150220010146_remove_kill_after_multiple_restarts_from_apps.rb
Ruby
apache-2.0
203
main
242
Sequel.migration do up do alter_table :apps do drop_column :kill_after_multiple_restarts end end down do alter_table :apps do add_column :kill_after_multiple_restarts, :boolean, default: false end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20161011141422_service_binding_volume_mounts_convert_to_2_10_format.rb
Ruby
apache-2.0
203
main
1,912
require 'cloud_controller/encryptor' Sequel.migration do up do self[:service_bindings].each do |service_binding| next if service_binding[:volume_mounts].nil? mounts = Oj.load(VCAP::CloudController::Encryptor.decrypt(service_binding[:volume_mounts], service_binding[:volume_mounts_salt])) next ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20180515221609_create_primary_key_for_organizations_billing_managers.rb
Ruby
apache-2.0
203
main
434
require File.expand_path('../../helpers/change_primary_key', __FILE__) Sequel.migration do up do add_primary_key_to_table(:organizations_billing_managers, :organizations_billing_managers_pk) end down do remove_primary_key_from_table(:organizations_billing_managers, :org...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20220628145100_add_missing_indices.rb
Ruby
apache-2.0
203
main
740
Sequel.migration do up do alter_table :processes do add_index :revision_guid, name: :processes_revision_guid_index end alter_table :deployments do add_index :revision_guid, name: :deployments_revision_guid_index end alter_table :sidecar_process_types do add_index :app_guid, nam...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20230622194039_add_build_and_run_rootfs_images_to_stack.rb
Ruby
apache-2.0
203
main
309
Sequel.migration do up do alter_table :stacks do add_column :build_rootfs_image, String, size: 255 add_column :run_rootfs_image, String, size: 255 end end down do alter_table :stacks do drop_column :build_rootfs_image drop_column :run_rootfs_image end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20150414113235_remove_space_id.rb
Ruby
apache-2.0
203
main
400
Sequel.migration do # This migration was not backwards-compatible and caused API outages during upgrade. # It has been altered from its original form. up do alter_table :events do drop_foreign_key([:space_id]) end end down do alter_table :events do add_foreign_key [:space_id], :space...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20140603184619_add_app_security_group_spaces_join_table.rb
Ruby
apache-2.0
203
main
430
Sequel.migration do change do create_table :app_security_groups_spaces do Integer :app_security_group_id, null: false foreign_key [:app_security_group_id], :app_security_groups, name: :fk_app_security_group_id Integer :space_id, null: false foreign_key [:space_id], :spaces, name: :fk_spac...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20141226222846_create_packages.rb
Ruby
apache-2.0
203
main
311
Sequel.migration do change do create_table :packages do VCAP::Migration.common(self) String :space_guid index :space_guid String :type index :type String :package_hash String :state, null: false String :error, text: true String :url end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20160203011824_create_route_mappings_table.rb
Ruby
apache-2.0
203
main
473
Sequel.migration do up do drop_table(:apps_v3_routes) create_table :route_mappings do VCAP::Migration.common(self, :route_mappings) String :app_guid index :app_guid foreign_key [:app_guid], :apps_v3, key: :guid String :route_guid index :route_guid foreign_key [:rou...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20131104223608_fix_events_timestamps_and_truncate.rb
Ruby
apache-2.0
203
main
571
require 'cloud_controller/db' Sequel.migration do up do if self.class.name.match?(/mysql/i) self[:events].truncate run('ALTER TABLE events CHANGE updated_at updated_at TIMESTAMP NULL DEFAULT NULL') run('ALTER TABLE events CHANGE created_at created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20140723212942_add_space_quota_definitions.rb
Ruby
apache-2.0
203
main
617
Sequel.migration do change do create_table :space_quota_definitions do VCAP::Migration.common(self, :sqd) String :name, null: false Boolean :non_basic_services_allowed, null: false Integer :total_services, null: false Integer :memory_limit, null: false Integer :total_routes, n...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20161005205815_fix_droplets_process_types_json.rb
Ruby
apache-2.0
203
main
1,401
Sequel.migration do droplet_process_type_batcher = Class.new do def initialize(db) @db = db @max_batch = 1_000 @batched_commands = [] end def add_command(command, id) @batched_commands << [id, command] flush if @batched_commands.count >= @max_batch e...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20240102150000_add_annotation_label_uniqueness.rb
Ruby
apache-2.0
203
main
5,285
require 'logger' def unique_index_name(table) :"#{table}_unique" end def with_dropped_view(table) # Recreate view just for postgres as it cannot alter types while a view is on the table if database_type == :postgres drop_view(:"#{table}_migration_view", if_exists: true) yield if block_given? create_...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20210708215223_create_spaces_supporters_table.rb
Ruby
apache-2.0
203
main
838
Sequel.migration do change do create_table :spaces_supporters do primary_key :id, name: :spaces_supporters_pk String :role_guid, size: 255 Integer :space_id, null: false Integer :user_id, null: false Timestamp :created_at, null: false, default: Sequel::CURRENT_TIMESTAMP Timesta...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20220818142407_add_unique_index_to_service_instance_operations_service_instance_id.rb
Ruby
apache-2.0
203
main
1,830
Sequel.migration do up do # Remove duplicate service_instance_operations.service_instance_id to prepare for adding a uniqueness constraint dup_groups = self[:service_instance_operations].exclude(service_instance_id: nil). select(:service_instance_id). group_by(:service_insta...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20150713133551_enlarge_service_keys_credentials.rb
Ruby
apache-2.0
203
main
273
Sequel.migration do up do alter_table :service_keys do set_column_type :credentials, String, null: false, text: true end end down do alter_table :service_keys do set_column_type :credentials, String, null: false, size: 2048 end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20140306000008_remove_sso_client_id_from_services.rb
Ruby
apache-2.0
203
main
690
Sequel.migration do up do run <<~SQL.squish INSERT INTO service_dashboard_clients (uaa_id, service_id_on_broker) SELECT sso_client_id, unique_id FROM services WHERE sso_client_id IS NOT NULL SQL alter_table :services do drop_column :sso_client_id end end down d...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20190617181325_add_key_prefix_to_process_annotations.rb
Ruby
apache-2.0
203
main
221
Sequel.migration do change do unless self[:process_annotations].columns.include?(:key_prefix) alter_table(:process_annotations) do add_column :key_prefix, String, size: 253 end end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20250603103500_bigint_migration_events_step3b.rb
Ruby
apache-2.0
203
main
2,424
require 'database/bigint_migration' Sequel.migration do no_transaction up do if database_type == :postgres && VCAP::BigintMigration.has_check_constraint?(self, :events) transaction do # Drop check constraint and trigger function VCAP::BigintMigration.drop_check_constraint(self, :events) ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20160621182906_remove_space_id_from_events.rb
Ruby
apache-2.0
203
main
458
Sequel.migration do up do if database_type == :postgres run <<~SQL.squish ALTER TABLE events DROP COLUMN IF EXISTS space_id; SQL elsif dataset.db['select * from information_schema.columns where table_name = \'events\' and column_name = \'space_id\''].any? alter_table(:events) do ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20170802230125_add_missing_task_stopped_usage_events_second_attempt.rb
Ruby
apache-2.0
203
main
947
Sequel.migration do change do events_to_backfill = self[:app_usage_events]. select_all. join( self[:app_usage_events]. select { Sequel.as(max.function(:id), :id) }. exclude(task_guid:...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20190617175452_add_key_prefix_to_buildpack_annotations.rb
Ruby
apache-2.0
203
main
225
Sequel.migration do change do unless self[:buildpack_annotations].columns.include?(:key_prefix) alter_table(:buildpack_annotations) do add_column :key_prefix, String, size: 253 end end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20181002165615_create_deployment_processes_table.rb
Ruby
apache-2.0
203
main
438
Sequel.migration do change do create_table :deployment_processes do VCAP::Migration.common(self) String :process_guid, size: 255 String :process_type, size: 255 String :deployment_guid, size: 255 foreign_key [:deployment_guid], :deployments, key: :guid, name: :fk_deployment_processe...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20221125134500_add_request_count_table.rb
Ruby
apache-2.0
203
main
215
Sequel.migration do change do create_table? :request_counts do primary_key :id String :user_guid index :user_guid Integer :count, default: 0 Time :valid_until end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20141212001210_update_delayed_jobs_indexes.rb
Ruby
apache-2.0
203
main
367
Sequel.migration do up do drop_index :delayed_jobs, %i[priority run_at], name: :dj add_index :delayed_jobs, %i[queue locked_at failed_at run_at], name: :delayed_jobs_reserve end down do drop_index :delayed_jobs, %i[queue locked_at failed_at run_at], name: :delayed_jobs_reserve add_index :delayed_...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20230627110500_add_priority_by_to_delayed_jobs_index.rb
Ruby
apache-2.0
203
main
400
Sequel.migration do up do drop_index :delayed_jobs, nil, name: :delayed_jobs_reserve add_index :delayed_jobs, %i[queue locked_at locked_by failed_at run_at priority], name: :delayed_jobs_reserve end down do drop_index :delayed_jobs, nil, name: :delayed_jobs_reserve add_index :delayed_jobs, %i[que...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20251121174647_add_broker_provided_metadata_to_service_instances.rb
Ruby
apache-2.0
203
main
246
Sequel.migration do change do # rubocop:disable Migration/IncludeStringSize add_column :service_instances, :broker_provided_metadata, String, size: 4096, text: true, null: true # rubocop:enable Migration/IncludeStringSize end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20161104184720_create_staging_security_groups_spaces.rb
Ruby
apache-2.0
203
main
497
Sequel.migration do change do create_table :staging_security_groups_spaces do Integer :staging_security_group_id, null: false foreign_key [:staging_security_group_id], :security_groups, name: :fk_staging_security_group_id Integer :staging_space_id, null: false foreign_key [:staging_space_...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20150407213536_add_index_to_stack_id.rb
Ruby
apache-2.0
203
main
249
Sequel.migration do up do add_index :apps, :stack_id end down do alter_table :apps do drop_foreign_key [:stack_id] drop_index :stack_id add_foreign_key [:stack_id], :stacks, name: :fk_apps_stack_id end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20140307201639_replace_service_id_on_broker_with_service_broker_id.rb
Ruby
apache-2.0
203
main
708
Sequel.migration do up do alter_table :service_dashboard_clients do add_column :service_broker_id, Integer end run <<~SQL.squish UPDATE service_dashboard_clients SET service_broker_id = ( SELECT services.service_broker_id FROM services WHERE services.u...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20260324120000_add_composite_indexes_to_events.rb
Ruby
apache-2.0
203
main
2,914
# rubocop:disable Metrics/BlockLength Sequel.migration do no_transaction # required for concurrently option on postgres up do if database_type == :postgres VCAP::Migration.with_concurrent_timeout(self) do add_index :events, %i[actee created_at guid], name: :events_actee_created_...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20191014212939_add_guid_and_timestamps_to_roles_join_tables.rb
Ruby
apache-2.0
203
main
333
Sequel.migration do change do # This is a no-op. We split this migration into 7 migrations, one for each table, to prevent deadlocks. # See https://www.pivotaltracker.com/story/show/170321550 for more info, # and https://github.com/cloudfoundry/cloud_controller_ng/issues/1133 for a similar issue + solutio...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20180515221748_create_primary_key_for_spaces_managers.rb
Ruby
apache-2.0
203
main
359
require File.expand_path('../../helpers/change_primary_key', __FILE__) Sequel.migration do up do add_primary_key_to_table(:spaces_managers, :spaces_managers_pk) end down do remove_primary_key_from_table(:spaces_managers, :spaces_managers_pkey, ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20140624232412_change_app_security_groups_to_security_groups.rb
Ruby
apache-2.0
203
main
1,335
Sequel.migration do change do rename_table(:app_security_groups, :security_groups) alter_table(:security_groups) do drop_index :guid, name: 'asg_guid_index' add_index :guid, name: 'sg_guid_index' drop_index :created_at, name: 'asg_created_at_index' add_index :created_at, name: 'sg_cr...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20130919164043_denormalize_space_and_add_org_guid_to_events.rb
Ruby
apache-2.0
203
main
1,450
Sequel.migration do up do alter_table :events do # BEFORE # # Previously `space_id` could not be null, and if a space was deleted its # related events were cascaded deleted along with it. # AFTER # # If the related space is deleted the `space_id` becomes `null`. We need ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20181101211039_drop_and_recreate_app_space_org_labels.rb
Ruby
apache-2.0
203
main
722
Sequel.migration do up do # These tables were never present in a released capi-release so it is safe to drop them drop_table(:app_labels) create_table(:app_labels) do VCAP::Migration.common(self) VCAP::Migration.labels_common(self, :app_labels, :apps) end drop_table(:org_labels) c...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20130719002215_remove_not_null_from_unique_id.rb
Ruby
apache-2.0
203
main
202
Sequel.migration do change do alter_table(:service_plans) do set_column_allow_null :unique_id end alter_table(:services) do set_column_allow_null :unique_id end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20140724185938_add_space_quota_definition_to_space.rb
Ruby
apache-2.0
203
main
232
Sequel.migration do change do alter_table(:spaces) do add_column :space_quota_definition_id, Integer add_foreign_key [:space_quota_definition_id], :space_quota_definitions, name: :fk_space_sqd_id end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20161028210215_add_default_updated_at.rb
Ruby
apache-2.0
203
main
844
Sequel.migration do change do tables_to_migrate = %i[ apps buildpack_lifecycle_data buildpacks delayed_jobs domains droplets env_groups feature_flags isolation_segments organizations packages processes quota_definitions route_bind...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20151217235335_remove_unused_package_cols.rb
Ruby
apache-2.0
203
main
997
Sequel.migration do up do drop_column :package_docker_data, :encrypted_user drop_column :package_docker_data, :user_salt drop_column :package_docker_data, :encrypted_password drop_column :package_docker_data, :password_salt drop_column :package_docker_data, :email_salt drop_column :package_doc...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20180515221706_create_primary_key_for_security_groups_spaces.rb
Ruby
apache-2.0
203
main
394
require File.expand_path('../../helpers/change_primary_key', __FILE__) Sequel.migration do up do add_primary_key_to_table(:security_groups_spaces, :security_groups_spaces_pk) end down do remove_primary_key_from_table(:security_groups_spaces, :security_groups_spaces_pkey...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20150202222559_make_metadata_column_long_varchar_on_apps.rb
Ruby
apache-2.0
203
main
266
Sequel.migration do up do alter_table :apps do set_column_type :metadata, String, size: 4096 set_column_default :metadata, '{}' end end down do alter_table :apps do set_column_type :metadata, String, text: true end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20170504210922_add_docker_creds_to_droplet.rb
Ruby
apache-2.0
203
main
234
Sequel.migration do change do add_column :droplets, :docker_receipt_username, String add_column :droplets, :docker_receipt_password_salt, String add_column :droplets, :encrypted_docker_receipt_password, String end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20250130172009_add_canary_steps_to_deployments.rb
Ruby
apache-2.0
203
main
306
Sequel.migration do up do alter_table(:deployments) do add_column :canary_steps, String, size: 4096 add_column :canary_current_step, :integer end end down do alter_table(:deployments) do drop_column :canary_steps drop_column :canary_current_step end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20230726132200_add_delayed_jobs_reserve_where_index.rb
Ruby
apache-2.0
203
main
235
Sequel.migration do up do add_index :delayed_jobs, %i[queue locked_at locked_by failed_at run_at], name: :delayed_jobs_reserve_where end down do drop_index :delayed_jobs, nil, name: :delayed_jobs_reserve_where end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20130911111938_encrypt_app_env_json.rb
Ruby
apache-2.0
203
main
820
require File.expand_path('../../../lib/cloud_controller/encryptor', __FILE__) Sequel.migration do up do self[:apps].each do |row| salt = VCAP::CloudController::Encryptor.generate_salt encrypted = VCAP::CloudController::Encryptor.encrypt(row[:environment_json], salt) self['UPDATE apps SET encryp...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20181129180059_populate_vips.rb
Ruby
apache-2.0
203
main
260
Sequel.migration do up do self[:routes].order(:id).each_with_index do |route, i| next unless self[:domains].filter(id: route[:domain_id])[:internal] self[:routes].filter(guid: route[:guid]).update(vip_offset: (i + 1).to_i) end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20170524214613_add_created_by_to_builds.rb
Ruby
apache-2.0
203
main
238
Sequel.migration do change do add_column :builds, :created_by_user_guid, :text, null: true add_column :builds, :created_by_user_name, :text, null: true add_column :builds, :created_by_user_email, :text, null: true end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20130429225754_add_salt_to_service_bindings.rb
Ruby
apache-2.0
203
main
848
require 'cloud_controller/encryptor' Sequel.migration do up do alter_table :service_bindings do add_column :salt, String end self[:service_bindings].each do |service_binding| generated_salt = VCAP::CloudController::Encryptor.generate_salt self[:service_bindings].filter(id: service_bind...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20240314131908_add_user_guid_to_jobs_table.rb
Ruby
apache-2.0
203
main
1,460
Sequel.migration do # adding an index concurrently cannot be done within a transaction no_transaction up do if database_type == :postgres add_column :jobs, :user_guid, String, size: 255, if_not_exists: true VCAP::Migration.with_concurrent_timeout(self) do add_index :jobs, :user_guid, name...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20170321205040_create_build_model.rb
Ruby
apache-2.0
203
main
555
Sequel.migration do change do create_table :builds do VCAP::Migration.common(self) String :state String :package_guid String :buildpack_receipt_buildpack_guid String :buildpack_receipt_stack_name end alter_table :droplets do add_column :build_guid, String add_ind...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20180319143620_create_service_binding_operations.rb
Ruby
apache-2.0
203
main
612
Sequel.migration do change do create_table :service_binding_operations do VCAP::Migration.timestamps(self, :service_binding_operations) Integer :service_binding_id String :state, size: 255, null: false String :type, size: 255, null: false String :description, size: 10_000 Stri...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20201013153721_add_service_instance_constraint_to_service_bindings.rb
Ruby
apache-2.0
203
main
686
Sequel.migration do up do # We are assuming with this DB migration that the service_bindings table currently # has no duplicate rows, according to the unique constraint of # (service_instance_guid, app_guid). This migration will fail otherwise. # # Please manually remove duplicate entries from the...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20201020204056_index_kpack_lifecycle_data_droplet_guid.rb
Ruby
apache-2.0
203
main
300
Sequel.migration do up do alter_table :kpack_lifecycle_data do add_index :droplet_guid, name: :kpack_lifecycle_droplet_guid_index end end down do alter_table :kpack_lifecycle_data do drop_index :droplet_guid, name: :kpack_lifecycle_droplet_guid_index end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20171013223336_remove_deprecated_v1_service_fields.rb
Ruby
apache-2.0
203
main
505
Sequel.migration do up do alter_table :services do drop_constraint :services_label_provider_index, type: :unique if @db.class.to_s.include? 'Mysql' drop_column :provider drop_column :url drop_column :version end end down do alter_table :services do add_column :provider, ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20150325224808_add_v3_attrs_to_app_usage_events.rb
Ruby
apache-2.0
203
main
216
Sequel.migration do change do add_column :app_usage_events, :parent_app_name, String add_column :app_usage_events, :parent_app_guid, String add_column :app_usage_events, :process_type, String end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20130718210849_add_tasks.rb
Ruby
apache-2.0
203
main
229
Sequel.migration do change do create_table :tasks do VCAP::Migration.common(self) Integer :app_id, null: false index :app_id foreign_key [:app_id], :apps, name: :fk_tasks_app_id end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20130430205654_add_salt_to_service_instances.rb
Ruby
apache-2.0
203
main
861
require 'cloud_controller/encryptor' Sequel.migration do up do alter_table :service_instances do add_column :salt, String end self[:service_instances].each do |service_instance| generated_salt = VCAP::CloudController::Encryptor.generate_salt self[:service_instances].filter(id: service_...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20130323005501_remove_framework_and_runtime.rb
Ruby
apache-2.0
203
main
624
# Copyright (c) 2009-2012 VMware, Inc. Sequel.migration do change do # Mysql requires us to remove foreign key constraint # before dropping column (errno 150). Sequel also # requires type=foreign_key to be present for such operations. if self.class.name.match?(/mysql/i) alter_table :apps do ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20170815233431_migrate_enable_ssh_from_processes_to_apps.rb
Ruby
apache-2.0
203
main
552
Sequel.migration do change do enabled_guids = self[:processes].where(enable_ssh: true, type: 'web').select(:guid) disabled_guids = self[:processes].where(enable_ssh: false, type: 'web').select(:guid) self[:apps].where(Sequel.lit('guid IN ?', enabled_guids)).update(enable_ssh: true) self[:apps].where(S...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20190617182135_add_key_prefix_to_build_annotations.rb
Ruby
apache-2.0
203
main
217
Sequel.migration do change do unless self[:build_annotations].columns.include?(:key_prefix) alter_table(:build_annotations) do add_column :key_prefix, String, size: 253 end end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20160601173727_add_port_to_route_mappings.rb
Ruby
apache-2.0
203
main
810
Sequel.migration do up do add_column :route_mappings, :app_port, Integer, default: 8080 alter_table :route_mappings do if @db.class.to_s.include? 'Mysql' drop_constraint(:app_guid, type: :unique) else drop_constraint(:route_mappings_app_guid_route_guid_process_type_key) end ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20180420185709_add_version_bpname_to_buildpack_lifecycle_buildpacks.rb
Ruby
apache-2.0
203
main
232
Sequel.migration do change do alter_table :buildpack_lifecycle_buildpacks do add_column :version, String, size: 255 add_column :buildpack_name, String, size: 2047 # Name given by staging callback end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20130425230435_add_crash_events.rb
Ruby
apache-2.0
203
main
477
# Copyright (c) 2009-2012 VMware, Inc. Sequel.migration do change do create_table :crash_events do VCAP::Migration.common(self) Integer :app_id, null: false String :instance_guid, null: false Integer :instance_index, null: false Integer :exit_status, null: false DateTime :tim...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20230725110800_restructure_index_for_improved_pagination_order.rb
Ruby
apache-2.0
203
main
16,862
Sequel.migration do index_migration_data = [ # CREATED AT { table: :organizations, old_index: :organizations_created_at_index, old_columns: [:created_at], new_index: :organizations_created_at_guid_index, new_columns: %i[created_at guid] }, { table: :revisions, ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20141215184824_add_locked_by_to_delayed_jobs_index.rb
Ruby
apache-2.0
203
main
457
Sequel.migration do up do drop_index :delayed_jobs, %i[queue locked_at failed_at run_at], name: :delayed_jobs_reserve add_index :delayed_jobs, %i[queue locked_at locked_by failed_at run_at], name: :delayed_jobs_reserve end down do drop_index :delayed_jobs, %i[queue locked_at locked_by failed_at run_a...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20230804183521_add_health_check_interval.rb
Ruby
apache-2.0
203
main
242
Sequel.migration do change do alter_table :processes do add_column :health_check_interval, :integer, null: true, default: nil add_column :readiness_health_check_interval, :integer, null: true, default: nil end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20200218223146_add_app_kpack_lifecycle_data.rb
Ruby
apache-2.0
203
main
279
Sequel.migration do change do alter_table :kpack_lifecycle_data do add_column :app_guid, String, size: 255, null: true add_foreign_key [:app_guid], :apps, key: :guid, name: :fk_kpack_lifecycle_app_guid set_column_allow_null :build_guid end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20180921102908_remove_uniqueness_on_index_broker_url_from_service_brokers.rb
Ruby
apache-2.0
203
main
398
Sequel.migration do up do alter_table :service_brokers do drop_index :broker_url, name: :sb_broker_url_index add_index :broker_url, name: :sb_broker_url_index, unique: false end end down do alter_table :service_brokers do drop_index :broker_url, name: :sb_broker_url_index add_...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20180515221652_create_primary_key_for_organizations_users.rb
Ruby
apache-2.0
203
main
379
require File.expand_path('../../helpers/change_primary_key', __FILE__) Sequel.migration do up do add_primary_key_to_table(:organizations_users, :organizations_users_pk) end down do remove_primary_key_from_table(:organizations_users, :organizations_users_pkey, ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20151006170705_add_port_column_to_routes_table.rb
Ruby
apache-2.0
203
main
234
Sequel.migration do change do alter_table :routes do add_column :port, Integer, null: false, default: 0 drop_index %i[host domain_id path] add_index %i[host domain_id path port], unique: true end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20191218000612_add_guid_and_timestamps_to_spaces_auditors.rb
Ruby
apache-2.0
203
main
959
Sequel.migration do up do unless self[:spaces_auditors].columns.include?(:role_guid) alter_table :spaces_auditors do add_column :role_guid, String, size: 255 add_column :created_at, :timestamp, null: false, default: Sequel::CURRENT_TIMESTAMP add_column :updated_at, :timestamp, null: ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20240709234116_add_status_updated_at_to_deployments.rb
Ruby
apache-2.0
203
main
362
Sequel.migration do up do alter_table(:deployments) do add_column :status_updated_at, DateTime, default: Sequel::CURRENT_TIMESTAMP, null: false end run 'update deployments set status_updated_at = updated_at where updated_at is not null' end down do alter_table(:deployments) do drop_co...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20151102175640_create_package_docker_data.rb
Ruby
apache-2.0
203
main
550
Sequel.migration do change do create_table :package_docker_data do VCAP::Migration.common(self, :package_docker_data) String :image String :encrypted_user String :user_salt String :encrypted_password String :password_salt String :encrypted_email String :email_sa...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20250327142351_bigint_migration_events_step1.rb
Ruby
apache-2.0
203
main
1,252
require 'database/bigint_migration' Sequel.migration do up do if database_type == :postgres && !VCAP::BigintMigration.opt_out? if VCAP::BigintMigration.table_empty?(self, :events) VCAP::BigintMigration.change_pk_to_bigint(self, :events) else VCAP::BigintMigration.add_bigint_column(sel...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20160328074419_add_previous_values_in_app_usage_events.rb
Ruby
apache-2.0
203
main
369
Sequel.migration do change do add_column :app_usage_events, :previous_state, String, default: nil add_column :app_usage_events, :previous_package_state, String, default: nil add_column :app_usage_events, :previous_memory_in_mb_per_instance, Integer, default: nil add_column :app_usage_events, :previous...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20150316184259_create_service_key_table.rb
Ruby
apache-2.0
203
main
465
Sequel.migration do change do create_table(:service_keys) do VCAP::Migration.common(self, :sk) String :name, null: false String :salt String :credentials, null: false, size: 2048 Integer :service_instance_id, null: false foreign_key [:service_instance_id], :service_instances, n...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20191218001024_fill_guid_and_timestamps_for_organizations_billing_managers.rb
Ruby
apache-2.0
203
main
313
Sequel.migration do up do self[:organizations_billing_managers].where(role_guid: nil).update( role_guid: VCAP::Migration.uuid_function(self), updated_at: Sequel::CURRENT_TIMESTAMP ) end down do # Not reversible. Rollback earlier migration to drop the columns filled here. end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20150313233039_create_apps_v3_routes.rb
Ruby
apache-2.0
203
main
252
Sequel.migration do change do create_table :apps_v3_routes do Integer :apps_v3_id index :apps_v3_id, name: :apps_routes_apps_id_v3 Integer :route_id index :route_id String :type index :type end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20130430184538_add_salt_to_service_auth_tokens.rb
Ruby
apache-2.0
203
main
825
Sequel.migration do up do alter_table :service_auth_tokens do add_column :salt, String end self[:service_auth_tokens].each do |service_auth_token| generated_salt = VCAP::CloudController::Encryptor.generate_salt self[:service_auth_tokens].filter(id: service_auth_token[:id]).update( ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20250312233355_add_scaling_columns_to_deployments.rb
Ruby
apache-2.0
203
main
431
Sequel.migration do up do alter_table(:deployments) do add_column :memory_in_mb, :integer, null: true add_column :disk_in_mb, :integer, null: true add_column :log_rate_limit_in_bytes_per_second, :integer, null: true end end down do alter_table(:deployments) do drop_column :memo...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20181031232313_create_space_labels.rb
Ruby
apache-2.0
203
main
490
Sequel.migration do change do create_table(:space_labels) do VCAP::Migration.common(self) String :space_guid, size: 255 String :key_prefix, size: 253 String :key_name, size: 63 String :value, size: 63 foreign_key [:space_guid], :spaces, key: :guid, name: :fk_space_labels_spac...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20250630170610_add_user_to_tasks.rb
Ruby
apache-2.0
203
main
321
Sequel.migration do up do alter_table :tasks do add_column :user, String, null: true, default: nil, size: 255 unless @db.schema(:tasks).map(&:first).include?(:user) end end down do alter_table :tasks do drop_column :user if @db.schema(:tasks).map(&:first).include?(:user) end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20150910221699_add_events_index.rb
Ruby
apache-2.0
203
main
304
Sequel.migration do up do self[:events].truncate add_index :events, :actee_type add_index :events, %i[timestamp id] drop_index :events, :timestamp end down do add_index :events, :timestamp drop_index :events, %i[timestamp id] drop_index :events, :actee_type end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20181204184506_create_space_annotations_table.rb
Ruby
apache-2.0
203
main
201
Sequel.migration do change do create_table(:space_annotations) do VCAP::Migration.common(self) VCAP::Migration.annotations_common(self, :space_annotations, :spaces) end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20140325171355_add_service_broker_id_index_to_service_dashboard_clients.rb
Ruby
apache-2.0
203
main
516
Sequel.migration do up do alter_table :service_dashboard_clients do set_column_allow_null :service_broker_id add_index :service_broker_id, name: :svc_dash_cli_svc_brkr_id_idx end end down do run <<~SQL.squish DELETE FROM service_dashboard_clients WHERE service_broker_id IS NULL ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20190617182203_add_key_prefix_to_route_annotations.rb
Ruby
apache-2.0
203
main
217
Sequel.migration do change do unless self[:route_annotations].columns.include?(:key_prefix) alter_table(:route_annotations) do add_column :key_prefix, String, size: 253 end end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20260323130619_add_unique_constraint_to_security_groups.rb
Ruby
apache-2.0
203
main
2,646
Sequel.migration do # rubocop:disable Metrics/BlockLength no_transaction # required for concurrently option on postgres up do transaction do duplicates = self[:security_groups].select(:name). group(:name). having { count(1) > 1 } duplicates.each do |dup| ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20210106120645_create_service_keys_metadata_tables.rb
Ruby
apache-2.0
203
main
382
Sequel.migration do change do create_table(:service_key_labels) do VCAP::Migration.common(self) VCAP::Migration.labels_common(self, :service_key_labels, :service_keys) end create_table(:service_key_annotations) do VCAP::Migration.common(self) VCAP::Migration.annotations_common(sel...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20231221123000_rename_annotations_key_column.rb
Ruby
apache-2.0
203
main
1,906
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 ser...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20140716213753_add_actee_index_to_events.rb
Ruby
apache-2.0
203
main
258
Sequel.migration do up do self[:events].truncate alter_table(:events) do add_index :actee, name: 'events_actee_index' end end down do alter_table(:events) do drop_index :actee, name: 'events_actee_index' end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20260202105042_add_state_reason_to_stacks.rb
Ruby
apache-2.0
203
main
344
Sequel.migration do up do alter_table :stacks do add_column :state_reason, String, null: true, size: 5000 unless @db.schema(:stacks).map(&:first).include?(:state_reason) end end down do alter_table :stacks do drop_column :state_reason if @db.schema(:stacks).map(&:first).include?(:state_re...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20251015071027_allow_multiple_service_bindings.rb
Ruby
apache-2.0
203
main
3,047
Sequel.migration do no_transaction # adding an index concurrently cannot be done within a transaction up do alter_table(:service_bindings) do drop_constraint(:unique_service_binding_service_instance_guid_app_guid) if @db.indexes(:service_bindings).key?(:unique_service_binding_service_instance_guid_app_gu...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20151124013630_increase_text_size_for_service_instances_tags.rb
Ruby
apache-2.0
203
main
255
Sequel.migration do up do alter_table :service_instances do set_column_type :tags, String, text: true end end down do alter_table :service_instances do set_column_type :tags, String, size: 1275, text: true end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20160802210551_add_salt_and_encrypt_buildpack.rb
Ruby
apache-2.0
203
main
1,997
Sequel.migration do up do alter_table(:buildpack_lifecycle_data) do add_column :salt, String add_column :encrypted_buildpack, String end self[:buildpack_lifecycle_data].each do |row| salt = VCAP::CloudController::Encryptor.generate_salt encrypted = VCAP::CloudController::Encryptor...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20191218000625_add_guid_and_timestamps_to_organizations_auditors.rb
Ruby
apache-2.0
203
main
1,022
Sequel.migration do up do unless self[:organizations_auditors].columns.include?(:role_guid) alter_table :organizations_auditors do add_column :role_guid, String, size: 255 add_column :created_at, :timestamp, null: false, default: Sequel::CURRENT_TIMESTAMP add_column :updated_at, :tim...