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 | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20251020012947_create_tariffs.rb | Ruby | mit | 95 | develop | 479 | class CreateTariffs < ActiveRecord::Migration[8.0]
def change
create_table :tariffs, id: :uuid do |t|
t.references :carrier, null: false, foreign_key: { on_delete: :cascade }, type: :uuid
t.string :category, null: false
t.decimal :rate_cents, null: false, precision: 10, scale: 4, default: 0
... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20250922064822_add_initiation_queued_at_to_phone_calls.rb | Ruby | mit | 95 | develop | 314 | class AddInitiationQueuedAtToPhoneCalls < ActiveRecord::Migration[8.0]
disable_ddl_transaction!
def change
add_column :phone_calls, :initiation_queued_at, :datetime
add_index :phone_calls, [ :status, :created_at, :initiation_queued_at ], where: "status = 'queued'", algorithm: :concurrently
end
end |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20220623053632_create_error_logs.rb | Ruby | mit | 95 | develop | 425 | class CreateErrorLogs < ActiveRecord::Migration[7.0]
def change
create_table :error_logs, id: :uuid do |t|
t.references :carrier, type: :uuid, null: true, foreign_key: true
t.references :account, type: :uuid, null: true, foreign_key: true
t.string :error_message, null: false
t.bigserial :... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20251019041324_create_destination_groups.rb | Ruby | mit | 95 | develop | 614 | class CreateDestinationGroups < ActiveRecord::Migration[8.0]
def change
create_table :destination_groups, id: :uuid do |t|
t.references :carrier, null: false, foreign_key: { on_delete: :cascade }, type: :uuid
t.citext :name, null: false
t.boolean :catch_all, null: false, default: false
t.b... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20251023035541_create_tariff_plan_tiers.rb | Ruby | mit | 95 | develop | 724 | class CreateTariffPlanTiers < ActiveRecord::Migration[8.0]
def change
create_table :tariff_plan_tiers, id: :uuid do |t|
t.references :plan, null: false, foreign_key: { to_table: :tariff_plans, on_delete: :cascade }, type: :uuid, index: false
t.references :schedule, null: false, foreign_key: { to_table... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20251026042728_add_default_tariff_package_to_carriers.rb | Ruby | mit | 95 | develop | 297 | class AddDefaultTariffPackageToCarriers < ActiveRecord::Migration[8.1]
def change
add_reference(
:carriers,
:default_tariff_package,
null: true,
type: :uuid,
foreign_key: {
to_table: :tariff_packages,
on_delete: :nullify
}
)
end
end |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20220423010410_create_interactions.rb | Ruby | mit | 95 | develop | 827 | class CreateInteractions < ActiveRecord::Migration[7.0]
def change
create_table :interactions, id: :uuid do |t|
t.references :interactable,
polymorphic: true,
type: :uuid,
null: false,
index: { unique: true }
t.references :ca... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20210525084315_create_exports.rb | Ruby | mit | 95 | develop | 487 | class CreateExports < ActiveRecord::Migration[6.1]
def change
create_table :exports, id: :uuid do |t|
t.references :user, type: :uuid, null: false, foreign_key: true
t.jsonb :filter_params, null: false, default: {}
t.jsonb :scoped_to, null: false, default: {}
t.string :name, null: false
... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20220916033653_create_sip_trunks.rb | Ruby | mit | 95 | develop | 895 | class CreateSIPTrunks < ActiveRecord::Migration[7.0]
def change
create_table :sip_trunks, id: :uuid do |t|
t.references :carrier, type: :uuid, null: false, foreign_key: true
t.string :name, null: false
t.inet :inbound_source_ip, null: true
t.string :inbound_trunk_prefix_replacement, null... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20220426084955_remove_old_refile_fields.rb | Ruby | mit | 95 | develop | 325 | class RemoveOldRefileFields < ActiveRecord::Migration[7.0]
def change
remove_column :call_data_records, :file_id, :string
remove_column :call_data_records, :file_filename, :string
remove_column :call_data_records, :file_size, :integer
remove_column :call_data_records, :file_content_type, :string
end... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20260126112656_rename_price_to_price_cents_on_messages_and_phone_calls.rb | Ruby | mit | 95 | develop | 502 | class RenamePriceToPriceCentsOnMessagesAndPhoneCalls < ActiveRecord::Migration[8.1]
disable_ddl_transaction!
def change
rename_column :messages, :price, :price_cents
rename_column :phone_calls, :price, :price_cents
add_index(:messages, :price_cents, algorithm: :concurrently)
add_index(:messages, :p... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20220425071805_add_beneficiary_country_code_and_beneficiary_fingerprint_to_phone_calls.rb | Ruby | mit | 95 | develop | 358 | class AddBeneficiaryCountryCodeAndBeneficiaryFingerprintToPhoneCalls < ActiveRecord::Migration[7.0]
def change
add_column :phone_calls, :beneficiary_country_code, :string
add_column :phone_calls, :beneficiary_fingerprint, :string
add_index :phone_calls, :beneficiary_fingerprint
add_index :phone_calls... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20220412065943_add_enabled_to_phone_numbers.rb | Ruby | mit | 95 | develop | 202 | class AddEnabledToPhoneNumbers < ActiveRecord::Migration[7.0]
def change
add_column :phone_numbers, :enabled, :boolean, default: true, null: false
add_index :phone_numbers, :enabled
end
end |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20240423105227_create_phone_number_plans.rb | Ruby | mit | 95 | develop | 856 | class CreatePhoneNumberPlans < ActiveRecord::Migration[7.1]
def change
create_table :phone_number_plans, id: :uuid do |t|
t.references(:phone_number, type: :uuid, foreign_key: { on_delete: :nullify })
t.references(:carrier, type: :uuid, foreign_key: true)
t.references(:account, type: :uuid, fore... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20251020094506_create_tariff_schedules.rb | Ruby | mit | 95 | develop | 523 | class CreateTariffSchedules < ActiveRecord::Migration[8.0]
def change
create_table :tariff_schedules, id: :uuid do |t|
t.references :carrier, null: false, foreign_key: { on_delete: :cascade }, type: :uuid
t.string :category, null: false
t.citext :name, null: false
t.text :description
... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20240219073119_create_trial_interactions_credit_vouchers.rb | Ruby | mit | 95 | develop | 483 | class CreateTrialInteractionsCreditVouchers < ActiveRecord::Migration[7.1]
def change
create_table :trial_interactions_credit_vouchers, id: :uuid do |t|
t.references :carrier, type: :uuid, null: false, foreign_key: { on_delete: :cascade }
t.integer :number_of_interactions, null: false
t.datetime... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20251104200509_create_message_send_requests.rb | Ruby | mit | 95 | develop | 472 | class CreateMessageSendRequests < ActiveRecord::Migration[8.0]
def change
create_table :message_send_requests, id: :uuid do |t|
t.references :message, null: true, foreign_key: { on_delete: :nullify }, type: :uuid, index: { unique: true }
t.references :sms_gateway, null: false, foreign_key: { on_delete... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20240517081155_add_parent_call_id_to_phone_calls.rb | Ruby | mit | 95 | develop | 261 | class AddParentCallIDToPhoneCalls < ActiveRecord::Migration[7.1]
def change
add_reference(
:phone_calls,
:parent_call,
type: :uuid,
foreign_key: {
to_table: :phone_calls,
on_delete: :cascade
}
)
end
end |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20200905060213_create_active_storage_tables.active_storage.rb | Ruby | mit | 95 | develop | 1,016 | # This migration comes from active_storage (originally 20170806125915)
class CreateActiveStorageTables < ActiveRecord::Migration[5.2]
def change
create_table :active_storage_blobs, id: :uuid do |t|
t.string :key, null: false
t.string :filename, null: false
t.string :content_type
... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20260113085205_create_balance_transactions.rb | Ruby | mit | 95 | develop | 1,136 | class CreateBalanceTransactions < ActiveRecord::Migration[8.1]
def change
create_table :balance_transactions, id: :uuid do |t|
t.references :account, null: false, foreign_key: true, type: :uuid
t.references :carrier, null: false, foreign_key: true, type: :uuid
t.references :created_by, null: tru... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20210527064522_create_account_memberships.rb | Ruby | mit | 95 | develop | 626 | class CreateAccountMemberships < ActiveRecord::Migration[6.1]
def change
create_table :account_memberships, id: :uuid do |t|
t.references :account, type: :uuid, null: false, foreign_key: { on_delete: :cascade }
t.references :user, type: :uuid, null: false, foreign_key: { on_delete: :cascade }
t.... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20260113055439_add_billing_enabled_and_billing_mode_to_accounts.rb | Ruby | mit | 95 | develop | 291 | class AddBillingEnabledAndBillingModeToAccounts < ActiveRecord::Migration[8.1]
def change
add_column(:accounts, :billing_enabled, :boolean, null: false, default: false)
add_column(:accounts, :billing_mode, :string, null: false)
add_index(:accounts, :billing_enabled)
end
end |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20240118052354_set_beneficiary_data_to_nullable_for_messages.rb | Ruby | mit | 95 | develop | 233 | class SetBeneficiaryDataToNullableForMessages < ActiveRecord::Migration[7.1]
def change
change_column_null(:messages, :beneficiary_country_code, true)
change_column_null(:messages, :beneficiary_fingerprint, true)
end
end |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20241010140008_add_latitude_and_longitude_to_phone_numbers.rb | Ruby | mit | 95 | develop | 310 | class AddLatitudeAndLongitudeToPhoneNumbers < ActiveRecord::Migration[7.2]
def change
add_column(:phone_numbers, :latitude, :decimal, precision: 10, scale: 6)
add_column(:phone_numbers, :longitude, :decimal, precision: 10, scale: 6)
add_index(:phone_numbers, [ :latitude, :longitude ])
end
end |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20251023040331_create_tariff_package_plans.rb | Ruby | mit | 95 | develop | 610 | class CreateTariffPackagePlans < ActiveRecord::Migration[8.0]
def change
create_table :tariff_package_plans, id: :uuid do |t|
t.references :package, null: false, foreign_key: { to_table: :tariff_packages, on_delete: :cascade }, type: :uuid
t.references :plan, null: false, foreign_key: { to_table: :tar... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20230208091851_create_pghero_space_stats.rb | Ruby | mit | 95 | develop | 327 | class CreatePgheroSpaceStats < ActiveRecord::Migration[7.0]
def change
create_table :pghero_space_stats do |t|
t.text :database
t.text :schema
t.text :relation
t.integer :size, limit: 8
t.timestamp :captured_at
end
add_index :pghero_space_stats, [:database, :captured_at]
e... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20240217075330_add_foreign_key_strategy_on_oauth_applications_and_access_tokens_to_carriers.rb | Ruby | mit | 95 | develop | 689 | class AddForeignKeyStrategyOnOAuthApplicationsAndAccessTokensToCarriers < ActiveRecord::Migration[7.1]
def change
remove_foreign_key :oauth_access_grants, :oauth_applications, column: :application_id
add_foreign_key :oauth_access_grants, :oauth_applications, column: :application_id, on_delete: :cascade
r... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20211130034002_create_events.rb | Ruby | mit | 95 | develop | 463 | class CreateEvents < ActiveRecord::Migration[6.1]
def change
create_table :events, id: :uuid do |t|
t.references :carrier, type: :uuid, null: false, foreign_key: true
t.references :eventable, type: :uuid, polymorphic: true, null: false
t.string :type, null: false
t.jsonb :details, null: fa... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20260112093737_add_billing_enabled_to_carriers.rb | Ruby | mit | 95 | develop | 212 | class AddBillingEnabledToCarriers < ActiveRecord::Migration[8.1]
def change
add_column :carriers, :billing_enabled, :boolean, default: false, null: false
add_index :carriers, :billing_enabled
end
end |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20221028021603_create_sms_gateway_channels.rb | Ruby | mit | 95 | develop | 669 | class CreateSMSGatewayChannels < ActiveRecord::Migration[7.0]
def change
create_table :sms_gateway_channels, id: :uuid do |t|
t.references :sms_gateway, type: :uuid, null: false, foreign_key: { on_delete: :cascade }
t.references(
:channel_group,
type: :uuid,
null: false,
... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20231017005354_create_tts_events.rb | Ruby | mit | 95 | develop | 578 | class CreateTTSEvents < ActiveRecord::Migration[7.1]
def change
create_table :tts_events, id: :uuid do |t|
t.references :carrier, type: :uuid, foreign_key: true, null: false
t.references :account, type: :uuid, foreign_key: { on_delete: :nullify }
t.references :phone_call, type: :uuid, foreign_ke... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20221024090306_create_sms_gateways.rb | Ruby | mit | 95 | develop | 485 | class CreateSMSGateways < ActiveRecord::Migration[7.0]
def change
create_table :sms_gateways, id: :uuid do |t|
t.references :carrier, type: :uuid, null: false, foreign_key: true
t.string :name, null: false
t.integer :max_channels, null: true, limit: 2
t.string :device_token, null: false
... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20220523102923_add_custom_app_host_and_custom_api_host_to_carriers.rb | Ruby | mit | 95 | develop | 319 | class AddCustomAppHostAndCustomAPIHostToCarriers < ActiveRecord::Migration[7.0]
def change
add_column :carriers, :custom_app_host, :citext
add_column :carriers, :custom_api_host, :citext
add_index :carriers, :custom_app_host, unique: true
add_index :carriers, :custom_api_host, unique: true
end
end |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20240110154040_create_verification_attempts.rb | Ruby | mit | 95 | develop | 392 | class CreateVerificationAttempts < ActiveRecord::Migration[7.1]
def change
create_table :verification_attempts, id: :uuid do |t|
t.references :verification, type: :uuid, null: false, foreign_key: { on_delete: :cascade }
t.string :code, null: false
t.bigserial :sequence_number, null: false, inde... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20221123070517_add_sms_url_and_sms_method_to_phone_number_configurations.rb | Ruby | mit | 95 | develop | 238 | class AddSMSURLAndSMSMethodToPhoneNumberConfigurations < ActiveRecord::Migration[7.0]
def change
add_column :phone_number_configurations, :sms_url, :string
add_column :phone_number_configurations, :sms_method, :string
end
end |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20250617065822_add_index_on_phone_calls_on_sip_trunk_id_status_created_at.rb | Ruby | mit | 95 | develop | 255 | class AddIndexOnPhoneCallsOnSIPTrunkIDStatusCreatedAt < ActiveRecord::Migration[8.0]
disable_ddl_transaction!
def change
add_index(
:phone_calls,
[ :sip_trunk_id, :status, :created_at ],
algorithm: :concurrently
)
end
end |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20221115022743_create_messages.rb | Ruby | mit | 95 | develop | 1,488 | class CreateMessages < ActiveRecord::Migration[7.0]
def change
create_table :messages, id: :uuid do |t|
t.references :account, type: :uuid, null: false, foreign_key: true
t.references :carrier, type: :uuid, null: false, foreign_key: true
t.references :phone_number, type: :uuid, foreign_key: { on... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20240422063934_add_price_to_phone_numbers.rb | Ruby | mit | 95 | develop | 274 | class AddPriceToPhoneNumbers < ActiveRecord::Migration[7.1]
def change
add_column(:phone_numbers, :price_cents, :integer, null: false)
add_column(:phone_numbers, :currency, :string, null: false)
add_index(:phone_numbers, [ :price_cents, :currency ])
end
end |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20210606023024_update_foreign_key_on_accounts_to_outbound_sip_trunks.rb | Ruby | mit | 95 | develop | 234 | class UpdateForeignKeyOnAccountsToOutboundSIPTrunks < ActiveRecord::Migration[6.1]
def change
remove_foreign_key :accounts, :outbound_sip_trunks
add_foreign_key :accounts, :outbound_sip_trunks, on_delete: :nullify
end
end |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20220226072525_create_recordings.rb | Ruby | mit | 95 | develop | 512 | class CreateRecordings < ActiveRecord::Migration[7.0]
def change
create_table :recordings, id: :uuid do |t|
t.references :account, type: :uuid, null: false, foreign_key: true
t.references :phone_call, type: :uuid, null: false, foreign_key: true
t.string :status, null: false
t.string :exter... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20240518020325_add_locality_and_region_to_phone_numbers.rb | Ruby | mit | 95 | develop | 293 | class AddLocalityAndRegionToPhoneNumbers < ActiveRecord::Migration[7.1]
def change
add_column(:phone_numbers, :iso_region_code, :citext)
add_index(:phone_numbers, :iso_region_code)
add_column(:phone_numbers, :locality, :citext)
add_index(:phone_numbers, :locality)
end
end |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20211130034220_create_webhook_request_logs.rb | Ruby | mit | 95 | develop | 576 | class CreateWebhookRequestLogs < ActiveRecord::Migration[6.1]
def change
create_table :webhook_request_logs, id: :uuid do |t|
t.references :event, type: :uuid, null: false, foreign_key: true
t.references :webhook_endpoint, type: :uuid, null: false, foreign_key: true
t.string :url, null: false
... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20240109144718_create_verification_services.rb | Ruby | mit | 95 | develop | 521 | class CreateVerificationServices < ActiveRecord::Migration[7.1]
def change
create_table :verification_services, id: :uuid do |t|
t.references :carrier, type: :uuid, null: false, foreign_key: { on_delete: :cascade }
t.references :account, type: :uuid, null: false, foreign_key: { on_delete: :cascade }
... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20240912035209_update_default_sender_on_sip_trunks.rb | Ruby | mit | 95 | develop | 317 | class UpdateDefaultSenderOnSIPTrunks < ActiveRecord::Migration[7.2]
def change
add_column(:sip_trunks, :default_sender, :string)
add_index(:sip_trunks, :default_sender)
remove_reference(:sip_trunks, :default_sender, type: :uuid, foreign_key: { to_table: :phone_numbers, on_delete: :nullify })
end
end |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20240422051241_add_billing_currency_to_carriers.rb | Ruby | mit | 95 | develop | 200 | class AddBillingCurrencyToCarriers < ActiveRecord::Migration[7.1]
def change
add_column(:carriers, :billing_currency, :string, null: false)
add_index(:carriers, :billing_currency)
end
end |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20240625080755_remove_call_leg_from_call_data_records.rb | Ruby | mit | 95 | develop | 268 | class RemoveCallLegFromCallDataRecords < ActiveRecord::Migration[7.1]
def change
remove_column(:call_data_records, :call_leg, :string)
remove_index(:call_data_records, :phone_call_id)
add_index(:call_data_records, :phone_call_id, unique: true)
end
end |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20221129234914_add_messaging_service_id_to_messages.rb | Ruby | mit | 95 | develop | 240 | class AddMessagingServiceIDToMessages < ActiveRecord::Migration[7.0]
def change
add_reference(
:messages,
:messaging_service,
type: :uuid,
null: true,
foreign_key: { on_delete: :nullify }
)
end
end |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20220426084655_set_not_null_constraint_on_beneficiary_fingerprint_and_beneficiary_country_code_on_phone_calls.rb | Ruby | mit | 95 | develop | 281 | class SetNotNullConstraintOnBeneficiaryFingerprintAndBeneficiaryCountryCodeOnPhoneCalls < ActiveRecord::Migration[7.0]
def change
change_column_null :phone_calls, :beneficiary_country_code, false
change_column_null :phone_calls, :beneficiary_fingerprint, false
end
end |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20260205110345_update_precision_on_price_columns.rb | Ruby | mit | 95 | develop | 325 | class UpdatePrecisionOnPriceColumns < ActiveRecord::Migration[8.1]
def change
change_column(:phone_calls, :price_cents, :decimal, precision: 14, scale: 4)
change_column(:messages, :price_cents, :decimal, precision: 14, scale: 4)
change_column(:tariffs, :rate_cents, :decimal, precision: 14, scale: 4)
end... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20210510072746_create_outbound_sip_trunks.rb | Ruby | mit | 95 | develop | 560 | class CreateOutboundSIPTrunks < ActiveRecord::Migration[6.1]
def change
create_table :outbound_sip_trunks, id: :uuid do |t|
t.references :carrier, type: :uuid, null: false, foreign_key: true
t.string :name, null: false
t.string :host, null: false
t.string :route_prefixes, default: [], null... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20221129083619_create_messaging_services.rb | Ruby | mit | 95 | develop | 699 | class CreateMessagingServices < ActiveRecord::Migration[7.0]
def change
create_table :messaging_services, id: :uuid do |t|
t.references :account, type: :uuid, null: false, foreign_key: { on_delete: :cascade }
t.references :carrier, type: :uuid, null: false, foreign_key: { on_delete: :cascade }
t... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20240217093203_create_error_log_notifications.rb | Ruby | mit | 95 | develop | 568 | class CreateErrorLogNotifications < ActiveRecord::Migration[7.1]
def change
create_table :error_log_notifications, id: :uuid do |t|
t.references :error_log, type: :uuid, null: false, foreign_key: { on_delete: :cascade }
t.references :user, type: :uuid, null: false, foreign_key: { on_delete: :cascade }... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20210512074825_devise_create_users.rb | Ruby | mit | 95 | develop | 1,629 | # frozen_string_literal: true
class DeviseCreateUsers < ActiveRecord::Migration[6.1]
def change
create_table :users, id: :uuid do |t|
t.references :carrier, type: :uuid, null: true, foreign_key: true
t.string :carrier_role, null: true
t.string :name, null: false
## Database authenticata... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20210510070012_add_sequence_number_columns.rb | Ruby | mit | 95 | develop | 488 | class AddSequenceNumberColumns < ActiveRecord::Migration[6.1]
def change
tables = ApplicationRecord.connection.tables.reject { |t| [ "schema_migrations", "ar_internal_metadata", "data_migrations", "active_storage_variant_records"].include?(t) }
tables.each do |table_name|
add_column table_name, :sequen... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20210512075516_devise_invitable_add_to_users.rb | Ruby | mit | 95 | develop | 789 | class DeviseInvitableAddToUsers < ActiveRecord::Migration[6.1]
def up
change_table :users do |t|
t.string :invitation_token
t.datetime :invitation_created_at
t.datetime :invitation_sent_at
t.datetime :invitation_accepted_at
t.integer :invitation_limit
t.references ... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20241024051250_add_devise_lockable_to_users.rb | Ruby | mit | 95 | develop | 363 | class AddDeviseLockableToUsers < ActiveRecord::Migration[7.2]
def change
add_column(:users, :failed_attempts, :integer, default: 0, null: false)
add_column(:users, :unlock_token, :string)
add_column(:users, :locked_at, :datetime)
add_index(:users, :unlock_token, unique: true)
add_index(:users, :c... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20210407105734_create_active_storage_variant_records.active_storage.rb | Ruby | mit | 95 | develop | 528 | # This migration comes from active_storage (originally 20191206030411)
class CreateActiveStorageVariantRecords < ActiveRecord::Migration[6.0]
def change
create_table :active_storage_variant_records, id: :uuid do |t|
t.belongs_to :blob, type: :uuid, null: false, index: false
t.string :variation_digest,... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20260427141743_optimize_phone_calls_stale_heartbeat_query.rb | Ruby | mit | 95 | develop | 514 | class OptimizePhoneCallsStaleHeartbeatQuery < ActiveRecord::Migration[8.1]
disable_ddl_transaction!
def change
remove_index(
:phone_calls,
[ :status, :last_heartbeat_at ],
algorithm: :concurrently
)
add_index(
:phone_calls,
:sequence_number,
name: "index_phone_calls... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20221028015909_create_sms_gateway_channel_groups.rb | Ruby | mit | 95 | develop | 468 | class CreateSMSGatewayChannelGroups < ActiveRecord::Migration[7.0]
def change
create_table :sms_gateway_channel_groups, id: :uuid do |t|
t.references :sms_gateway, type: :uuid, null: false, foreign_key: { on_delete: :cascade }
t.string :name, null: false
t.string :route_prefixes, default: [], nu... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20230208125742_add_missing_indexes.rb | Ruby | mit | 95 | develop | 496 | class AddMissingIndexes < ActiveRecord::Migration[7.0]
disable_ddl_transaction!
def change
add_index(:phone_calls, %i[account_id created_at], algorithm: :concurrently)
add_index(:phone_calls, %i[account_id id], algorithm: :concurrently)
add_index(:phone_calls, %i[status initiated_at], algorithm: :concu... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20220318071857_add_status_callback_url_and_status_callback_method_to_recordings.rb | Ruby | mit | 95 | develop | 233 | class AddStatusCallbackURLAndStatusCallbackMethodToRecordings < ActiveRecord::Migration[7.0]
def change
change_table :recordings do |t|
t.text :status_callback_url
t.string :status_callback_method
end
end
end |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20221129234858_add_messaging_service_id_to_phone_number_configurations.rb | Ruby | mit | 95 | develop | 276 | class AddMessagingServiceIDToPhoneNumberConfigurations < ActiveRecord::Migration[7.0]
def change
add_reference(
:phone_number_configurations,
:messaging_service,
type: :uuid,
null: true,
foreign_key: { on_delete: :nullify }
)
end
end |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20240110084336_create_verifications.rb | Ruby | mit | 95 | develop | 1,133 | class CreateVerifications < ActiveRecord::Migration[7.1]
def change
create_table :verifications, id: :uuid do |t|
t.references :verification_service,
type: :uuid,
foreign_key: { on_delete: :nullify }
t.references :account,
type: :uuid,
... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20210718071256_add_twiml_to_phone_calls.rb | Ruby | mit | 95 | develop | 235 | class AddTwiMLToPhoneCalls < ActiveRecord::Migration[6.1]
def change
add_column :phone_calls, :twiml, :text
change_column_null :phone_calls, :voice_url, true
change_column_null :phone_calls, :voice_method, true
end
end |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20251020094708_create_destination_tariffs.rb | Ruby | mit | 95 | develop | 744 | class CreateDestinationTariffs < ActiveRecord::Migration[8.0]
def change
create_table :destination_tariffs, id: :uuid do |t|
t.references :schedule, null: false, foreign_key: { to_table: :tariff_schedules, on_delete: :cascade }, type: :uuid
t.references :destination_group, null: false, foreign_key: { ... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20260421091752_fix_adding_partial_indexes_on_phone_calls_for_expiring_queries.rb | Ruby | mit | 95 | develop | 753 | class FixAddingPartialIndexesOnPhoneCallsForExpiringQueries < ActiveRecord::Migration[8.1]
disable_ddl_transaction!
def change
remove_index(
:phone_calls,
[ :sequence_number, :last_heartbeat_at ],
order: { sequence_number: :desc },
where: "status IN ('initiated', 'ringing', 'answered')"... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20240423102157_add_billing_currency_to_accounts.rb | Ruby | mit | 95 | develop | 200 | class AddBillingCurrencyToAccounts < ActiveRecord::Migration[7.1]
def change
add_column(:accounts, :billing_currency, :string, null: false)
add_index(:accounts, :billing_currency)
end
end |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20221127020344_add_constraints_on_phone_number_configurations.rb | Ruby | mit | 95 | develop | 321 | class AddConstraintsOnPhoneNumberConfigurations < ActiveRecord::Migration[7.0]
def change
change_column_null(:phone_number_configurations, :phone_number_id, false)
remove_index(:phone_number_configurations, :phone_number_id)
add_index(:phone_number_configurations, :phone_number_id, unique: true)
end
end |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20221205031641_add_message_id_and_phone_call_id_to_events.rb | Ruby | mit | 95 | develop | 926 | class AddMessageIDAndPhoneCallIDToEvents < ActiveRecord::Migration[7.0]
def up
add_reference(
:events,
:message,
type: :uuid,
foreign_key: { on_delete: :nullify }
)
remove_column(:events, :eventable_type)
rename_column(:events, :eventable_id, :phone_call_id)
change_column_n... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20210612071821_rename_incoming_phone_numbers_to_phone_numbers.rb | Ruby | mit | 95 | develop | 352 | class RenameIncomingPhoneNumbersToPhoneNumbers < ActiveRecord::Migration[6.1]
def change
rename_table :incoming_phone_numbers, :phone_numbers
execute("ALTER SEQUENCE incoming_phone_numbers_sequence_number_seq RENAME TO phone_numbers_sequence_number_seq;")
rename_column :phone_calls, :incoming_phone_number... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20220919012147_add_authentication_mode_username_and_password_to_sip_trunks.rb | Ruby | mit | 95 | develop | 332 | class AddAuthenticationModeUsernameAndPasswordToSIPTrunks < ActiveRecord::Migration[7.0]
def change
add_column(:sip_trunks, :authentication_mode, :string, null: false)
add_column(:sip_trunks, :username, :string)
add_column(:sip_trunks, :password, :string)
add_index(:sip_trunks, :username, unique: true... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20241001035940_add_metadata_to_phone_numbers.rb | Ruby | mit | 95 | develop | 216 | class AddMetadataToPhoneNumbers < ActiveRecord::Migration[7.2]
def change
add_column(:phone_numbers, :metadata, :jsonb, null: false, default: {})
add_index(:phone_numbers, :metadata, using: :gin)
end
end |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20220509011934_users_scope_uniqueness_of_email_to_carrier_id.rb | Ruby | mit | 95 | develop | 241 | class UsersScopeUniquenessOfEmailToCarrierID < ActiveRecord::Migration[7.0]
def change
remove_index(:users, :email)
add_index(:users, %i[email carrier_id], unique: true)
change_column_null(:users, :carrier_id, false)
end
end |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20260213113145_add_external_id_to_call_data_records.rb | Ruby | mit | 95 | develop | 221 | class AddExternalIDToCallDataRecords < ActiveRecord::Migration[8.1]
def change
add_column :call_data_records, :external_id, :string, null: true
add_index :call_data_records, :external_id, unique: true
end
end |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20241010070156_remove_phone_number_from_verification_delivery_attempts.rb | Ruby | mit | 95 | develop | 230 | class RemovePhoneNumberFromVerificationDeliveryAttempts < ActiveRecord::Migration[7.2]
def change
remove_reference(:verification_delivery_attempts, :phone_number, type: :uuid, foreign_key: { on_delete: :nullify })
end
end |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20240425052134_create_incoming_phone_numbers.rb | Ruby | mit | 95 | develop | 1,377 | class CreateIncomingPhoneNumbers < ActiveRecord::Migration[7.1]
def change
create_table :incoming_phone_numbers, id: :uuid do |t|
t.references(:phone_number_plan, type: :uuid, null: false, foreign_key: true, index: { unique: true })
t.references(:account, type: :uuid, null: false, foreign_key: true)
... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20240111144449_add_internal_to_phone_calls.rb | Ruby | mit | 95 | develop | 200 | class AddInternalToPhoneCalls < ActiveRecord::Migration[7.1]
def change
add_column :phone_calls, :internal, :boolean, null: false, default: false
add_index :phone_calls, :internal
end
end |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20260210074118_add_unique_index_on_destination_tariffs_tariff_id.rb | Ruby | mit | 95 | develop | 349 | class AddUniqueIndexOnDestinationTariffsTariffID < ActiveRecord::Migration[8.1]
def change
remove_index(:destination_tariffs, [ :schedule_id, :tariff_id ], unique: true)
remove_index(:destination_tariffs, :tariff_id)
add_index(:destination_tariffs, :tariff_id, unique: true) # make tariff one-to-one with d... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20181018012643_init_schema.rb | Ruby | mit | 95 | develop | 7,706 | class InitSchema < ActiveRecord::Migration[5.2]
def up
# These are extensions that must be enabled in order to support this database
enable_extension "pgcrypto"
enable_extension "plpgsql"
create_table "accounts", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
t.datetime "... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20240119154824_add_default_sender_to_sip_trunks.rb | Ruby | mit | 95 | develop | 213 | class AddDefaultSenderToSIPTrunks < ActiveRecord::Migration[7.1]
def change
add_reference(:sip_trunks, :default_sender, type: :uuid, foreign_key: { to_table: :phone_numbers, on_delete: :nullify })
end
end |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20240912040234_update_default_sender_on_sms_gateways.rb | Ruby | mit | 95 | develop | 325 | class UpdateDefaultSenderOnSMSGateways < ActiveRecord::Migration[7.2]
def change
add_column(:sms_gateways, :default_sender, :string)
add_index(:sms_gateways, :default_sender)
remove_reference(:sms_gateways, :default_sender, type: :uuid, foreign_key: { to_table: :phone_numbers, on_delete: :nullify })
end... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20260420151340_add_partial_indexes_for_phone_call_expiry_queries.rb | Ruby | mit | 95 | develop | 620 | class AddPartialIndexesForPhoneCallExpiryQueries < ActiveRecord::Migration[8.1]
def change
# Optimization for calls with stale heartbeats
add_index(
:phone_calls,
[ :sequence_number, :last_heartbeat_at ],
order: { sequence_number: :desc },
where: "status IN ('initiated', 'ringing', 'an... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20250926092109_add_index_on_messages_on_status_and_sending_at.rb | Ruby | mit | 95 | develop | 233 | class AddIndexOnMessagesOnStatusAndSendingAt < ActiveRecord::Migration[8.0]
disable_ddl_transaction!
def change
add_index(:messages, [ :status, :sending_at ], where: "status = 'sending'", algorithm: :concurrently)
end
end |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20220520060927_add_subdomain_to_carriers.rb | Ruby | mit | 95 | develop | 225 | class AddSubdomainToCarriers < ActiveRecord::Migration[7.0]
def change
enable_extension("citext")
add_column(:carriers, :subdomain, :citext, null: false)
add_index(:carriers, :subdomain, unique: true)
end
end |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20210903050337_add_outbound_sip_trunk_id_and_carrier_id_to_phone_calls.rb | Ruby | mit | 95 | develop | 330 | class AddOutboundSIPTrunkIDAndCarrierIDToPhoneCalls < ActiveRecord::Migration[6.1]
def change
add_reference :phone_calls, :outbound_sip_trunk, type: :uuid, foreign_key: true
add_reference :phone_calls, :carrier, type: :uuid, foreign_key: true, null: false
add_column :phone_calls, :dial_string, :string
... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20241009135913_add_rate_center_and_lata_to_phone_numbers.rb | Ruby | mit | 95 | develop | 277 | class AddRateCenterAndLATAToPhoneNumbers < ActiveRecord::Migration[7.2]
def change
add_column(:phone_numbers, :rate_center, :citext)
add_column(:phone_numbers, :lata, :string)
add_index(:phone_numbers, :rate_center)
add_index(:phone_numbers, :lata)
end
end |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20220504065256_create_custom_domains.rb | Ruby | mit | 95 | develop | 1,117 | class CreateCustomDomains < ActiveRecord::Migration[7.0]
def change
create_table :custom_domains, id: :uuid do |t|
t.references :carrier, type: :uuid, null: false, foreign_key: true
t.string :host, null: false
t.string :verification_token, null: false
t.string :type, null: false
t.st... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20210512094943_add_devise_two_factor_to_users.rb | Ruby | mit | 95 | develop | 365 | class AddDeviseTwoFactorToUsers < ActiveRecord::Migration[6.1]
def change
add_column :users, :encrypted_otp_secret, :string
add_column :users, :encrypted_otp_secret_iv, :string
add_column :users, :encrypted_otp_secret_salt, :string
add_column :users, :consumed_timestep, :integer
add_column :users,... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20220923055727_rename_sip_trunk_columns.rb | Ruby | mit | 95 | develop | 300 | class RenameSIPTrunkColumns < ActiveRecord::Migration[7.0]
def change
rename_column(:sip_trunks, :outbound_trunk_prefix, :outbound_national_dialing)
add_column(:sip_trunks, :inbound_country_code, :string)
remove_column(:sip_trunks, :inbound_trunk_prefix_replacement, :string)
end
end |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20241006051353_create_inbound_source_ip_addresses.rb | Ruby | mit | 95 | develop | 362 | class CreateInboundSourceIPAddresses < ActiveRecord::Migration[7.2]
def change
create_table :inbound_source_ip_addresses, id: :uuid do |t|
t.inet :ip, null: false, index: { unique: true }
t.string :region, null: false
t.bigserial :sequence_number, null: false, index: { unique: true, order: :des... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20250501063512_add_indexes_on_sip_term_status_on_call_data_records.rb | Ruby | mit | 95 | develop | 297 | class AddIndexesOnSIPTermStatusOnCallDataRecords < ActiveRecord::Migration[8.0]
disable_ddl_transaction!
def change
add_index(:call_data_records, :sip_term_status, algorithm: :concurrently)
add_index(:call_data_records, :sip_invite_failure_status, algorithm: :concurrently)
end
end |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20210817101825_add_owner_to_application.rb | Ruby | mit | 95 | develop | 607 | class AddOwnerToApplication < ActiveRecord::Migration[6.0]
def change
add_column :oauth_applications, :owner_type, :string, null: false
add_index :oauth_applications, [:owner_id, :owner_type]
add_column :oauth_applications, :confidential, :boolean, null: false, default: true
change_column_null :oauth_... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20201212092951_set_refile_columns_nullable.rb | Ruby | mit | 95 | develop | 339 | class SetRefileColumnsNullable < ActiveRecord::Migration[6.0]
def change
change_column_null(:call_data_records, :file_id, true)
change_column_null(:call_data_records, :file_filename, true)
change_column_null(:call_data_records, :file_size, true)
change_column_null(:call_data_records, :file_content_typ... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20251019041459_create_destination_prefixes.rb | Ruby | mit | 95 | develop | 484 | class CreateDestinationPrefixes < ActiveRecord::Migration[8.0]
def change
create_table :destination_prefixes, id: :uuid do |t|
t.references :destination_group, null: false, foreign_key: { on_delete: :cascade }, type: :uuid
t.string :prefix, null: false
t.bigserial :sequence_number, null: false, ... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20221128041208_add_phone_call_id_and_message_id_to_interactions.rb | Ruby | mit | 95 | develop | 1,159 | class AddPhoneCallIDAndMessageIDToInteractions < ActiveRecord::Migration[7.0]
def up
add_reference(
:interactions,
:message,
type: :uuid,
foreign_key: { on_delete: :nullify },
index: { unique: true }
)
remove_index(:interactions, name: :index_interactions_on_interactable)
... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20240111081137_create_verification_delivery_attempts.rb | Ruby | mit | 95 | develop | 663 | class CreateVerificationDeliveryAttempts < ActiveRecord::Migration[7.1]
def change
create_table :verification_delivery_attempts, id: :uuid do |t|
t.references :verification, type: :uuid, null: false, foreign_key: { on_delete: :cascade }
t.references :message, type: :uuid, null: true, foreign_key: { on... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20240330074505_add_last_connected_at_to_sms_gateways.rb | Ruby | mit | 95 | develop | 202 | class AddLastConnectedAtToSMSGateways < ActiveRecord::Migration[7.1]
def change
add_column(:sms_gateways, :last_connected_at, :datetime)
add_index(:sms_gateways, :last_connected_at)
end
end |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20211130033334_create_webhook_endpoints.rb | Ruby | mit | 95 | develop | 465 | class CreateWebhookEndpoints < ActiveRecord::Migration[6.1]
def change
create_table :webhook_endpoints, id: :uuid do |t|
t.references :oauth_application, type: :uuid, null: false, foreign_key: true
t.string :url, null: false
t.string :signing_secret, null: false
t.boolean :enabled, default... |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20260408105200_add_last_heartbeat_at_to_phone_calls.rb | Ruby | mit | 95 | develop | 210 | class AddLastHeartbeatAtToPhoneCalls < ActiveRecord::Migration[8.1]
def change
add_column(:phone_calls, :last_heartbeat_at, :datetime)
add_index(:phone_calls, [:status, :last_heartbeat_at])
end
end |
github | somleng/somleng | https://github.com/somleng/somleng | db/migrate/20221001023744_add_lock_verson_and_available_channels_to_sip_trunks.rb | Ruby | mit | 95 | develop | 225 | class AddLockVersonAndAvailableChannelsToSIPTrunks < ActiveRecord::Migration[7.0]
def change
add_column(:sip_trunks, :lock_version, :integer)
add_column(:sip_trunks, :last_channel_allocated_at, :datetime)
end
end |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.