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/20131114185320_add_total_routes_to_quota_definitions.rb
Ruby
apache-2.0
203
main
374
Sequel.migration do up do default_total_routes = 1000 add_column :quota_definitions, :total_routes, :integer, null: true run("UPDATE quota_definitions SET total_routes = #{default_total_routes}") alter_table :quota_definitions do set_column_not_null :total_routes end end down do dr...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20130530173342_fix_permission_fk_problems.rb
Ruby
apache-2.0
203
main
1,646
# Copyright (c) 2009-2012 VMware, Inc. # Helper method to cleanup erroneous fk columns in permission tables def cleanup_permission_table(name, permission) name = name.to_s join_table = :"#{name.pluralize}_#{permission}" id_attr = :"#{name}_id" fk_name = :"#{name}_fk" new_fk_name = :"#{join_table}_#{name}_fk"...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20160114182148_create_tasks.rb
Ruby
apache-2.0
203
main
629
Sequel.migration do change do create_table :tasks do VCAP::Migration.common(self) String :name, case_insensitive: true, null: false String :command, null: false String :state, null: false Integer :app_id, null: false foreign_key [:app_id], :apps_v3, name: :fk_tasks_app_id ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20180515221638_create_primary_key_for_organizations_private_domains.rb
Ruby
apache-2.0
203
main
429
require File.expand_path('../../helpers/change_primary_key', __FILE__) Sequel.migration do up do add_primary_key_to_table(:organizations_private_domains, :organizations_private_domains_pk) end down do remove_primary_key_from_table(:organizations_private_domains, :organi...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20190320234126_create_service_instance_labels_table.rb
Ruby
apache-2.0
203
main
219
Sequel.migration do change do create_table(:service_instance_labels) do VCAP::Migration.common(self) VCAP::Migration.labels_common(self, :service_instance_labels, :service_instances) end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20130829221542_add_unique_index_on_service_plans_unique_id.rb
Ruby
apache-2.0
203
main
443
Sequel.migration do change do plans = select(:id, :unique_id).from(:service_plans) plans.each do |plan| next if plan[:unique_id].present? id = plan[:id] unique_id = SecureRandom.uuid run "UPDATE service_plans SET unique_id = '#{unique_id}' WHERE guid = '#{id}' AND (unique_id IS NULL O...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20160922213611_organization_isolation_segments.rb
Ruby
apache-2.0
203
main
1,034
Sequel.migration do up do create_table :organizations_isolation_segments do String :organization_guid, null: false String :isolation_segment_guid, null: false foreign_key [:organization_guid], :organizations, key: :guid, name: :fk_organization_guid foreign_key [:isolation_segment_guid], :...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20190617181924_add_key_prefix_to_space_annotations.rb
Ruby
apache-2.0
203
main
217
Sequel.migration do change do unless self[:space_annotations].columns.include?(:key_prefix) alter_table(:space_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/20250729142800_bigint_migration_delayed_jobs_step1.rb
Ruby
apache-2.0
203
main
1,261
require 'database/bigint_migration' table = :delayed_jobs Sequel.migration do up do if database_type == :postgres && !VCAP::BigintMigration.opt_out? if VCAP::BigintMigration.table_empty?(self, table) VCAP::BigintMigration.change_pk_to_bigint(self, table) else VCAP::BigintMigration.ad...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20141210194308_add_name_col_v3_apps.rb
Ruby
apache-2.0
203
main
577
Sequel.migration do up do self[:apps_v3].truncate alter_table(:apps_v3) do add_column :name, String add_index :name add_index %i[space_guid name], unique: true set_column_type :name, String, case_insensitive: true end if self.class.name.match?(/mysql/i) table_name = table...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20140609180716_add_staging_default_to_app_security_groups.rb
Ruby
apache-2.0
203
main
230
Sequel.migration do change do alter_table :app_security_groups do add_column :staging_default, TrueClass, default: false, required: true add_index :staging_default, name: 'asgs_staging_default' end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20190617170734_add_key_prefix_to_package_annotations.rb
Ruby
apache-2.0
203
main
221
Sequel.migration do change do unless self[:package_annotations].columns.include?(:key_prefix) alter_table(:package_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/20190116220909_create_revision_annotations_table.rb
Ruby
apache-2.0
203
main
210
Sequel.migration do change do create_table(:revision_annotations) do VCAP::Migration.common(self) VCAP::Migration.annotations_common(self, :revision_annotations, :revisions) end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20130628184803_delete_kind_from_service_instances.rb
Ruby
apache-2.0
203
main
217
Sequel.migration do up do drop_column :service_instances, :kind end down do add_column :service_instances, :kind, String, null: false, default: 'VCAP::CloudController::ManagedServiceInstance' end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20150122183634_create_v3_droplets.rb
Ruby
apache-2.0
203
main
337
Sequel.migration do change do create_table :v3_droplets do VCAP::Migration.common(self) String :state, null: false String :buildpack_guid index :buildpack_guid, name: 'bp_guid' String :package_guid index :package_guid String :droplet_hash String :buildpack_git_url ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20130131184954_new_initial_schema.rb
Ruby
apache-2.0
203
main
10,302
# Copyright (c) 2009-2012 VMware, Inc. # This is a squash of all previous migrations for cc. This needed to be done # to support mysql as a database option for cc. # # As the previous set of migrations evolved, they ended up droping columns # as the schema was changed to support new/changing feature sets. However, #...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20160919172325_remove_droplet_fk_constraint_for_tasks.rb
Ruby
apache-2.0
203
main
279
Sequel.migration do up do alter_table :tasks do drop_foreign_key [:droplet_guid], name: :fk_tasks_droplet_guid end end down do alter_table :tasks do foreign_key [:droplet_guid], :droplets, key: :guid, name: :fk_tasks_droplet_guid end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20150204012903_drop_state_and_state_description.rb
Ruby
apache-2.0
203
main
337
Sequel.migration do up do alter_table :service_instances do drop_column :state drop_column :state_description end end down do alter_table :service_instances do add_column :service_instances, :state, String add_column :service_instances, :state_description, String, text: true ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20130529183520_add_not_deleted_column.rb
Ruby
apache-2.0
203
main
545
# Unique index in MySQL allows duplicate null values i.e. one null # value is not the same as another. This means that we cannot really # use the tuple: [:space_id, :name, :deleted_at] as a unique index # because deleted_at is null when apps are not deleted, and MySQL # allows duplicate not-deleted apps in the table. S...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20181107191728_add_revisions.rb
Ruby
apache-2.0
203
main
379
Sequel.migration do change do create_table(:revisions) do VCAP::Migration.common(self) String :app_guid, size: 255 foreign_key [:app_guid], :apps, key: :guid, name: :fk_revision_app_guid index [:app_guid], name: :fk_revision_app_guid_index end alter_table(:processes) do add_...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20130328225143_add_unique_id_to_services.rb
Ruby
apache-2.0
203
main
479
# Copyright (c) 2009-2012 VMware, Inc. Sequel.migration do change do alter_table :services do add_column :unique_id, String add_index :unique_id, unique: true end if self.class.name.match?(/mysql/i) run "UPDATE services SET unique_id=CONCAT(provider, '_', label)" else run "U...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20181219235744_create_package_annotations_table.rb
Ruby
apache-2.0
203
main
207
Sequel.migration do change do create_table(:package_annotations) do VCAP::Migration.common(self) VCAP::Migration.annotations_common(self, :package_annotations, :packages) end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20191014233211_fill_guid_and_timestamps_for_roles_join_tables.rb
Ruby
apache-2.0
203
main
433
Sequel.migration do up 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 + solution. ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20250304215542_add_web_instances_to_deployments.rb
Ruby
apache-2.0
203
main
223
Sequel.migration do up do alter_table(:deployments) do add_column :web_instances, :integer, null: true end end down do alter_table(:deployments) do drop_column :web_instances end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20220502214949_create_route_shares.rb
Ruby
apache-2.0
203
main
489
Sequel.migration do change do create_table :route_shares do String :route_guid, null: false, size: 255 String :target_space_guid, null: false, size: 255 foreign_key [:route_guid], :routes, key: :guid, name: :fk_route_guid, on_delete: :cascade foreign_key [:target_space_guid], :spaces, key...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20240619161000_add_cnb_lifecycle_credentials.rb
Ruby
apache-2.0
203
main
929
Sequel.migration do up do # rubocop:disable Migration/IncludeStringSize add_column :cnb_lifecycle_data, :encrypted_registry_credentials_json, String, if_not_exists: true # rubocop:enable Migration/IncludeStringSize add_column :cnb_lifecycle_data, :encrypted_registry_credentials_json_salt, String, size...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20180927105539_add_broker_name_and_guid_to_service_usage_event.rb
Ruby
apache-2.0
203
main
445
Sequel.migration do change do # As service broker name is stored as 'String' (with no length # limit specified) in the service_brokers table, we have to use the same # field type here. # For the guid we have control, so we explicitly set a limit. add_column :service_usage_events, :service_broker_...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20131002170606_create_droplets.rb
Ruby
apache-2.0
203
main
370
Sequel.migration do up do create_table :droplets do VCAP::Migration.common(self) Integer :app_id, null: false String :droplet_hash, null: false index :app_id end # run "INSERT INTO droplets (app_id, droplet_hash) SELECT id, droplet_hash FROM apps WHERE droplet_hash IS NOT NULL" ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20150514190458_fix_mysql_collations.rb
Ruby
apache-2.0
203
main
2,105
Sequel.migration do up do case_insensitive_columns = { domains: [:name], apps_v3: [:name], apps: [:name], organizations: [:name], quota_definitions: [:name], routes: %i[host path], service_auth_tokens: %i[label provider], service_plans: [:name], services: %i[l...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20191218001028_fill_guid_and_timestamps_for_organizations_managers.rb
Ruby
apache-2.0
203
main
305
Sequel.migration do up do self[:organizations_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/20181112222754_add_version_to_revisions.rb
Ruby
apache-2.0
203
main
214
Sequel.migration do change do alter_table(:revisions) do add_column :version, Integer, default: 1 end alter_table(:deployments) do add_column :revision_version, Integer end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20180515221803_create_primary_key_for_staging_security_groups_spaces.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(:staging_security_groups_spaces, :staging_security_groups_spaces_pk) end down do remove_primary_key_from_table(:staging_security_groups_spaces, :sta...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20160817214144_space_isolation_segment_association.rb
Ruby
apache-2.0
203
main
695
Sequel.migration do up do collate_opts = {} collate_opts[:collate] = :utf8_bin if self.class.name.match?(/mysql/i) alter_table :isolation_segments do if self.class.name.match?(/mysql/i) table_name = tables.find { |t| t =~ /isolation_segments/ } run "ALTER TABLE `#{table_name}` CONVE...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20190905131313_create_service_broker_states.rb
Ruby
apache-2.0
203
main
374
Sequel.migration do change do create_table(:service_broker_states) do VCAP::Migration.common(self) String :state, size: 50, null: false Integer :service_broker_id, null: false foreign_key :service_broker_id, :service_brokers, name: :fk_service_brokers_id index [:service_broker_id],...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20130821333222_create_buildpacks_table.rb
Ruby
apache-2.0
203
main
238
Sequel.migration do change do create_table :buildpacks do VCAP::Migration.common(self) String :name, null: false String :key Integer :priority, null: false index :name, unique: true end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20130919211247_add_sequel_delayed_job.rb
Ruby
apache-2.0
203
main
511
Sequel.migration do up do drop_table?(:ar_delayed_jobs) create_table :delayed_jobs do VCAP::Migration.common(self, :dj) Integer :priority, default: 0 Integer :attempts, default: 0 String :handler, text: true String :last_error, text: true Time :run_at Time :locked_a...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20191218000633_add_guid_and_timestamps_to_organizations_managers.rb
Ruby
apache-2.0
203
main
1,022
Sequel.migration do up do unless self[:organizations_managers].columns.include?(:role_guid) alter_table :organizations_managers do add_column :role_guid, String, size: 255 add_column :created_at, :timestamp, null: false, default: Sequel::CURRENT_TIMESTAMP add_column :updated_at, :tim...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20230720134916_add_readiness_health_checks_to_processes.rb
Ruby
apache-2.0
203
main
336
Sequel.migration do change do alter_table :processes do add_column :readiness_health_check_http_endpoint, String, size: 2048 add_column :readiness_health_check_invocation_timeout, :integer, null: true, default: nil add_column :readiness_health_check_type, String, size: 255, default: 'process' ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20180726120275_clear_process_command_for_buildpacks.rb
Ruby
apache-2.0
203
main
400
Sequel.migration do up do # this migration has been blanked out because it did not take into account # process.metadata['command'] # 20180813221823_clear_process_command_and_metadata_command.rb is a # re-implementation of this migration that will work for environments that have # run this migrati...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20250603103400_bigint_migration_events_step3a.rb
Ruby
apache-2.0
203
main
977
require 'database/bigint_migration' Sequel.migration do no_transaction up do if database_type == :postgres && !VCAP::BigintMigration.migration_completed?(self, :events) && !VCAP::BigintMigration.migration_skipped?(self, :events) transaction do VCAP::BigintMigration.add_check_constraint(self, :ev...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20240229113008_drop_annotations_and_labels_migration_views.rb
Ruby
apache-2.0
203
main
1,064
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/20231205143526_remove_deployments_with_degenerate.rb
Ruby
apache-2.0
203
main
567
Sequel.migration do up do degenerate_records = self[:deployments].where(status_reason: 'DEGENERATE') if degenerate_records.count > 0 guids_dataset = degenerate_records.select(:guid) self[:deployment_processes].where(deployment_guid: guids_dataset).delete self[:deployment_labels].where(resou...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20191218000620_add_guid_and_timestamps_to_spaces_developers.rb
Ruby
apache-2.0
203
main
977
Sequel.migration do up do unless self[:spaces_developers].columns.include?(:role_guid) alter_table :spaces_developers do add_column :role_guid, String, size: 255 add_column :created_at, :timestamp, null: false, default: Sequel::CURRENT_TIMESTAMP add_column :updated_at, :timestamp, nu...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20160504214134_increase_volume_mounts_size.rb
Ruby
apache-2.0
203
main
247
Sequel.migration do up do alter_table :service_bindings do set_column_type :volume_mounts, String, text: true end end down do alter_table :service_bindings do set_column_type :volume_mounts, String end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20250610212414_add_user_to_processes.rb
Ruby
apache-2.0
203
main
337
Sequel.migration do up do alter_table :processes do add_column :user, String, null: true, default: nil, size: 255 unless @db.schema(:processes).map(&:first).include?(:user) end end down do alter_table :processes do drop_column :user if @db.schema(:processes).map(&:first).include?(:user) ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20241016118000_drop_unique_constraint_quota_definitions_name_key.rb
Ruby
apache-2.0
203
main
1,149
Sequel.migration do up do if database_type == :mysql if indexes(:quota_definitions).include?(:name) alter_table :quota_definitions do # rubocop:disable Sequel/ConcurrentIndex drop_index :name, name: :name # rubocop:enable Sequel/ConcurrentIndex end end ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20190923131251_create_job_warnings_table.rb
Ruby
apache-2.0
203
main
304
Sequel.migration do change do create_table(:job_warnings) do VCAP::Migration.common(self) String :detail, size: 16_000, null: false Integer :job_id, null: false foreign_key :job_id, :jobs, name: :fk_jobs_id index [:job_id], name: :fk_jobs_id_index end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20150528183140_increase_service_instance_tags_column_length.rb
Ruby
apache-2.0
203
main
243
Sequel.migration do up do alter_table :service_instances do set_column_type :tags, String, size: 1275, text: true end end down do alter_table :service_instances do set_column_type :tags, String end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20170630224921_create_buildpack_lifecycle_buildpacks.rb
Ruby
apache-2.0
203
main
555
Sequel.migration do change do create_table :buildpack_lifecycle_buildpacks do VCAP::Migration.common(self, :buildpack_lifecycle_buildpacks) String :admin_buildpack_name String :encrypted_buildpack_url, size: 16_000 String :encrypted_buildpack_url_salt String :buildpack_lifecycle_dat...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20150625213234_create_service_instance_dashboard_clients.rb
Ruby
apache-2.0
203
main
419
Sequel.migration do change do create_table :service_instance_dashboard_clients do primary_key :id VCAP::Migration.timestamps(self, 's_i_d_clients') String :uaa_id, null: false Integer :managed_service_instance_id index :uaa_id, unique: true, name: 's_i_d_clients_uaa_id_unique' ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20190617181245_add_key_prefix_to_task_annotations.rb
Ruby
apache-2.0
203
main
215
Sequel.migration do change do unless self[:task_annotations].columns.include?(:key_prefix) alter_table(:task_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/20140707180618_truncate_securitygroups.rb
Ruby
apache-2.0
203
main
390
Sequel.migration do change do alter_table(:security_groups_spaces) do drop_foreign_key [:security_group_id], name: :fk_security_group_id end self[:security_groups_spaces].truncate self[:security_groups].truncate alter_table(:security_groups_spaces) do add_foreign_key [:security_group...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20190319220026_create_sidecars.rb
Ruby
apache-2.0
203
main
754
Sequel.migration do change do create_table :sidecars do VCAP::Migration.common(self) String :name, size: 255, null: false String :command, size: 4096, null: false String :app_guid, size: 255, null: false foreign_key [:app_guid], :apps, key: :guid, name: :fk_sidecar_app_guid ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20190531214252_create_route_metadata_tables.rb
Ruby
apache-2.0
203
main
346
Sequel.migration do change do create_table(:route_labels) do VCAP::Migration.common(self) VCAP::Migration.labels_common(self, :route_labels, :routes) end create_table(:route_annotations) do VCAP::Migration.common(self) VCAP::Migration.annotations_common(self, :route_annotations, :...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20210427221541_create_spaces_application_supporters_table.rb
Ruby
apache-2.0
203
main
934
Sequel.migration do change do create_table :spaces_application_supporters do primary_key :id, name: :spaces_application_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...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20140826170851_add_salt_and_encrypt_env_group_vars.rb
Ruby
apache-2.0
203
main
985
Sequel.migration do up do alter_table(:env_groups) do add_column :salt, String set_column_allow_null(:environment_json) set_column_default(:environment_json, nil) set_column_type(:environment_json, 'text') end self[:env_groups].each do |row| salt = VCAP::CloudController::Enc...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20170719183350_add_indices_to_service_usage_events.rb
Ruby
apache-2.0
203
main
265
Sequel.migration do change do alter_table :service_usage_events do add_index :service_guid, name: :service_usage_events_service_guid_index add_index :service_instance_type, name: :service_usage_events_service_instance_type_index end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20170609220018_orphaned_blob_index_on_key_and_type.rb
Ruby
apache-2.0
203
main
781
Sequel.migration do change do # blob_key unique constraint was added without a name, so mysql and postgres will name them differently if self.class.name.match?(/mysql/i) alter_table :orphaned_blobs do drop_index :blob_key, name: :blob_key, type: :unique end elsif self.class.name.match?...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20180522211345_add_webish_process_to_deployments.rb
Ruby
apache-2.0
203
main
233
Sequel.migration do up do alter_table(:deployments) do add_column :webish_process_guid, String, size: 255 end end down do alter_table(:deployments) do drop_column :webish_process_guid end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20240820070742_add_jobs_user_guid_state_index.rb
Ruby
apache-2.0
203
main
849
Sequel.migration do # adding an index concurrently cannot be done within a transaction no_transaction up do if database_type == :postgres VCAP::Migration.with_concurrent_timeout(self) do drop_index :jobs, :user_guid, name: :jobs_user_guid_index, if_exists: true, concurrently: true add_i...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20131024203451_use_text_for_metadata_in_events.rb
Ruby
apache-2.0
203
main
685
Sequel.migration do up do # Migrations send missing methods to an instance of Sequel::Database. # All the old data in the events table is considered invalid, so chop it off. self[:events].truncate alter_table(:events) do set_column_allow_null :metadata set_column_default :metadata, nil ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20220802160500_index_syslog_drain_url.rb
Ruby
apache-2.0
203
main
335
Sequel.migration do up do alter_table :service_bindings do add_full_text_index :syslog_drain_url, name: :service_bindings_syslog_drain_url_index, unique: false end end down do alter_table :service_bindings do drop_index :syslog_drain_url, name: :service_bindings_syslog_drain_url_index ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20140220184651_remove_trial_db_allowed.rb
Ruby
apache-2.0
203
main
245
Sequel.migration do up do alter_table :quota_definitions do drop_column :trial_db_allowed end end down do alter_table :quota_definitions do add_column :trial_db_allowed, TrueClass, default: false end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20130318175647_convert_mysql_text_types_for_services.rb
Ruby
apache-2.0
203
main
588
# Copyright (c) 2009-2012 VMware, Inc. Sequel.migration do up do # Sequel does not support a way to create a larger than 65k text column with mysql adapter if self.class.name.match?(/mysql/i) run 'ALTER TABLE `services` CHANGE COLUMN `extra` `extra` MEDIUMTEXT' run 'ALTER TABLE `service_plans` CH...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20191218001034_fill_guid_and_timestamps_for_organizations_users.rb
Ruby
apache-2.0
203
main
302
Sequel.migration do up do self[:organizations_users].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/20220805145100_add_delete_on_cascade_to_fk_svc_inst_op_svc_instance_id.rb
Ruby
apache-2.0
203
main
744
Sequel.migration do # Add DELETE CASCADE to foreign key fk_svc_inst_op_svc_instance_id to ensure that 'service instance operations' # are deleted together with the referenced 'service instance'. up do alter_table :service_instance_operations do drop_constraint :fk_svc_inst_op_svc_instance_id, type: :fo...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20151123232837_use_text_fields_for_service_tags.rb
Ruby
apache-2.0
203
main
221
Sequel.migration do up do alter_table :services do set_column_type :tags, String, text: true end end down do alter_table :services do set_column_type :tags, 'varchar(255)' end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20250729143000_bigint_migration_app_usage_events_step1.rb
Ruby
apache-2.0
203
main
1,265
require 'database/bigint_migration' table = :app_usage_events Sequel.migration do up do if database_type == :postgres && !VCAP::BigintMigration.opt_out? if VCAP::BigintMigration.table_empty?(self, table) VCAP::BigintMigration.change_pk_to_bigint(self, table) else VCAP::BigintMigratio...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20150904215710_create_route_binding_table.rb
Ruby
apache-2.0
203
main
219
Sequel.migration do change do create_table :route_bindings do VCAP::Migration.common(self) foreign_key :route_id, :routes foreign_key :service_instance_id, :service_instances end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20140819094032_add_environment_variable_groups.rb
Ruby
apache-2.0
203
main
248
Sequel.migration do change do create_table :env_groups do VCAP::Migration.common(self, :evg) String :name, null: false String :environment_json, default: '{}', null: false index :name, unique: true end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20211102133700_add_service_instance_id_index_to_service_keys.rb
Ruby
apache-2.0
203
main
278
Sequel.migration do up do alter_table :service_keys do add_index :service_instance_id, name: :sk_svc_instance_id_index end end down do alter_table :service_keys do drop_index :service_instance_id, name: :sk_svc_instance_id_index end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20250729142900_bigint_migration_jobs_step1.rb
Ruby
apache-2.0
203
main
1,253
require 'database/bigint_migration' table = :jobs Sequel.migration do up do if database_type == :postgres && !VCAP::BigintMigration.opt_out? if VCAP::BigintMigration.table_empty?(self, table) VCAP::BigintMigration.change_pk_to_bigint(self, table) else VCAP::BigintMigration.add_bigint...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20180925150440_remove_services_label_provider_index.rb
Ruby
apache-2.0
203
main
269
Sequel.migration do up do if indexes(:services)[:services_label_provider_index] alter_table :services do drop_index :label, name: :services_label_provider_index end end end down do # This migration cannot be rolled back end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20171120214253_remove_buildpack_receipt_stack_name_from_droplets.rb
Ruby
apache-2.0
203
main
243
Sequel.migration do up do alter_table :droplets do drop_column :buildpack_receipt_stack_name end end down do alter_table :droplets do add_column :buildpack_receipt_stack_name, String, size: 255 end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20190128233032_create_buildpack_metadata_tables.rb
Ruby
apache-2.0
203
main
370
Sequel.migration do change do create_table(:buildpack_annotations) do VCAP::Migration.common(self) VCAP::Migration.annotations_common(self, :buildpack_annotations, :buildpacks) end create_table(:buildpack_labels) do VCAP::Migration.common(self) VCAP::Migration.labels_common(self, ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20130426175420_add_can_access_non_public_plans_to_orgs.rb
Ruby
apache-2.0
203
main
209
# Copyright (c) 2009-2012 VMware, Inc. Sequel.migration do change do alter_table :organizations do add_column :can_access_non_public_plans, :boolean, default: false, null: false end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20151222182812_create_v3_service_bindings.rb
Ruby
apache-2.0
203
main
605
Sequel.migration do change do create_table :v3_service_bindings do VCAP::Migration.common(self) String :credentials, text: true, null: false, size: 2048 String :salt String :syslog_drain_url String :type, null: false Integer :app_id, null: false foreign_key [:app_id],...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20200121104723_create_service_offering_metadata.rb
Ruby
apache-2.0
203
main
394
Sequel.migration do change do create_table(:service_offering_labels) do VCAP::Migration.common(self) VCAP::Migration.labels_common(self, :service_offering_labels, :services) end create_table(:service_offering_annotations) do VCAP::Migration.common(self) VCAP::Migration.annotations...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20191218000629_add_guid_and_timestamps_to_organizations_billing_managers.rb
Ruby
apache-2.0
203
main
1,094
Sequel.migration do up do unless self[:organizations_billing_managers].columns.include?(:role_guid) alter_table :organizations_billing_managers do add_column :role_guid, String, size: 255 add_column :created_at, :timestamp, null: false, default: Sequel::CURRENT_TIMESTAMP add_column :...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20170502181209_add_fk_apps_space_guid.rb
Ruby
apache-2.0
203
main
777
# If this migration fails, it is likely because the environment has an app without an associated space. # To resolve this issue, update each app's space_guid to the guid of an existing space. # # 1) Find the offending apps' guids: SELECT guid FROM apps WHERE space_guid NOT IN (SELECT guid FROM spaces); # 2) Get the gui...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20190123184851_add_environment_variables_to_revisions.rb
Ruby
apache-2.0
203
main
253
Sequel.migration do change do alter_table(:revisions) do add_column :encrypted_environment_variables, String, size: 16_000 add_column :salt, String, size: 255 add_column :encryption_key_label, String, size: 255 end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20180917222717_create_encryption_key_sentinels_table.rb
Ruby
apache-2.0
203
main
365
Sequel.migration do change do create_table :encryption_key_sentinels do VCAP::Migration.common(self) String :expected_value, size: 255 String :encrypted_value, size: 255 String :encryption_key_label, size: 255, unique: true, unique_constraint_name: :encryption_key_sentinels_label_index ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20190502172509_create_domain_metadata_tables.rb
Ruby
apache-2.0
203
main
352
Sequel.migration do change do create_table(:domain_labels) do VCAP::Migration.common(self) VCAP::Migration.labels_common(self, :domain_labels, :domains) end create_table(:domain_annotations) do VCAP::Migration.common(self) VCAP::Migration.annotations_common(self, :domain_annotatio...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20251117123719_add_state_to_stacks.rb
Ruby
apache-2.0
203
main
335
Sequel.migration do up do alter_table :stacks do add_column :state, String, null: false, default: 'ACTIVE', size: 255 unless @db.schema(:stacks).map(&:first).include?(:state) end end down do alter_table :stacks do drop_column :state if @db.schema(:stacks).map(&:first).include?(:state) ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20131217175551_create_app_usage_events.rb
Ruby
apache-2.0
203
main
565
Sequel.migration do change do create_table :app_usage_events do primary_key :id VCAP::Migration.guid(self, nil) Timestamp :created_at, null: false index :created_at, name: :usage_events_created_at_index Integer :instance_count, null: false Integer :memory_in_mb_per_instance, nu...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20140305230940_create_service_dashboard_client.rb
Ruby
apache-2.0
203
main
440
Sequel.migration do change do create_table :service_dashboard_clients do primary_key :id VCAP::Migration.timestamps(self, 's_d_clients') String :service_id_on_broker, null: false String :uaa_id, null: false index :uaa_id, unique: true, name: 's_d_clients_...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20190320234146_create_service_instance_annotations_table.rb
Ruby
apache-2.0
203
main
234
Sequel.migration do change do create_table(:service_instance_annotations) do VCAP::Migration.common(self) VCAP::Migration.annotations_common(self, :service_instance_annotations, :service_instances) end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20220822224900_add_log_rate_limit.rb
Ruby
apache-2.0
203
main
455
Sequel.migration do change do add_column :quota_definitions, :log_rate_limit, :Bignum, null: false, default: -1 add_column :space_quota_definitions, :log_rate_limit, :Bignum, null: false, default: -1 add_column :processes, :log_rate_limit, :Bignum, null: false, default: -1 add_column :tasks, :log_rate...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20231016094900_microsecond_timestamp_msql_asg_update.rb
Ruby
apache-2.0
203
main
645
Sequel.migration do up do MIN_SERVER_VERSION = 50_605 raise "Unsupported MySQL version #{server_version}, required >= #{MIN_SERVER_VERSION}" if server_version < MIN_SERVER_VERSION if self.class.name.match?(/mysql/i) run <<~SQL.squish ALTER TABLE asg_timestamps MODIFY last_update TIMESTAMP(6...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20210105151532_create_service_bindings_metadata_tables.rb
Ruby
apache-2.0
203
main
406
Sequel.migration do change do create_table(:service_binding_labels) do VCAP::Migration.common(self) VCAP::Migration.labels_common(self, :service_binding_labels, :service_bindings) end create_table(:service_binding_annotations) do VCAP::Migration.common(self) VCAP::Migration.annota...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20130814211636_add_secure_token_to_tasks.rb
Ruby
apache-2.0
203
main
263
Sequel.migration do change do alter_table(:tasks) do add_column :salt, String add_column :secure_token, String end run 'ALTER TABLE `tasks` CHANGE COLUMN `secure_token` `secure_token` TEXT' if self.class.name.match?(/mysql/i) end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20191218001019_fill_guid_and_timestamps_for_organizations_auditors.rb
Ruby
apache-2.0
203
main
305
Sequel.migration do up do self[:organizations_auditors].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/20241105000000_add_options_to_route.rb
Ruby
apache-2.0
203
main
214
Sequel.migration do up do alter_table(:routes) do add_column :options, String, size: 4096, default: '{}' end end down do alter_table(:routes) do drop_column :options end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20180924142348_remove_uniqueness_on_index_unique_id_from_services.rb
Ruby
apache-2.0
203
main
334
Sequel.migration do up do alter_table :services do drop_index :unique_id add_index :unique_id, name: :services_unique_id_index, unique: false end end down do alter_table :services do drop_index :unique_id add_index :unique_id, name: :services_unique_id_index, unique: true ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20170719182821_add_indices_to_service_bindings.rb
Ruby
apache-2.0
203
main
245
Sequel.migration do change do alter_table :service_bindings do add_index :app_guid, name: :service_bindings_app_guid_index add_index :service_instance_guid, name: :service_bindings_service_instance_guid_index end end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20150127013821_add_events_index.rb
Ruby
apache-2.0
203
main
211
Sequel.migration do up do add_index :events, :space_guid add_index :events, :organization_guid end down do drop_index :events, :space_guid drop_index :events, :organization_guid end end
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20260323092954_add_unique_constraint_to_sidecars.rb
Ruby
apache-2.0
203
main
2,016
Sequel.migration do no_transaction # required for concurrently option on postgres up do transaction do duplicates = self[:sidecars]. select(:app_guid, :name). group(:app_guid, :name). having { count(1) > 1 } duplicates.each do |dup| ...
github
cloudfoundry/cloud_controller_ng
https://github.com/cloudfoundry/cloud_controller_ng
db/migrations/20230822173000_add_migration_views_for_annotations.rb
Ruby
apache-2.0
203
main
966
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/20190617181111_add_key_prefix_to_app_annotations.rb
Ruby
apache-2.0
203
main
213
Sequel.migration do change do unless self[:app_annotations].columns.include?(:key_prefix) alter_table(:app_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/20180502232322_add_stack_to_buildpack.rb
Ruby
apache-2.0
203
main
469
Sequel.migration do up do alter_table(:buildpacks) do add_column :stack, String, size: 255, null: true drop_index :name, unique: true add_index %i[name stack], unique: true, name: :unique_name_and_stack end end down do alter_table(:buildpacks) do drop_index %i[name stack], uni...