├── .dockerignore ├── .env.sample ├── .gitattributes ├── .github ├── FUNDING.yml └── workflows │ └── test.yml ├── .gitignore ├── .irbrc ├── .rspec ├── Caddyfile ├── Dockerfile ├── Gemfile ├── Gemfile.lock ├── LICENSE.md ├── Procfile ├── README.md ├── Rakefile ├── SECURITY.md ├── VERSION ├── app ├── constraints │ └── mime_type_constraint.rb ├── controllers │ ├── api │ │ └── v1 │ │ │ ├── accounts │ │ │ ├── actions │ │ │ │ └── subscription_controller.rb │ │ │ └── relationships │ │ │ │ ├── billings_controller.rb │ │ │ │ ├── plans_controller.rb │ │ │ │ └── settings_controller.rb │ │ │ ├── accounts_controller.rb │ │ │ ├── analytics │ │ │ └── actions │ │ │ │ └── counts_controller.rb │ │ │ ├── base_controller.rb │ │ │ ├── entitlements_controller.rb │ │ │ ├── environments │ │ │ └── relationships │ │ │ │ └── tokens_controller.rb │ │ │ ├── environments_controller.rb │ │ │ ├── event_logs_controller.rb │ │ │ ├── groups │ │ │ └── relationships │ │ │ │ ├── group_owners_controller.rb │ │ │ │ ├── licenses_controller.rb │ │ │ │ ├── machines_controller.rb │ │ │ │ └── users_controller.rb │ │ │ ├── groups_controller.rb │ │ │ ├── health_controller.rb │ │ │ ├── keys │ │ │ └── relationships │ │ │ │ ├── policies_controller.rb │ │ │ │ └── products_controller.rb │ │ │ ├── keys_controller.rb │ │ │ ├── licenses │ │ │ ├── actions │ │ │ │ ├── checkouts_controller.rb │ │ │ │ ├── permits_controller.rb │ │ │ │ ├── uses_controller.rb │ │ │ │ └── validations_controller.rb │ │ │ └── relationships │ │ │ │ ├── entitlements_controller.rb │ │ │ │ ├── groups_controller.rb │ │ │ │ ├── machines_controller.rb │ │ │ │ ├── owners_controller.rb │ │ │ │ ├── policies_controller.rb │ │ │ │ ├── products_controller.rb │ │ │ │ ├── tokens_controller.rb │ │ │ │ ├── users_controller.rb │ │ │ │ └── v1x5 │ │ │ │ └── users_controller.rb │ │ │ ├── licenses_controller.rb │ │ │ ├── machine_components │ │ │ └── relationships │ │ │ │ ├── licenses_controller.rb │ │ │ │ ├── machines_controller.rb │ │ │ │ └── products_controller.rb │ │ │ ├── machine_components_controller.rb │ │ │ ├── machine_processes │ │ │ ├── actions │ │ │ │ └── heartbeats_controller.rb │ │ │ └── relationships │ │ │ │ ├── licenses_controller.rb │ │ │ │ ├── machines_controller.rb │ │ │ │ └── products_controller.rb │ │ │ ├── machine_processes_controller.rb │ │ │ ├── machines │ │ │ ├── actions │ │ │ │ ├── checkouts_controller.rb │ │ │ │ ├── heartbeats_controller.rb │ │ │ │ └── v1x0 │ │ │ │ │ └── proofs_controller.rb │ │ │ └── relationships │ │ │ │ ├── groups_controller.rb │ │ │ │ ├── licenses_controller.rb │ │ │ │ ├── machine_components_controller.rb │ │ │ │ ├── machine_processes_controller.rb │ │ │ │ ├── owners_controller.rb │ │ │ │ ├── products_controller.rb │ │ │ │ └── v1x5 │ │ │ │ └── users_controller.rb │ │ │ ├── machines_controller.rb │ │ │ ├── metrics │ │ │ └── actions │ │ │ │ └── counts_controller.rb │ │ │ ├── metrics_controller.rb │ │ │ ├── passwords_controller.rb │ │ │ ├── plans_controller.rb │ │ │ ├── policies │ │ │ └── relationships │ │ │ │ ├── entitlements_controller.rb │ │ │ │ ├── licenses_controller.rb │ │ │ │ ├── pool_controller.rb │ │ │ │ └── products_controller.rb │ │ │ ├── policies_controller.rb │ │ │ ├── products │ │ │ └── relationships │ │ │ │ ├── licenses_controller.rb │ │ │ │ ├── machines_controller.rb │ │ │ │ ├── policies_controller.rb │ │ │ │ ├── release_arches_controller.rb │ │ │ │ ├── release_artifacts_controller.rb │ │ │ │ ├── release_channels_controller.rb │ │ │ │ ├── release_engines_controller.rb │ │ │ │ ├── release_packages_controller.rb │ │ │ │ ├── release_platforms_controller.rb │ │ │ │ ├── releases_controller.rb │ │ │ │ ├── tokens_controller.rb │ │ │ │ └── users_controller.rb │ │ │ ├── products_controller.rb │ │ │ ├── profiles_controller.rb │ │ │ ├── recoveries_controller.rb │ │ │ ├── release_arches_controller.rb │ │ │ ├── release_artifacts_controller.rb │ │ │ ├── release_channels_controller.rb │ │ │ ├── release_engines │ │ │ ├── npm │ │ │ │ └── package_metadata_controller.rb │ │ │ ├── oci │ │ │ │ ├── blobs_controller.rb │ │ │ │ ├── manifests_controller.rb │ │ │ │ └── tags_controller.rb │ │ │ ├── pypi │ │ │ │ └── simple_controller.rb │ │ │ ├── raw │ │ │ │ └── release_artifacts_controller.rb │ │ │ ├── rubygems │ │ │ │ ├── compact_index_controller.rb │ │ │ │ ├── gems_controller.rb │ │ │ │ └── specs_controller.rb │ │ │ └── tauri │ │ │ │ └── upgrades_controller.rb │ │ │ ├── release_engines_controller.rb │ │ │ ├── release_packages_controller.rb │ │ │ ├── release_platforms_controller.rb │ │ │ ├── releases │ │ │ ├── actions │ │ │ │ ├── publishings_controller.rb │ │ │ │ └── v1x0 │ │ │ │ │ └── upgrades_controller.rb │ │ │ └── relationships │ │ │ │ ├── entitlements_controller.rb │ │ │ │ ├── products_controller.rb │ │ │ │ ├── release_artifacts_controller.rb │ │ │ │ ├── release_entitlement_constraints_controller.rb │ │ │ │ ├── release_packages_controller.rb │ │ │ │ ├── upgrades_controller.rb │ │ │ │ └── v1x0 │ │ │ │ └── release_artifacts_controller.rb │ │ │ ├── releases_controller.rb │ │ │ ├── request_logs │ │ │ └── actions │ │ │ │ └── counts_controller.rb │ │ │ ├── request_logs_controller.rb │ │ │ ├── searches_controller.rb │ │ │ ├── slack_controller.rb │ │ │ ├── stripe_controller.rb │ │ │ ├── tokens_controller.rb │ │ │ ├── users │ │ │ ├── actions │ │ │ │ ├── bans_controller.rb │ │ │ │ └── password_controller.rb │ │ │ └── relationships │ │ │ │ ├── groups_controller.rb │ │ │ │ ├── licenses_controller.rb │ │ │ │ ├── machines_controller.rb │ │ │ │ ├── products_controller.rb │ │ │ │ ├── second_factors_controller.rb │ │ │ │ └── tokens_controller.rb │ │ │ ├── users_controller.rb │ │ │ ├── webhook_endpoints_controller.rb │ │ │ ├── webhook_events │ │ │ └── actions │ │ │ │ └── retries_controller.rb │ │ │ └── webhook_events_controller.rb │ ├── application_controller.rb │ ├── auth │ │ └── sso_controller.rb │ ├── bin │ │ ├── release_artifacts_controller.rb │ │ └── v1x0 │ │ │ └── release_artifacts_controller.rb │ ├── concerns │ │ ├── authentication.rb │ │ ├── authorization.rb │ │ ├── compression.rb │ │ ├── cookies.rb │ │ ├── current_account_constraints.rb │ │ ├── current_account_scope.rb │ │ ├── current_environment_scope.rb │ │ ├── current_request_attributes.rb │ │ ├── default_headers.rb │ │ ├── default_url_options.rb │ │ ├── pagination.rb │ │ ├── rate_limiting.rb │ │ ├── rendering.rb │ │ ├── request_counter.rb │ │ ├── request_logger.rb │ │ ├── signature_headers.rb │ │ └── signature_methods.rb │ ├── errors_controller.rb │ └── stdout │ │ └── subscribers_controller.rb ├── helpers │ ├── checksum_helper.rb │ └── url_helper.rb ├── mailers │ ├── account_mailer.rb │ ├── application_mailer.rb │ ├── plaintext_mailer.rb │ ├── recovery_mailer.rb │ ├── stdout_mailer.rb │ └── user_mailer.rb ├── migrations │ ├── add_concurrent_attribute_to_policies_migration.rb │ ├── add_concurrent_attribute_to_policy_migration.rb │ ├── add_key_attribute_to_artifact_migration.rb │ ├── add_key_attribute_to_artifacts_migration.rb │ ├── add_product_relationship_to_artifact_migration.rb │ ├── add_product_relationship_to_artifacts_migration.rb │ ├── add_user_relationship_to_machine_migration.rb │ ├── add_user_relationship_to_machines_migration.rb │ ├── adjust_validity_for_validation_codes_migration.rb │ ├── artifact_has_many_to_has_one_for_release_migration.rb │ ├── artifact_has_many_to_has_one_for_releases_migration.rb │ ├── base_migration.rb │ ├── change_alive_status_to_not_started_for_machine_migration.rb │ ├── copy_artifact_attributes_to_release_migration.rb │ ├── copy_artifact_attributes_to_releases_migration.rb │ ├── rename_code_to_constant_for_validation_migration.rb │ ├── rename_credential_error_codes_for_token_migration.rb │ ├── rename_draft_status_to_not_published_for_release_migration.rb │ ├── rename_draft_status_to_not_published_for_releases_migration.rb │ ├── rename_filename_ext_error_code_for_release_migration.rb │ ├── rename_keygen_id_headers_for_responses_migration.rb │ ├── rename_machine_matching_strategy_to_fingerprint_matching_strategy_for_policies_migration.rb │ ├── rename_machine_matching_strategy_to_fingerprint_matching_strategy_for_policy_migration.rb │ ├── rename_machine_uniqueness_strategy_to_fingerprint_uniqueness_strategy_for_policies_migration.rb │ ├── rename_machine_uniqueness_strategy_to_fingerprint_uniqueness_strategy_for_policy_migration.rb │ ├── rename_owner_not_found_error_code_for_license_migration.rb │ ├── rename_owner_relationship_to_user_for_license_migration.rb │ ├── rename_owner_relationship_to_user_for_licenses_migration.rb │ ├── rename_process_leasing_strategy_to_leasing_strategy_for_policies_migration.rb │ ├── rename_process_leasing_strategy_to_leasing_strategy_for_policy_migration.rb │ └── update_nested_key_casing_to_snakecase_for_metadata_migration.rb ├── models │ ├── account.rb │ ├── account_setting.rb │ ├── application_record.rb │ ├── billing.rb │ ├── concerns │ │ ├── accountable.rb │ │ ├── aliasable.rb │ │ ├── billable.rb │ │ ├── date_rangeable.rb │ │ ├── denormalizable.rb │ │ ├── diffable.rb │ │ ├── dirtyable.rb │ │ ├── environmental.rb │ │ ├── idempotentable.rb │ │ ├── limitable.rb │ │ ├── orderable.rb │ │ ├── pageable.rb │ │ ├── password_resettable.rb │ │ ├── permissible.rb │ │ ├── roleable.rb │ │ ├── slackable.rb │ │ ├── tokenable.rb │ │ └── welcomeable.rb │ ├── current.rb │ ├── entitlement.rb │ ├── environment.rb │ ├── event_log.rb │ ├── event_type.rb │ ├── group.rb │ ├── group_owner.rb │ ├── group_permission.rb │ ├── key.rb │ ├── license.rb │ ├── license_entitlement.rb │ ├── license_file.rb │ ├── license_user.rb │ ├── machine.rb │ ├── machine_component.rb │ ├── machine_file.rb │ ├── machine_process.rb │ ├── metric.rb │ ├── null_billing.rb │ ├── null_object.rb │ ├── null_plan.rb │ ├── permission.rb │ ├── plan.rb │ ├── policy.rb │ ├── policy_entitlement.rb │ ├── product.rb │ ├── receipt.rb │ ├── release.rb │ ├── release_arch.rb │ ├── release_artifact.rb │ ├── release_channel.rb │ ├── release_descriptor.rb │ ├── release_download_link.rb │ ├── release_engine.rb │ ├── release_entitlement_constraint.rb │ ├── release_filetype.rb │ ├── release_manifest.rb │ ├── release_package.rb │ ├── release_platform.rb │ ├── release_upgrade_link.rb │ ├── release_upload_link.rb │ ├── request_log.rb │ ├── role.rb │ ├── role_permission.rb │ ├── second_factor.rb │ ├── session.rb │ ├── token.rb │ ├── token_permission.rb │ ├── user.rb │ ├── webhook_endpoint.rb │ └── webhook_event.rb ├── policies │ ├── account_policy.rb │ ├── accounts │ │ ├── analytics_policy.rb │ │ ├── billing_policy.rb │ │ ├── plan_policy.rb │ │ ├── setting_policy.rb │ │ └── subscription_policy.rb │ ├── application_policy.rb │ ├── entitlement_policy.rb │ ├── environment_policy.rb │ ├── environments │ │ └── token_policy.rb │ ├── event_log_policy.rb │ ├── group_policy.rb │ ├── groups │ │ ├── group_owner_policy.rb │ │ ├── license_policy.rb │ │ ├── machine_policy.rb │ │ └── user_policy.rb │ ├── key_policy.rb │ ├── keys │ │ ├── policy_policy.rb │ │ └── product_policy.rb │ ├── license_file_policy.rb │ ├── license_policy.rb │ ├── licenses │ │ ├── entitlement_policy.rb │ │ ├── group_policy.rb │ │ ├── machine_policy.rb │ │ ├── owner_policy.rb │ │ ├── policy_policy.rb │ │ ├── product_policy.rb │ │ ├── token_policy.rb │ │ ├── usage_policy.rb │ │ ├── user_policy.rb │ │ └── v1x5 │ │ │ └── user_policy.rb │ ├── machine_component_policy.rb │ ├── machine_components │ │ ├── license_policy.rb │ │ ├── machine_policy.rb │ │ └── product_policy.rb │ ├── machine_file_policy.rb │ ├── machine_policy.rb │ ├── machine_process_policy.rb │ ├── machine_processes │ │ ├── heartbeat_policy.rb │ │ ├── license_policy.rb │ │ ├── machine_policy.rb │ │ └── product_policy.rb │ ├── machines │ │ ├── group_policy.rb │ │ ├── heartbeat_policy.rb │ │ ├── license_policy.rb │ │ ├── machine_component_policy.rb │ │ ├── machine_process_policy.rb │ │ ├── owner_policy.rb │ │ ├── product_policy.rb │ │ ├── v1x0 │ │ │ └── proof_policy.rb │ │ └── v1x5 │ │ │ └── user_policy.rb │ ├── metric_policy.rb │ ├── nil_class_policy.rb │ ├── plan_policy.rb │ ├── policies │ │ ├── entitlement_policy.rb │ │ ├── license_policy.rb │ │ ├── pool_policy.rb │ │ └── product_policy.rb │ ├── policy_policy.rb │ ├── product_policy.rb │ ├── products │ │ ├── license_policy.rb │ │ ├── machine_policy.rb │ │ ├── policy_policy.rb │ │ ├── release_arch_policy.rb │ │ ├── release_artifact_policy.rb │ │ ├── release_channel_policy.rb │ │ ├── release_engine_policy.rb │ │ ├── release_package_policy.rb │ │ ├── release_platform_policy.rb │ │ ├── release_policy.rb │ │ ├── token_policy.rb │ │ └── user_policy.rb │ ├── release_arch_policy.rb │ ├── release_artifact_policy.rb │ ├── release_channel_policy.rb │ ├── release_descriptor_policy.rb │ ├── release_engine_policy.rb │ ├── release_engines │ │ └── oci │ │ │ ├── release_descriptor_policy.rb │ │ │ ├── release_manifest_policy.rb │ │ │ ├── release_package_policy.rb │ │ │ └── release_policy.rb │ ├── release_manifest_policy.rb │ ├── release_package_policy.rb │ ├── release_platform_policy.rb │ ├── release_policy.rb │ ├── releases │ │ ├── entitlement_policy.rb │ │ ├── product_policy.rb │ │ ├── release_artifact_policy.rb │ │ ├── release_entitlement_constraint_policy.rb │ │ ├── release_package_policy.rb │ │ └── v1x0 │ │ │ ├── download_policy.rb │ │ │ ├── upload_policy.rb │ │ │ └── yank_policy.rb │ ├── request_log_policy.rb │ ├── search_policy.rb │ ├── token_policy.rb │ ├── user_policy.rb │ ├── users │ │ ├── group_policy.rb │ │ ├── license_policy.rb │ │ ├── machine_policy.rb │ │ ├── password_policy.rb │ │ ├── product_policy.rb │ │ ├── second_factor_policy.rb │ │ └── token_policy.rb │ ├── webhook_endpoint_policy.rb │ └── webhook_event_policy.rb ├── serializers │ ├── account_serializer.rb │ ├── account_setting_serializer.rb │ ├── base_serializer.rb │ ├── billing_serializer.rb │ ├── entitlement_serializer.rb │ ├── environment_serializer.rb │ ├── event_log_serializer.rb │ ├── group_owner_serializer.rb │ ├── group_serializer.rb │ ├── key_serializer.rb │ ├── license_entitlement_serializer.rb │ ├── license_file_serializer.rb │ ├── license_serializer.rb │ ├── license_user_serializer.rb │ ├── machine_component_serializer.rb │ ├── machine_file_serializer.rb │ ├── machine_process_serializer.rb │ ├── machine_serializer.rb │ ├── metric_serializer.rb │ ├── plan_serializer.rb │ ├── policy_entitlement_serializer.rb │ ├── policy_serializer.rb │ ├── product_serializer.rb │ ├── release_arch_serializer.rb │ ├── release_artifact_serializer.rb │ ├── release_channel_serializer.rb │ ├── release_download_link_serializer.rb │ ├── release_engine_serializer.rb │ ├── release_entitlement_constraint_serializer.rb │ ├── release_package_serializer.rb │ ├── release_platform_serializer.rb │ ├── release_serializer.rb │ ├── release_upgrade_link_serializer.rb │ ├── release_upload_link_serializer.rb │ ├── request_log_serializer.rb │ ├── second_factor_serializer.rb │ ├── token_serializer.rb │ ├── user_serializer.rb │ ├── webhook_endpoint_serializer.rb │ └── webhook_event_serializer.rb ├── services │ ├── abstract_checkout_service.rb │ ├── base_service.rb │ ├── billings │ │ ├── base_service.rb │ │ ├── create_billing_portal_session_service.rb │ │ ├── create_customer_service.rb │ │ ├── create_subscription_service.rb │ │ ├── delete_customer_service.rb │ │ ├── delete_subscription_service.rb │ │ ├── retrieve_event_service.rb │ │ ├── update_customer_service.rb │ │ └── update_subscription_service.rb │ ├── broadcast_event_service.rb │ ├── broadcast_webhook_service.rb │ ├── find_by_alias_service.rb │ ├── license_checkout_service.rb │ ├── license_key_lookup_service.rb │ ├── license_validation_service.rb │ ├── machine_checkout_service.rb │ ├── record_metric_service.rb │ ├── resolve_account_service.rb │ ├── resolve_environment_service.rb │ ├── retry_webhook_event_service.rb │ ├── template_format_service.rb │ ├── token_lookup_service.rb │ └── v1x0 │ │ ├── release_download_service.rb │ │ ├── release_upgrade_service.rb │ │ ├── release_upload_service.rb │ │ └── release_yank_service.rb ├── validators │ ├── scope_validator.rb │ ├── semver_validator.rb │ └── url_validator.rb ├── views │ ├── account_mailer │ │ ├── license_limit_exceeded.html.haml │ │ ├── payment_failed.html.haml │ │ ├── request_limit_exceeded.html.haml │ │ ├── subscription_canceled.html.haml │ │ └── welcome.html.haml │ ├── api │ │ └── v1 │ │ │ └── release_engines │ │ │ └── pypi │ │ │ └── simple │ │ │ ├── index.html.haml │ │ │ └── show.html.haml │ ├── layouts │ │ ├── account_mailer.html.haml │ │ ├── recovery_mailer.haml │ │ ├── report_mailer.html.haml │ │ ├── simple.html.haml │ │ └── user_mailer.html.haml │ ├── recovery_mailer │ │ └── recover_accounts_for_email.haml │ ├── report_mailer │ │ └── request_limits.html.haml │ └── user_mailer │ │ └── password_reset.html.haml └── workers │ ├── base_worker.rb │ ├── create_webhook_events_worker.rb │ ├── create_webhook_events_worker2.rb │ ├── cull_dead_machines_worker.rb │ ├── cull_dead_processes_worker.rb │ ├── event_log_worker.rb │ ├── event_log_worker2.rb │ ├── event_notification_worker.rb │ ├── initialize_billing_worker.rb │ ├── license_expirations_worker.rb │ ├── license_overdue_check_ins_worker.rb │ ├── machine_heartbeat_worker.rb │ ├── process_heartbeat_worker.rb │ ├── process_npm_package_worker.rb │ ├── process_oci_image_worker.rb │ ├── process_ruby_gem_worker.rb │ ├── prune_event_logs_worker.rb │ ├── prune_expired_sessions_worker.rb │ ├── prune_expired_tokens_worker.rb │ ├── prune_metrics_worker.rb │ ├── prune_release_download_links_worker.rb │ ├── prune_release_upgrade_links_worker.rb │ ├── prune_request_logs_worker.rb │ ├── prune_webhook_events_worker.rb │ ├── record_metric_worker.rb │ ├── request_limits_report_worker.rb │ ├── request_log_worker.rb │ ├── request_log_worker2.rb │ ├── slack_invite_worker.rb │ ├── touch_license_worker.rb │ ├── vacuum_analyze_event_logs_worker.rb │ ├── vacuum_analyze_metrics_worker.rb │ ├── vacuum_analyze_request_logs_worker.rb │ ├── vacuum_analyze_webhook_events_worker.rb │ ├── wait_for_artifact_upload_worker.rb │ ├── webhook_worker.rb │ └── yank_artifact_worker.rb ├── bin ├── bundle ├── rails ├── rake ├── setup ├── spring └── update ├── config.ru ├── config ├── application.rb ├── boot.rb ├── cable.yml ├── cucumber.yml ├── database.yml ├── environment.rb ├── environments │ ├── development.rb │ ├── production.rb │ └── test.rb ├── initializers │ ├── action_policy.rb │ ├── active_model_types.rb │ ├── application_controller_renderer.rb │ ├── backtrace_silencers.rb │ ├── cache_key_version.rb │ ├── cache_logger.rb │ ├── compact_index.rb │ ├── crypto.rb │ ├── digest_io.rb │ ├── email_check.rb │ ├── enumerator_io.rb │ ├── envented.rb │ ├── filter_parameter_logging.rb │ ├── has_scope.rb │ ├── inflections.rb │ ├── jsonapi.rb │ ├── kaminari_config.rb │ ├── keygen.rb │ ├── lograge.rb │ ├── mime_types.rb │ ├── msgpack.rb │ ├── notifications.rb │ ├── oj_json.rb │ ├── perform_bulk.rb │ ├── public_email_domains.rb │ ├── r2.rb │ ├── rack_attack.rb │ ├── rack_cors.rb │ ├── rack_timeout.rb │ ├── redis.rb │ ├── regexp.rb │ ├── request_migrations.rb │ ├── rotp.rb │ ├── s3.rb │ ├── sentry.rb │ ├── sidekiq.rb │ ├── slack.rb │ ├── stripe.rb │ ├── strong_migrations.rb │ ├── typed_params.rb │ ├── workos.rb │ ├── wrap_parameters.rb │ └── zietwork.rb ├── locales │ └── en.yml ├── puma.rb ├── routes.rb ├── schedule.yml ├── sidekiq.yml ├── spring.rb └── whacamole.rb ├── db ├── migrate │ ├── 20160521203749_create_licenses.rb │ ├── 20160521203755_create_policies.rb │ ├── 20160521203951_create_users.rb │ ├── 20160521205600_create_accounts.rb │ ├── 20160523033249_add_license_to_users.rb │ ├── 20160523033613_add_policy_to_license.rb │ ├── 20160523033950_add_account_to_policies.rb │ ├── 20160523035909_add_active_machines_to_licenses.rb │ ├── 20160523040214_add_pool_to_policies.rb │ ├── 20160523141521_add_plan_to_accounts.rb │ ├── 20160523144935_create_plans.rb │ ├── 20160530024204_add_auth_token_to_users.rb │ ├── 20160530033523_add_password_reset_to_users.rb │ ├── 20160530040830_add_default_value_to_role.rb │ ├── 20160530044342_remove_email_from_accounts.rb │ ├── 20160530050836_create_billings.rb │ ├── 20160530051016_add_billing_to_users.rb │ ├── 20160530051022_add_billing_to_accounts.rb │ ├── 20160601022240_add_customer_to_billings.rb │ ├── 20160601023618_remove_billing_id_from_users.rb │ ├── 20160601023633_remove_billing_id_from_accounts.rb │ ├── 20160601145430_add_lock_version_to_policies.rb │ ├── 20160604225908_add_default_values_to_policies.rb │ ├── 20160605002506_create_products.rb │ ├── 20160605003217_add_product_id_to_users.rb │ ├── 20160605003223_add_product_id_to_policies.rb │ ├── 20160605003647_add_max_products_to_plans.rb │ ├── 20160605004207_remove_license_id_from_users.rb │ ├── 20160606164154_create_products_users.rb │ ├── 20160606171944_remove_account_id_from_policies.rb │ ├── 20160606173406_remove_product_id_from_users.rb │ ├── 20160606200838_add_account_id_to_policies.rb │ ├── 20160606200844_add_account_id_to_licenses.rb │ ├── 20160608001847_add_status_to_accounts.rb │ ├── 20160610015703_remove_activations_from_licenses.rb │ ├── 20160610225535_add_max_activations_to_policy.rb │ ├── 20160611211620_add_activation_to_accounts.rb │ ├── 20160611212320_add_activated_to_accounts.rb │ ├── 20160613172328_add_meta_to_users.rb │ ├── 20160624200649_change_stripe_id.rb │ ├── 20160624222452_add_external_plan_id_to_plans.rb │ ├── 20160624225008_add_external_subscription_id_to_billings.rb │ ├── 20160625170213_add_external_subscription_periods_to_billings.rb │ ├── 20160625172108_change_status_on_billings.rb │ ├── 20160823140738_create_machines.rb │ ├── 20160823141837_add_name_to_machines.rb │ ├── 20160823142134_add_user_id_to_machines.rb │ ├── 20160823144125_create_pools.rb │ ├── 20160823150843_add_account_id_to_pools.rb │ ├── 20160823161731_rename_pools.rb │ ├── 20160823162151_remove_pool_from_policies.rb │ ├── 20160823170245_create_tokens.rb │ ├── 20160823171439_add_account_id_to_tokens.rb │ ├── 20160823222717_rename_max_activations.rb │ ├── 20160824140927_remove_active_machines_from_licenses.rb │ ├── 20160922154405_remove_auth_token_from_users.rb │ ├── 20160927003417_rolify_create_roles.rb │ ├── 20160927225336_remove_role_from_users.rb │ ├── 20160929143658_add_indices_to_tables.rb │ ├── 20160930194911_add_card_details_to_billings.rb │ ├── 20160930210412_rename_external_status_for_billings.rb │ ├── 20161002141658_remove_user_id_from_machine.rb │ ├── 20161003231717_create_webhook_endpoints.rb │ ├── 20161004141729_create_webhook_events.rb │ ├── 20161004173254_add_endpoint_to_webhook_events.rb │ ├── 20161004214055_add_indices_to_webhooks.rb │ ├── 20161014211305_drop_products_users_table.rb │ ├── 20161016210357_add_encryption_to_tokens.rb │ ├── 20161019163352_drop_tokens_roles_table.rb │ ├── 20161025160227_add_state_to_billings.rb │ ├── 20161025160259_remove_status_from_accounts.rb │ ├── 20161025161721_remove_activated_from_accounts.rb │ ├── 20161025164655_rename_aasm_state_to_state_for_billings.rb │ ├── 20161025172023_rename_external_stripe_columns.rb │ ├── 20161025195849_create_receipts.rb │ ├── 20161109161426_add_meta_to_licenses.rb │ ├── 20161109161432_add_meta_to_policies.rb │ ├── 20161109161438_add_meta_to_machines.rb │ ├── 20161109161521_add_meta_to_products.rb │ ├── 20161109162223_add_encrypted_to_policies.rb │ ├── 20161109175721_add_fingerprint_index_to_machines.rb │ ├── 20161110144731_add_expiry_to_tokens.rb │ ├── 20161110200754_add_key_index_to_licenses.rb │ ├── 20161113062255_add_protected_to_policies.rb │ ├── 20161116173514_add_deleted_at_to_resources.rb │ ├── 20161118202415_change_meta_column_type.rb │ ├── 20161118203800_change_payload_type.rb │ ├── 20161122225420_rename_meta_to_metadata.rb │ ├── 20161128221435_rename_subdomain_and_name_for_accounts.rb │ ├── 20161129163232_change_indices_on_resources.rb │ ├── 20161129180943_change_metadata_column_type.rb │ ├── 20161212161355_create_friendly_id_slugs.rb │ ├── 20161212161422_rename_account_attributes.rb │ ├── 20161216192024_enable_uuid_extension.rb │ ├── 20161216192133_add_uuid_to_tables.rb │ ├── 20161216192309_change_foreign_keys_to_uuid.rb │ ├── 20161216193828_change_primary_keys_to_uuid.rb │ ├── 20161216194000_add_association_indices.rb │ ├── 20161216194125_add_created_at_indices.rb │ ├── 20161216194507_remove_friendly_ids.rb │ ├── 20161216221525_add_indices_to_resource_ids.rb │ ├── 20161229170420_add_beta_invitations_to_accounts.rb │ ├── 20161230174909_add_idempotency_tokens_to_webhook_events.rb │ ├── 20170103225920_remove_activation_from_accounts.rb │ ├── 20170104163650_remove_paranoia.rb │ ├── 20170105161602_add_protected_to_accounts.rb │ ├── 20170108191700_add_event_to_webhook_events.rb │ ├── 20170123141516_add_suspended_to_licenses.rb │ ├── 20170207171359_create_metrics.rb │ ├── 20170207230359_add_index_to_metrics.rb │ ├── 20170207233326_remove_attributes_from_policies.rb │ ├── 20170220152847_change_name_fields_for_users.rb │ ├── 20170220160538_remove_name_field_from_users.rb │ ├── 20170314014254_update_max_machines_for_policies.rb │ ├── 20170314030836_update_floating_for_policies.rb │ ├── 20170425195815_add_private_to_plans.rb │ ├── 20170502003137_add_unique_slug_index_to_accounts.rb │ ├── 20170509144501_remove_invite_state_from_accounts.rb │ ├── 20170520205233_add_check_in_to_policies.rb │ ├── 20170520205238_add_check_in_to_licenses.rb │ ├── 20170530221041_add_trial_duration_to_plans.rb │ ├── 20170531143646_add_last_event_timestamps_to_licenses.rb │ ├── 20170601145115_rename_check_in_fields_for_policies.rb │ ├── 20170623141428_add_cron_event_fields_to_licenses.rb │ ├── 20170726144233_add_url_to_products.rb │ ├── 20171013161238_change_max_machines_default_for_policies.rb │ ├── 20171016142634_change_protected_default_for_policies.rb │ ├── 20171025153644_add_max_reqs_to_plans.rb │ ├── 20171025174051_add_max_admins_to_plans.rb │ ├── 20171107203246_add_indexes_on_resource_ids.rb │ ├── 20171107210504_enable_pg_stats_extension.rb │ ├── 20171109155034_add_idempotency_token_index_for_webhook_events.rb │ ├── 20171109165056_update_indexes.rb │ ├── 20171213213747_add_index_for_license_keys.rb │ ├── 20171227201645_add_required_scopes_to_policies.rb │ ├── 20180102202231_add_concurrent_to_policies.rb │ ├── 20180309035004_add_max_uses_to_policies.rb │ ├── 20180309035015_add_uses_to_licenses.rb │ ├── 20180318024935_add_keys_to_accounts.rb │ ├── 20180423205146_add_response_to_webhook_events.rb │ ├── 20180511152944_add_index_to_token_digest.rb │ ├── 20180516174435_add_activation_fields_to_tokens.rb │ ├── 20180516223746_add_role_to_licenses.rb │ ├── 20180523141900_enable_btree_gin_extension.rb │ ├── 20180523141902_add_tsv_indexes_for_search.rb │ ├── 20180805070855_add_scheme_to_policies.rb │ ├── 20180816022827_add_protected_to_licenses.rb │ ├── 20180919204113_add_subscriptions_to_webhook_endpoints.rb │ ├── 20180921132829_add_name_to_licenses.rb │ ├── 20180921153258_drop_key_index_for_licenses.rb │ ├── 20180925151249_add_name_tsv_index_to_licenses.rb │ ├── 20180927172712_add_max_machines_to_node_locked_policies.rb │ ├── 20181025150012_add_interval_to_plans.rb │ ├── 20181025164052_add_machines_counter_cache_to_licenses.rb │ ├── 20181026185313_add_key_hash_index_to_licenses.rb │ ├── 20181026200210_update_key_tsv_index_for_licenses.rb │ ├── 20181027145359_add_fingerprint_hash_index_to_machines.rb │ ├── 20181110174744_create_request_logs.rb │ ├── 20181219165525_add_requestor_to_request_logs.rb │ ├── 20190125192607_add_index_to_metric_for_metrics.rb │ ├── 20190429150805_update_index_sort_orders.rb │ ├── 20190527161025_add_last_heartbeat_at_to_machines.rb │ ├── 20190802174124_update_tsv_indexes_for_search.rb │ ├── 20200819164545_change_metrics_metric_index.rb │ ├── 20200901161659_add_event_index_to_webhook_events.rb │ ├── 20200901161939_change_id_index_for_request_logs.rb │ ├── 20200902140942_update_metric_index_for_metrics.rb │ ├── 20200910202414_add_secret_key_to_accounts.rb │ ├── 20200916174908_add_machine_heartbeat_duration_to_policies.rb │ ├── 20200918195645_create_second_factors.rb │ ├── 20200924142932_update_multi_column_indexes_for_metrics.rb │ ├── 20200924153915_add_multi_column_index_for_metrics.rb │ ├── 20200924154923_update_multi_column_index_for_metrics.rb │ ├── 20200924161033_revert_multi_column_index_for_metrics.rb │ ├── 20200924164323_create_event_types.rb │ ├── 20200924171000_add_event_type_to_metrics.rb │ ├── 20200924194746_add_event_type_to_webhook_events.rb │ ├── 20200925030545_remove_nullable_event_type_for_metrics.rb │ ├── 20200925030549_remove_nullable_event_type_for_webhook_events.rb │ ├── 20200925215123_drop_indexes_for_metrics.rb │ ├── 20200925225600_add_seed_migration_indexes_for_metrics.rb │ ├── 20200926141921_add_indexes_for_metrics.rb │ ├── 20201001140831_update_indexes_for_metrics.rb │ ├── 20201001141046_update_indexes_for_webhook_events.rb │ ├── 20201203145314_add_fingerprint_uniqueness_strategy_to_policies.rb │ ├── 20201203153606_add_default_fingerprint_uniqueness_strategy_to_policies.rb │ ├── 20201214151336_add_fingerprint_matching_strategy_to_policies.rb │ ├── 20201214151403_add_default_fingerprint_matching_strategy_to_policies.rb │ ├── 20210122170212_drop_metric_for_metrics.rb │ ├── 20210122170219_drop_event_for_webhook_events.rb │ ├── 20210201141823_add_last_validated_at_to_licenses.rb │ ├── 20210212154113_add_search_indexes_to_request_logs.rb │ ├── 20210212224112_add_request_body_to_request_logs.rb │ ├── 20210212224117_add_response_body_to_request_logs.rb │ ├── 20210212224123_add_response_signature_to_request_logs.rb │ ├── 20210212224231_add_resource_to_request_logs.rb │ ├── 20210217132347_add_resource_index_to_request_logs.rb │ ├── 20210217144509_add_requestor_index_to_request_logs.rb │ ├── 20210218210227_add_key_gin_index_to_licenses.rb │ ├── 20210218210242_add_fingerprint_gin_index_to_machines.rb │ ├── 20210218210252_add_email_gin_index_to_users.rb │ ├── 20210218213930_remove_key_gin_index_from_licenses.rb │ ├── 20210302163826_add_multi_column_event_type_index_to_metrics.rb │ ├── 20210315172007_remove_nullable_key_from_licenses.rb │ ├── 20210316212414_add_notification_timestamps_to_accounts.rb │ ├── 20210318023315_add_unique_hash_index_to_key_and_account_for_licenses.rb │ ├── 20210318025545_add_unique_hash_index_to_fingerprint_and_license_for_machines.rb │ ├── 20210319134050_add_max_cores_to_policies.rb │ ├── 20210319134123_add_cores_to_machines.rb │ ├── 20210319151903_add_machines_core_count_to_licenses.rb │ ├── 20210323152738_add_limit_notification_sent_at_timestamps_to_accounts.rb │ ├── 20210402200339_create_entitlements.rb │ ├── 20210402200646_create_license_entitlements.rb │ ├── 20210402221345_create_policy_entitlements.rb │ ├── 20210405173015_add_code_index_to_entitlements.rb │ ├── 20210405173634_add_entitlement_event_types.rb │ ├── 20210413152928_update_created_at_index_for_metrics.rb │ ├── 20210413153307_update_created_at_index_order_for_metrics.rb │ ├── 20210413155003_add_filter_to_multi_column_index_for_metrics.rb │ ├── 20210413161332_fix_multi_column_index_filter_for_metrics.rb │ ├── 20210413161847_add_account_id_index_to_metrics.rb │ ├── 20210413173613_add_high_volume_event_type_index_to_metrics.rb │ ├── 20210417124736_update_digest_index_for_tokens.rb │ ├── 20210417125404_add_unique_index_to_email_for_users.rb │ ├── 20210422124159_update_analytics_indexes_for_request_logs.rb │ ├── 20210503210028_remove_gin_indexes_from_request_logs.rb │ ├── 20210513142214_add_prompt_for_review_notification_to_accounts.rb │ ├── 20210514132115_create_releases.rb │ ├── 20210514132118_create_release_platforms.rb │ ├── 20210514132558_create_release_entitlement_constraints.rb │ ├── 20210514133532_create_release_download_links.rb │ ├── 20210514142050_create_release_upload_links.rb │ ├── 20210514142902_create_release_channels.rb │ ├── 20210514152427_rename_download_counter_for_releases.rb │ ├── 20210517160709_remove_require_license_key_from_releases.rb │ ├── 20210518191726_create_release_update_links.rb │ ├── 20210518191955_add_update_count_to_releases.rb │ ├── 20210519131039_create_release_filetypes.rb │ ├── 20210519131356_add_release_filetype_to_releases.rb │ ├── 20210519131955_backfill_release_filetype_for_releases.rb │ ├── 20210519132033_remove_nullable_release_filetype_for_releases.rb │ ├── 20210519133839_rename_size_to_filesize_for_releases.rb │ ├── 20210527193718_add_referral_id_to_billings.rb │ ├── 20210528133457_rename_key_to_filename_for_releases.rb │ ├── 20210531130826_add_ed25519_keys_to_accounts.rb │ ├── 20210531130928_seed_ed25519_keys_for_accounts.rb │ ├── 20210607163343_add_signature_algorithm_to_webhook_endpoints.rb │ ├── 20210625161816_rename_release_update_links_to_release_upgrade_links.rb │ ├── 20210726131850_create_release_artifacts.rb │ ├── 20210727191029_add_content_info_to_release_artifacts.rb │ ├── 20210908172546_add_max_machines_override_to_licenses.rb │ ├── 20210908172555_add_max_cores_override_to_licenses.rb │ ├── 20210908172755_add_max_uses_override_to_licenses.rb │ ├── 20211018135339_add_expiration_strategy_to_policies.rb │ ├── 20211021145359_add_description_to_releases.rb │ ├── 20211021145405_add_signature_to_releases.rb │ ├── 20211021145410_add_checksum_to_releases.rb │ ├── 20211101211819_change_filesize_to_bigint_for_releases.rb │ ├── 20211101212402_change_content_length_to_bigint_for_release_artifacts.rb │ ├── 20211105145230_add_distribution_strategy_to_products.rb │ ├── 20211127135950_add_stdout_to_users.rb │ ├── 20211214215323_add_nullable_release_platform_for_releases.rb │ ├── 20211214215330_add_nullable_release_filetype_for_releases.rb │ ├── 20211220155108_create_event_logs.rb │ ├── 20211231205833_add_expiration_basis_to_policies.rb │ ├── 20220110224351_add_authentication_strategy_to_policies.rb │ ├── 20220121162853_update_indexes_for_request_logs.rb │ ├── 20220121171234_remove_request_id_from_request_logs.rb │ ├── 20220121175339_remove_indexes_for_request_logs.rb │ ├── 20220131182526_add_domain_and_subdomain_to_accounts.rb │ ├── 20220202214554_add_card_added_at_to_billings.rb │ ├── 20220208142000_add_heartbeat_cull_strategy_to_policies.rb │ ├── 20220208143228_add_index_to_last_heartbeat_at_to_machines.rb │ ├── 20220215145514_add_heartbeat_resurrection_strategy_to_policies.rb │ ├── 20220215153410_add_last_death_event_sent_at_to_machines.rb │ ├── 20220217140029_add_require_heartbeat_to_policies.rb │ ├── 20220221171645_add_transfer_strategy_to_policies.rb │ ├── 20220223171146_add_status_to_webhook_events.rb │ ├── 20220224213354_add_banned_at_to_users.rb │ ├── 20220228163722_add_index_to_banned_at_for_users.rb │ ├── 20220228202804_add_require_user_scope_to_policies.rb │ ├── 20220301142902_create_groups.rb │ ├── 20220301142908_create_group_owners.rb │ ├── 20220301174955_add_group_id_to_users.rb │ ├── 20220301174958_add_group_id_to_licenses.rb │ ├── 20220301175001_add_group_id_to_machines.rb │ ├── 20220303230757_add_index_to_group_id_for_users.rb │ ├── 20220303230800_add_index_to_group_id_for_licenses.rb │ ├── 20220303230803_add_index_to_group_id_for_machines.rb │ ├── 20220330152915_add_index_to_last_validated_at_for_licenses.rb │ ├── 20220415131019_create_machine_processes.rb │ ├── 20220415131253_add_leasing_strategy_to_policies.rb │ ├── 20220415131545_add_max_processes_to_policies.rb │ ├── 20220415131658_add_max_processes_override_to_licenses.rb │ ├── 20220415131706_add_max_processes_override_to_machines.rb │ ├── 20220421190505_add_api_version_to_accounts.rb │ ├── 20220421190515_add_api_version_to_webhook_endpoints.rb │ ├── 20220422203901_add_api_version_to_webhook_events.rb │ ├── 20220502193149_add_file_info_to_release_artifacts.rb │ ├── 20220502194044_create_release_arches.rb │ ├── 20220502194111_add_release_arch_to_release_artifacts.rb │ ├── 20220502202159_remove_uniq_index_from_release_artifacts.rb │ ├── 20220502203322_update_key_uniq_index_for_release_artifacts.rb │ ├── 20220502205445_remove_product_id_from_release_artifacts.rb │ ├── 20220502205642_rename_key_to_filename_for_release_artifacts.rb │ ├── 20220503162720_add_status_to_releases.rb │ ├── 20220503205130_add_filename_index_to_release_artifacts.rb │ ├── 20220504130054_add_api_version_to_releases.rb │ ├── 20220504130106_add_semver_components_to_releases.rb │ ├── 20220504130127_update_version_uniq_index_for_releases.rb │ ├── 20220505151926_add_status_to_release_artifacts.rb │ ├── 20220511130657_add_metadata_to_release_artifacts.rb │ ├── 20220511195423_add_tag_to_releases.rb │ ├── 20220607141252_add_created_date_to_request_logs.rb │ ├── 20220607142444_add_created_date_to_metrics.rb │ ├── 20220607161233_remove_nullable_created_date_from_request_logs.rb │ ├── 20220607162853_remove_nullable_created_date_from_metrics.rb │ ├── 20220614121605_add_resource_name_index_to_roles.rb │ ├── 20220617142030_add_created_at_index_to_event_logs.rb │ ├── 20220617181052_update_resource_index_for_event_logs.rb │ ├── 20220617181242_update_whodunnit_index_for_event_logs.rb │ ├── 20220629153506_add_search_indices_to_request_logs.rb │ ├── 20220704153453_add_overage_strategy_to_policies.rb │ ├── 20220718211325_create_permissions.rb │ ├── 20220718211503_create_role_permissions.rb │ ├── 20220718211555_create_token_permissions.rb │ ├── 20220718211700_create_group_permissions.rb │ ├── 20220721134635_change_name_tsv_gin_index_to_gist_for_licenses.rb │ ├── 20220723044854_drop_fingerprint_gin_index_for_machines.rb │ ├── 20220723044910_drop_email_gin_index_for_users.rb │ ├── 20220817183308_add_cname_to_accounts.rb │ ├── 20220912134350_add_name_to_tokens.rb │ ├── 20221103164128_add_backend_to_release_artifacts.rb │ ├── 20221104140501_add_backend_to_accounts.rb │ ├── 20221115145100_add_last_check_out_at_to_licenses.rb │ ├── 20221115145108_add_last_check_out_at_to_machines.rb │ ├── 20221208021513_add_unique_index_to_key_for_keys.rb │ ├── 20230105174656_create_environments.rb │ ├── 20230105175605_add_environment_to_products.rb │ ├── 20230105175709_add_environment_to_licenses.rb │ ├── 20230105175724_add_environment_to_policies.rb │ ├── 20230105175739_add_environment_to_users.rb │ ├── 20230105175752_add_environment_to_groups.rb │ ├── 20230105175800_add_environment_to_machine_processes.rb │ ├── 20230105175808_add_environment_to_machines.rb │ ├── 20230105175915_add_environment_to_releases.rb │ ├── 20230105175922_add_environment_to_release_artifacts.rb │ ├── 20230105175929_add_environment_to_release_channels.rb │ ├── 20230105175947_add_environment_to_release_filetypes.rb │ ├── 20230105175955_add_environment_to_release_platforms.rb │ ├── 20230105180013_add_environment_to_release_arches.rb │ ├── 20230105180133_add_environment_to_tokens.rb │ ├── 20230105180224_add_environment_to_entitlements.rb │ ├── 20230105195937_add_code_to_environments.rb │ ├── 20230106213748_add_environment_to_event_logs.rb │ ├── 20230106213757_add_environment_to_request_logs.rb │ ├── 20230106213814_add_environment_to_webhook_events.rb │ ├── 20230106213821_add_environment_to_webhook_endpoints.rb │ ├── 20230116220114_add_isolation_strategy_to_environments.rb │ ├── 20230210152346_add_heartbeat_basis_to_policies.rb │ ├── 20230210213933_add_environment_to_license_entitlements.rb │ ├── 20230210213942_add_environment_to_policy_entitlements.rb │ ├── 20230210214601_add_environment_to_second_factors.rb │ ├── 20230210214615_add_environment_to_release_entitlement_constraints.rb │ ├── 20230210214627_add_environment_to_release_download_links.rb │ ├── 20230210214637_add_environment_to_release_upgrade_links.rb │ ├── 20230210214647_add_environment_to_release_upload_links.rb │ ├── 20230210215827_add_environment_to_keys.rb │ ├── 20230210222710_add_environment_to_group_owners.rb │ ├── 20230217220606_remove_environment_from_release_arches.rb │ ├── 20230217220613_remove_environment_from_release_channels.rb │ ├── 20230217220621_remove_environment_from_release_filetypes.rb │ ├── 20230217220629_remove_environment_from_release_platforms.rb │ ├── 20230302171227_add_require_environment_scope_to_policies.rb │ ├── 20230613140339_add_last_validated_checksum_to_licenses.rb │ ├── 20230613140348_add_last_validated_version_to_licenses.rb │ ├── 20230613164115_add_require_checksum_scope_to_policies.rb │ ├── 20230613164122_add_require_version_scope_to_policies.rb │ ├── 20230627203649_add_heartbeat_jid_to_machines.rb │ ├── 20230627203655_add_heartbeat_jid_to_machine_processes.rb │ ├── 20230630142611_readd_requestor_index_to_request_logs.rb │ ├── 20230717161859_create_release_engines.rb │ ├── 20230717165551_create_release_packages.rb │ ├── 20230717173304_add_release_package_to_releases.rb │ ├── 20230717204249_add_package_to_version_uniq_index_for_releases.rb │ ├── 20230823154013_create_machine_components.rb │ ├── 20230823164814_add_require_components_scope_to_policies.rb │ ├── 20230905125535_add_machine_uniqueness_strategy_to_policies.rb │ ├── 20230905125544_add_machine_matching_strategy_to_policies.rb │ ├── 20230905125608_add_component_uniqueness_strategy_to_policies.rb │ ├── 20230905125612_add_component_matching_strategy_to_policies.rb │ ├── 20230912191622_add_request_headers_to_request_logs.rb │ ├── 20230912191630_add_response_headers_to_request_logs.rb │ ├── 20230912201106_add_runtime_to_request_logs.rb │ ├── 20230914172654_add_run_time_to_request_logs.rb │ ├── 20230914172659_add_queue_time_to_request_logs.rb │ ├── 20230914184536_drop_runtime_for_request_logs.rb │ ├── 20231013164654_add_created_date_to_event_logs.rb │ ├── 20231106203122_create_license_users.rb │ ├── 20240111204752_add_owner_to_machines.rb │ ├── 20240122032049_add_renewal_basis_to_policies.rb │ ├── 20240206170644_add_index_to_heartbeat_jid_for_machines.rb │ ├── 20240206170649_add_index_to_heartbeat_jid_for_machine_processes.rb │ ├── 20240311160949_add_product_to_licenses.rb │ ├── 20240403173726_denormalize_product_for_licenses.rb │ ├── 20240410141056_add_account_id_product_id_user_id_index_to_licenses.rb │ ├── 20240410141106_add_indexes_to_license_users.rb │ ├── 20240410153245_add_account_id_product_id_id_index_to_licenses.rb │ ├── 20240419172942_add_product_id_not_null_constraint_for_licenses.rb │ ├── 20240419172949_validate_product_id_not_null_constraint_for_licenses.rb │ ├── 20240420043710_change_product_id_not_null_for_licenses.rb │ ├── 20240420053540_add_account_id_not_null_constraint_for_licenses.rb │ ├── 20240420053552_validate_account_id_not_null_constraint_for_licenses.rb │ ├── 20240420053607_change_account_id_not_null_for_licenses.rb │ ├── 20240424021316_add_policy_id_not_null_constraint_for_licenses.rb │ ├── 20240424021325_validate_policy_id_not_null_constraint_for_licenses.rb │ ├── 20240424021336_change_policy_id_not_null_for_licenses.rb │ ├── 20240424022315_add_account_id_not_null_constraint_for_users.rb │ ├── 20240424022326_validate_account_id_not_null_constraint_for_users.rb │ ├── 20240424022335_change_account_id_not_null_for_users.rb │ ├── 20240424022554_add_account_id_not_null_constraint_for_machines.rb │ ├── 20240424022606_validate_account_id_not_null_constraint_for_machines.rb │ ├── 20240424022614_change_account_id_not_null_for_machines.rb │ ├── 20240424022901_add_license_id_not_null_constraint_for_machines.rb │ ├── 20240424022916_validate_license_id_not_null_constraint_for_machines.rb │ ├── 20240424022930_change_license_id_not_null_for_machines.rb │ ├── 20240424040638_add_account_id_not_null_constraint_for_products.rb │ ├── 20240424040646_validate_account_id_not_null_constraint_for_products.rb │ ├── 20240424040655_change_account_id_not_null_for_products.rb │ ├── 20240424040952_add_account_id_not_null_constraint_for_policies.rb │ ├── 20240424041001_validate_account_id_not_null_constraint_for_policies.rb │ ├── 20240424041010_change_account_id_not_null_for_policies.rb │ ├── 20240424041221_add_product_id_not_null_constraint_for_policies.rb │ ├── 20240424041233_validate_product_id_not_null_constraint_for_policies.rb │ ├── 20240424041244_change_product_id_not_null_for_policies.rb │ ├── 20240503205624_add_max_users_to_policies.rb │ ├── 20240503205655_add_max_users_override_to_licenses.rb │ ├── 20240503211347_add_license_users_counter_cache_to_licenses.rb │ ├── 20240503211606_reset_license_users_counter_cache_for_licenses.rb │ ├── 20240510151016_add_machine_leasing_strategy_to_policies.rb │ ├── 20240510151025_add_process_leasing_strategy_to_policies.rb │ ├── 20240510160015_seed_machine_leasing_strategy_for_policies.rb │ ├── 20240510160024_seed_process_leasing_strategy_for_policies.rb │ ├── 20240724204821_add_unique_resource_index_to_roles.rb │ ├── 20241007164206_add_code_to_products.rb │ ├── 20241007171911_update_tag_uniq_index_for_releases.rb │ ├── 20241018131452_create_release_manifests.rb │ ├── 20241113134529_create_release_descriptors.rb │ ├── 20241114163421_add_content_attributes_to_release_manifests.rb │ ├── 20241114214652_remove_unique_index_from_release_manifests.rb │ ├── 20250224153323_create_sessions.rb │ ├── 20250313130540_add_sso_organization_id_to_accounts.rb │ ├── 20250313130551_add_sso_profile_id_to_users.rb │ ├── 20250313130556_add_sso_idp_id_to_users.rb │ ├── 20250313130604_add_sso_connection_id_to_users.rb │ ├── 20250313130610_add_sso_organization_domain_to_accounts.rb │ ├── 20250313145717_add_sso_session_duration_to_accounts.rb │ ├── 20250313155620_add_nullable_token_id_to_sessions.rb │ ├── 20250314161819_add_sso_jit_provisioning_to_accounts.rb │ ├── 20250314195615_add_sso_external_authn_to_accounts.rb │ ├── 20250403140338_add_log_retention_limits_to_plans.rb │ ├── 20250403140401_add_distribution_limits_to_plans.rb │ ├── 20250404171439_add_policy_to_machines.rb │ ├── 20250404171451_denormalize_policy_for_machines.rb │ ├── 20250407173652_add_heartbeat_cull_indexes_to_policies.rb │ ├── 20250408141503_add_policy_id_not_null_constraint_for_machines.rb │ ├── 20250408141515_validate_policy_id_not_null_constraint_for_machines.rb │ ├── 20250408141534_change_policy_id_not_null_for_machines.rb │ ├── 20250502170156_create_account_settings.rb │ ├── 20250515142604_add_product_to_webhook_endpoints.rb │ ├── 20250515152010_add_webhook_endpoint_to_webhook_events.rb │ ├── 20250515152529_seed_webhook_endpoint_for_webhook_events.rb │ ├── 20250522115706_add_slack_to_accounts.rb │ ├── 20250529131947_add_backdated_to_to_releases.rb │ ├── 20250530155151_add_account_to_roles.rb │ ├── 20250530155241_seed_account_for_roles.rb │ ├── 20250531022220_add_account_id_not_null_constraint_for_roles.rb │ ├── 20250531022728_validate_account_id_not_null_constraint_for_roles.rb │ └── 20250531023019_change_account_id_not_null_constraint_for_roles.rb ├── schema.rb ├── seeds.rb └── seeds │ └── development.rb ├── docker-compose.yaml ├── features ├── api │ └── v1 │ │ ├── accounts │ │ ├── actions │ │ │ └── subscription.feature │ │ ├── create.feature │ │ ├── destroy.feature │ │ ├── relationships │ │ │ ├── billing.feature │ │ │ ├── plan.feature │ │ │ └── settings.feature │ │ ├── show.feature │ │ └── update.feature │ │ ├── analytics │ │ └── actions │ │ │ ├── counts.feature │ │ │ ├── top-ips-by-volume.feature │ │ │ ├── top-licenses-by-volume.feature │ │ │ └── top-urls-by-volume.feature │ │ ├── arches │ │ ├── index.feature │ │ └── show.feature │ │ ├── artifacts │ │ ├── create.feature │ │ ├── destroy.feature │ │ ├── index.feature │ │ ├── show.feature │ │ ├── update.feature │ │ └── v1x0 │ │ │ └── show.feature │ │ ├── channels │ │ ├── index.feature │ │ └── show.feature │ │ ├── components │ │ ├── create.feature │ │ ├── destroy.feature │ │ ├── index.feature │ │ ├── relationships │ │ │ ├── license.feature │ │ │ ├── machine.feature │ │ │ └── product.feature │ │ ├── show.feature │ │ └── update.feature │ │ ├── engines │ │ ├── index.feature │ │ ├── npm │ │ │ └── show.feature │ │ ├── oci │ │ │ ├── blobs.feature │ │ │ ├── conformance.feature │ │ │ ├── manifests.feature │ │ │ └── tags.feature │ │ ├── pypi │ │ │ └── simple │ │ │ │ ├── index.feature │ │ │ │ └── show.feature │ │ ├── raw │ │ │ └── show.feature │ │ ├── rubygems │ │ │ ├── compact_index.feature │ │ │ ├── gems.feature │ │ │ └── specs.feature │ │ ├── show.feature │ │ └── tauri │ │ │ ├── v1 │ │ │ └── upgrade.feature │ │ │ └── v2 │ │ │ └── upgrade.feature │ │ ├── entitlements │ │ ├── create.feature │ │ ├── destroy.feature │ │ ├── index.feature │ │ ├── show.feature │ │ └── update.feature │ │ ├── environments │ │ ├── create.feature │ │ ├── destroy.feature │ │ ├── index.feature │ │ ├── relationships │ │ │ └── tokens.feature │ │ ├── show.feature │ │ └── update.feature │ │ ├── event_logs │ │ ├── index.feature │ │ └── show.feature │ │ ├── groups │ │ ├── create.feature │ │ ├── destroy.feature │ │ ├── index.feature │ │ ├── relationships │ │ │ ├── licenses.feature │ │ │ ├── machines.feature │ │ │ ├── owners.feature │ │ │ └── users.feature │ │ ├── show.feature │ │ └── update.feature │ │ ├── keys │ │ ├── create.feature │ │ ├── destroy.feature │ │ ├── index.feature │ │ ├── relationships │ │ │ ├── policy.feature │ │ │ └── product.feature │ │ ├── show.feature │ │ └── update.feature │ │ ├── licenses │ │ ├── actions │ │ │ ├── checkouts.feature │ │ │ ├── permits.feature │ │ │ ├── uses.feature │ │ │ └── validations.feature │ │ ├── create.feature │ │ ├── destroy.feature │ │ ├── index.feature │ │ ├── relationships │ │ │ ├── entitlements.feature │ │ │ ├── group.feature │ │ │ ├── machines.feature │ │ │ ├── owner.feature │ │ │ ├── policy.feature │ │ │ ├── product.feature │ │ │ ├── tokens.feature │ │ │ ├── users.feature │ │ │ └── v1x5 │ │ │ │ └── user.feature │ │ ├── show.feature │ │ └── update.feature │ │ ├── machines │ │ ├── actions │ │ │ ├── checkouts.feature │ │ │ ├── heartbeats.feature │ │ │ └── v1x0 │ │ │ │ └── proofs.feature │ │ ├── create.feature │ │ ├── destroy.feature │ │ ├── index.feature │ │ ├── relationships │ │ │ ├── components.feature │ │ │ ├── group.feature │ │ │ ├── license.feature │ │ │ ├── owner.feature │ │ │ ├── processes.feature │ │ │ ├── product.feature │ │ │ └── v1x5 │ │ │ │ └── user.feature │ │ ├── show.feature │ │ └── update.feature │ │ ├── metrics │ │ ├── actions │ │ │ └── counts.feature │ │ ├── index.feature │ │ └── show.feature │ │ ├── packages │ │ ├── create.feature │ │ ├── destroy.feature │ │ ├── index.feature │ │ ├── show.feature │ │ └── update.feature │ │ ├── passwords │ │ └── reset.feature │ │ ├── plans │ │ ├── index.feature │ │ └── show.feature │ │ ├── platforms │ │ ├── index.feature │ │ └── show.feature │ │ ├── policies │ │ ├── create.feature │ │ ├── destroy.feature │ │ ├── index.feature │ │ ├── relationships │ │ │ ├── entitlements.feature │ │ │ ├── licenses.feature │ │ │ ├── pool.feature │ │ │ └── product.feature │ │ ├── show.feature │ │ └── update.feature │ │ ├── processes │ │ ├── actions │ │ │ └── heartbeats.feature │ │ ├── create.feature │ │ ├── destroy.feature │ │ ├── index.feature │ │ ├── relationships │ │ │ ├── license.feature │ │ │ ├── machine.feature │ │ │ └── product.feature │ │ ├── show.feature │ │ └── update.feature │ │ ├── products │ │ ├── create.feature │ │ ├── destroy.feature │ │ ├── index.feature │ │ ├── relationships │ │ │ ├── arches.feature │ │ │ ├── artifacts.feature │ │ │ ├── channels.feature │ │ │ ├── licenses.feature │ │ │ ├── machines.feature │ │ │ ├── packages.feature │ │ │ ├── platforms.feature │ │ │ ├── policies.feature │ │ │ ├── releases.feature │ │ │ ├── tokens.feature │ │ │ └── users.feature │ │ ├── show.feature │ │ └── update.feature │ │ ├── profiles │ │ ├── me.feature │ │ └── show.feature │ │ ├── releases │ │ ├── actions │ │ │ ├── publish.feature │ │ │ ├── v1x0 │ │ │ │ └── upgrades.feature │ │ │ └── yank.feature │ │ ├── create.feature │ │ ├── destroy.feature │ │ ├── index.feature │ │ ├── relationships │ │ │ ├── artifacts.feature │ │ │ ├── constraints.feature │ │ │ ├── entitlements.feature │ │ │ ├── package.feature │ │ │ ├── product.feature │ │ │ ├── upgrade.feature │ │ │ └── v1x0 │ │ │ │ └── artifact.feature │ │ ├── show.feature │ │ ├── update.feature │ │ └── v1x0 │ │ │ ├── create.feature │ │ │ ├── index.feature │ │ │ └── update.feature │ │ ├── request_limits │ │ └── limits.feature │ │ ├── request_logs │ │ ├── actions │ │ │ └── counts.feature │ │ ├── index.feature │ │ └── show.feature │ │ ├── searches │ │ └── search.feature │ │ ├── stripe │ │ └── event.feature │ │ ├── tokens │ │ ├── expiration.feature │ │ ├── generate.feature │ │ ├── index.feature │ │ ├── regenerate.feature │ │ ├── revoke.feature │ │ ├── sessions.feature │ │ └── show.feature │ │ ├── users │ │ ├── actions │ │ │ ├── bans.feature │ │ │ └── password.feature │ │ ├── banned.feature │ │ ├── create.feature │ │ ├── destroy.feature │ │ ├── index.feature │ │ ├── relationships │ │ │ ├── group.feature │ │ │ ├── licenses.feature │ │ │ ├── machines.feature │ │ │ ├── products.feature │ │ │ ├── second_factors.feature │ │ │ └── tokens.feature │ │ ├── show.feature │ │ └── update.feature │ │ ├── webhook_endpoints │ │ ├── create.feature │ │ ├── destroy.feature │ │ ├── index.feature │ │ ├── show.feature │ │ └── update.feature │ │ └── webhook_events │ │ ├── actions │ │ └── retry.feature │ │ ├── destroy.feature │ │ ├── index.feature │ │ └── show.feature ├── auth │ └── sso.feature ├── bin │ ├── shorturls.feature │ └── v1x0 │ │ └── shorturls.feature ├── cnames │ └── domains.feature ├── lib │ └── typed_params.feature ├── step_definitions │ ├── authentication_steps.rb │ ├── before_after_steps.rb │ ├── billing_steps.rb │ ├── placeholder_steps.rb │ ├── request_steps.rb │ ├── resource_steps.rb │ └── worker_steps.rb └── support │ ├── bullet.rb │ ├── env.rb │ ├── factory_bot.rb │ ├── faker.rb │ ├── helpers.rb │ ├── matchers.rb │ ├── rspec.rb │ ├── sidekiq.rb │ ├── stripe.rb │ └── webmock.rb ├── lib ├── digest_io.rb ├── enumerator_io.rb ├── envented.rb ├── keygen.rb ├── keygen │ ├── console.rb │ ├── ee.rb │ ├── ee │ │ ├── license.rb │ │ ├── license_file.rb │ │ ├── protected_class.rb │ │ ├── protected_methods.rb │ │ ├── router.rb │ │ └── sso.rb │ ├── error.rb │ ├── exporter.rb │ ├── exporter │ │ ├── v1 │ │ │ ├── exporter.rb │ │ │ ├── serializer.rb │ │ │ └── writer.rb │ │ └── writer.rb │ ├── importer.rb │ ├── importer │ │ ├── reader.rb │ │ ├── v1 │ │ │ ├── deserializer.rb │ │ │ ├── importer.rb │ │ │ └── reader.rb │ │ └── version_reader.rb │ ├── jsonapi.rb │ ├── jsonapi │ │ ├── errors.rb │ │ └── renderer.rb │ ├── logger.rb │ ├── middleware.rb │ ├── portable_class.rb │ ├── url_for.rb │ └── version.rb ├── oci_image_layout.rb ├── perform_bulk.rb ├── slack.rb └── tasks │ ├── cucumber.rake │ ├── db.rake │ ├── keygen │ ├── about.rake │ ├── export.rake │ ├── import.rake │ ├── permissions.rake │ ├── setup.rake │ └── stdout.rake │ ├── silence.rake │ └── test.rake ├── log └── .keep ├── public ├── favicon.ico └── robots.txt ├── scripts └── entrypoint.sh ├── spec ├── factories │ ├── account.rb │ ├── account_setting.rb │ ├── billing.rb │ ├── customer.rb │ ├── entitlement.rb │ ├── environment.rb │ ├── event_log.rb │ ├── event_type.rb │ ├── group.rb │ ├── group_owner.rb │ ├── group_permission.rb │ ├── key.rb │ ├── license.rb │ ├── license_entitlement.rb │ ├── license_file.rb │ ├── license_user.rb │ ├── machine.rb │ ├── machine_component.rb │ ├── machine_file.rb │ ├── machine_process.rb │ ├── metric.rb │ ├── permission.rb │ ├── plan.rb │ ├── policy.rb │ ├── policy_entitlement.rb │ ├── product.rb │ ├── release.rb │ ├── release_arch.rb │ ├── release_artifact.rb │ ├── release_channel.rb │ ├── release_descriptor.rb │ ├── release_download_link.rb │ ├── release_engine.rb │ ├── release_entitlement_constraint.rb │ ├── release_filetype.rb │ ├── release_manifest.rb │ ├── release_package.rb │ ├── release_platform.rb │ ├── release_upgrade_link.rb │ ├── release_upload_link.rb │ ├── request_log.rb │ ├── role.rb │ ├── role_permission.rb │ ├── second_factor.rb │ ├── session.rb │ ├── subscription.rb │ ├── token.rb │ ├── token_permission.rb │ ├── user.rb │ ├── webhook_endpoint.rb │ └── webhook_event.rb ├── fixtures │ ├── files │ │ ├── alpine-3.20.3.tar │ │ ├── expired.lic │ │ ├── hello-2.0.0.tgz │ │ ├── invalid-1.0.0.gem │ │ ├── invalid-1.2.3.tar │ │ ├── invalid-2.0.0.tgz │ │ ├── large.tar.gz │ │ ├── ping-1.0.0-java.gem │ │ ├── ping-1.0.0.gem │ │ ├── tampered.lic │ │ └── valid.lic │ ├── gems │ │ └── ping │ │ │ ├── lib │ │ │ ├── ping.rb │ │ │ └── ping │ │ │ │ └── version.rb │ │ │ └── ping.gemspec │ └── packages │ │ └── hello │ │ ├── LICENSE │ │ ├── README.md │ │ ├── package.json │ │ └── src │ │ └── index.js ├── lib │ ├── digest_io_spec.rb │ ├── envented_spec.rb │ ├── keygen │ │ ├── ee │ │ │ ├── license_file_spec.rb │ │ │ ├── license_spec.rb │ │ │ ├── protected_class_spec.rb │ │ │ ├── protected_methods_spec.rb │ │ │ └── router_spec.rb │ │ ├── exporter_spec.rb │ │ └── importer_spec.rb │ ├── keygen_spec.rb │ └── perform_bulk_spec.rb ├── mailers │ └── previews │ │ ├── account_mailer_preview.rb │ │ ├── plaintext_mailer_preview.rb │ │ ├── recovery_mailer_preview.rb │ │ ├── stdout_mailer_preview.rb │ │ └── user_mailer_preview.rb ├── matchers │ ├── allocate_less_than_spec.rb │ ├── deep_include_spec.rb │ └── upload_spec.rb ├── migrations │ ├── add_concurrent_attribute_to_policies_migration_spec.rb │ ├── add_concurrent_attribute_to_policy_migration_spec.rb │ ├── add_key_attribute_to_artifact_migration_spec.rb │ ├── add_key_attribute_to_artifacts_migration_spec.rb │ ├── add_product_relationship_to_artifact_migration_spec.rb │ ├── add_product_relationship_to_artifacts_migration_spec.rb │ ├── add_user_relationship_to_machine_migration_spec.rb │ ├── add_user_relationship_to_machines_migration_spec.rb │ ├── adjust_validity_for_validation_codes_migration_spec.rb │ ├── artifact_has_many_to_has_one_for_release_migration_spec.rb │ ├── artifact_has_many_to_has_one_for_releases_migration_spec.rb │ ├── change_alive_status_to_not_started_for_machine_migration_spec.rb │ ├── copy_artifact_attributes_to_release_migration_spec.rb │ ├── copy_artifact_attributes_to_releases_migration_spec.rb │ ├── rename_code_to_constant_for_validation_migration_spec.rb │ ├── rename_credential_error_codes_for_token_migration_spec.rb │ ├── rename_draft_status_to_not_published_for_release_migration_spec.rb │ ├── rename_draft_status_to_not_published_for_releases_migration_spec.rb │ ├── rename_filename_ext_error_code_for_release_migration_spec.rb │ ├── rename_keygen_id_headers_for_responses_migration_spec.rb │ ├── rename_machine_matching_strategy_to_fingerprint_matching_strategy_for_policies_migration_spec.rb │ ├── rename_machine_matching_strategy_to_fingerprint_matching_strategy_for_policy_migration_spec.rb │ ├── rename_machine_uniqueness_strategy_to_fingerprint_uniqueness_strategy_for_policies_migration_spec.rb │ ├── rename_machine_uniqueness_strategy_to_fingerprint_uniqueness_strategy_for_policy_migration_spec.rb │ ├── rename_owner_not_found_error_code_for_license_migration_spec.rb │ ├── rename_owner_relationship_to_user_for_license_migration_spec.rb │ ├── rename_owner_relationship_to_user_for_licenses_migration_spec.rb │ ├── rename_process_leasing_strategy_to_leasing_strategy_for_policies_migration_spec.rb │ ├── rename_process_leasing_strategy_to_leasing_strategy_for_policy_migration_spec.rb │ └── update_nested_key_casing_to_snakecase_for_metadata_migration_spec.rb ├── models │ ├── account_spec.rb │ ├── concerns │ │ ├── accountable_spec.rb │ │ ├── denormalizable_spec.rb │ │ ├── dirtyable_spec.rb │ │ └── environmental_spec.rb │ ├── entitlement_spec.rb │ ├── environment_spec.rb │ ├── event_log_spec.rb │ ├── group_owner_spec.rb │ ├── group_spec.rb │ ├── key_spec.rb │ ├── license_entitlement_spec.rb │ ├── license_spec.rb │ ├── license_user_spec.rb │ ├── machine_component.rb │ ├── machine_process_spec.rb │ ├── machine_spec.rb │ ├── policy_entitlement_spec.rb │ ├── policy_spec.rb │ ├── product_spec.rb │ ├── release_artifact_spec.rb │ ├── release_download_link_spec.rb │ ├── release_entitlement_constraint_spec.rb │ ├── release_package_spec.rb │ ├── release_spec.rb │ ├── release_specification_spec.rb │ ├── release_upgrade_link_spec.rb │ ├── release_upload_link_spec.rb │ ├── request_log_spec.rb │ ├── role_spec.rb │ ├── second_factor_spec.rb │ ├── session_spec.rb │ ├── token_spec.rb │ └── user_spec.rb ├── policies │ ├── account_policy_spec.rb │ ├── accounts │ │ ├── analytics_policy_spec.rb │ │ ├── billing_policy_spec.rb │ │ ├── plan_policy_spec.rb │ │ ├── setting_policy_spec.rb │ │ └── subscription_policy_spec.rb │ ├── entitlement_policy_spec.rb │ ├── environment_policy_spec.rb │ ├── event_log_policy_spec.rb │ ├── group_policy_spec.rb │ ├── groups │ │ ├── group_owner_policy_spec.rb │ │ ├── license_policy_spec.rb │ │ ├── machine_policy_spec.rb │ │ └── user_policy_spec.rb │ ├── key_policy_spec.rb │ ├── keys │ │ ├── policy_policy_spec.rb │ │ └── product_policy_spec.rb │ ├── license_file_policy_spec.rb │ ├── license_policy_spec.rb │ ├── licenses │ │ ├── entitlement_policy_spec.rb │ │ ├── group_policy_spec.rb │ │ ├── machine_policy_spec.rb │ │ ├── owner_policy_spec.rb │ │ ├── policy_policy_spec.rb │ │ ├── product_policy_spec.rb │ │ ├── token_policy_spec.rb │ │ ├── usage_policy_spec.rb │ │ ├── user_policy_spec.rb │ │ └── v1x5 │ │ │ └── user_policy_spec.rb │ ├── machine_component_policy_spec.rb │ ├── machine_components │ │ ├── license_policy_spec.rb │ │ ├── machine_policy_spec.rb │ │ └── product_policy_spec.rb │ ├── machine_file_policy_spec.rb │ ├── machine_policy_spec.rb │ ├── machine_process_policy_spec.rb │ ├── machine_processes │ │ ├── heartbeat_policy_spec.rb │ │ ├── license_policy_spec.rb │ │ ├── machine_policy_spec.rb │ │ └── product_policy_spec.rb │ ├── machines │ │ ├── group_policy_spec.rb │ │ ├── heartbeat_policy_spec.rb │ │ ├── license_policy_spec.rb │ │ ├── machine_component_policy_spec.rb │ │ ├── machine_process_policy_spec.rb │ │ ├── owner_policy_spec.rb │ │ ├── product_policy_spec.rb │ │ ├── v1x0 │ │ │ └── proof_policy_spec.rb │ │ └── v1x5 │ │ │ └── user_policy_spec.rb │ ├── metric_policy_spec.rb │ ├── policies │ │ ├── entitlement_policy_spec.rb │ │ ├── license_policy_spec.rb │ │ ├── pool_policy_spec.rb │ │ └── product_policy_spec.rb │ ├── policy_policy_spec.rb │ ├── product_policy_spec.rb │ ├── products │ │ ├── license_policy_spec.rb │ │ ├── machine_policy_spec.rb │ │ ├── policy_policy_spec.rb │ │ ├── release_arch_policy_spec.rb │ │ ├── release_artifact_policy_spec.rb │ │ ├── release_channel_policy_spec.rb │ │ ├── release_engine_policy_spec.rb │ │ ├── release_package_policy_spec.rb │ │ ├── release_platform_policy_spec.rb │ │ ├── release_policy_spec.rb │ │ ├── token_policy_spec.rb │ │ └── user_policy_spec.rb │ ├── release_arch_policy_spec.rb │ ├── release_artifact_policy_spec.rb │ ├── release_channel_policy_spec.rb │ ├── release_descriptor_policy_spec.rb │ ├── release_engine_policy_spec.rb │ ├── release_manifest_policy_spec.rb │ ├── release_package_policy_spec.rb │ ├── release_platform_policy_spec.rb │ ├── release_policy_spec.rb │ ├── releases │ │ ├── entitlement_policy_spec.rb │ │ ├── product_policy_spec.rb │ │ ├── release_artifact_policy_spec.rb │ │ ├── release_entitlement_constraint_policy_spec.rb │ │ ├── release_package_policy_spec.rb │ │ └── v1x0 │ │ │ ├── download_policy_spec.rb │ │ │ ├── upload_policy_spec.rb │ │ │ └── yank_policy_spec.rb │ ├── request_log_policy_spec.rb │ ├── search_policy_spec.rb │ ├── token_policy_spec.rb │ ├── user_policy_spec.rb │ ├── users │ │ ├── group_policy_spec.rb │ │ ├── license_policy_spec.rb │ │ ├── machine_policy_spec.rb │ │ ├── password_policy_spec.rb │ │ ├── product_policy_spec.rb │ │ ├── second_factor_policy_spec.rb │ │ └── token_policy_spec.rb │ ├── webhook_endpoint_policy_spec.rb │ └── webhook_event_policy_spec.rb ├── rails_helper.rb ├── services │ ├── broadcast_event_service_spec.rb │ ├── license_checkout_service_spec.rb │ ├── license_key_lookup_service_spec.rb │ ├── machine_checkout_service_spec.rb │ ├── token_lookup_service_spec.rb │ └── v1x0 │ │ └── release_upgrade_service_spec.rb ├── shared │ ├── accountable.rb │ ├── dirtyable.rb │ ├── encryptable.rb │ └── environmental.rb ├── spec_helper.rb ├── support │ ├── clear_cache.rb │ ├── factory_bot.rb │ ├── helpers │ │ ├── account_helper.rb │ │ ├── application_helper.rb │ │ ├── authorization_helper.rb │ │ ├── env_helper.rb │ │ ├── environment_helper.rb │ │ ├── file_helper.rb │ │ ├── keygen_helper.rb │ │ ├── signature_helper.rb │ │ ├── stripe_helper.rb │ │ ├── stub_helper.rb │ │ ├── task_helper.rb │ │ └── time_helper.rb │ └── matchers │ │ ├── deep_include_matcher.rb │ │ ├── exclude_matcher.rb │ │ ├── log_matcher.rb │ │ ├── memory_matchers.rb │ │ ├── not_change_matcher.rb │ │ ├── not_raise_error_matcher.rb │ │ ├── policy_matchers.rb │ │ ├── query_matcher.rb │ │ ├── sql_matcher.rb │ │ └── upload_matcher.rb ├── tasks │ └── keygen │ │ └── permissions_spec.rb └── workers │ ├── cull_dead_machines_worker_spec.rb │ ├── cull_dead_processes_worker_spec.rb │ ├── license_expirations_worker_spec.rb │ ├── license_overdue_check_ins_worker_spec.rb │ ├── machine_heartbeat_worker_spec.rb │ ├── process_heartbeat_worker_spec.rb │ ├── process_npm_package_worker_spec.rb │ ├── process_oci_image_worker_spec.rb │ ├── process_ruby_gem_worker_spec.rb │ ├── prune_event_logs_worker_spec.rb │ ├── prune_request_logs_worker_spec.rb │ ├── prune_webhook_events_worker_spec.rb │ └── wait_for_artifact_upload_worker_spec.rb └── tmp └── .keep /.gitattributes: -------------------------------------------------------------------------------- 1 | /VERSION ident 2 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: ezekg 2 | -------------------------------------------------------------------------------- /.irbrc: -------------------------------------------------------------------------------- 1 | IRB.conf[:USE_AUTOCOMPLETE] = false 2 | -------------------------------------------------------------------------------- /.rspec: -------------------------------------------------------------------------------- 1 | --color 2 | --require spec_helper 3 | --fail-fast 4 | -------------------------------------------------------------------------------- /Caddyfile: -------------------------------------------------------------------------------- 1 | {$CADDY_HOSTS} { 2 | tls {$CADDY_ACME_EMAIL:internal} 3 | reverse_proxy web:3000 4 | } 5 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: RUBYOPT="--yjit --yjit-exec-mem-size=${RUBY_YJIT_EXEC_MEM_SIZE:-64}" bin/start-pgbouncer bundle exec puma -C config/puma.rb 2 | worker: bin/start-pgbouncer bundle exec sidekiq 3 | release: bundle exec rails db:migrate 4 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Add your own tasks in files placed in lib/tasks ending in .rake, 4 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 5 | 6 | require_relative 'config/application' 7 | 8 | Rails.application.load_tasks 9 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | $Id: 055c8729cdcc372500a08db659c045e16c4409fb $ 2 | -------------------------------------------------------------------------------- /app/controllers/api/v1/base_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Api::V1 4 | class BaseController < ApplicationController 5 | include CurrentAccountConstraints 6 | include CurrentAccountScope 7 | include CurrentEnvironmentScope 8 | include Pagination 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /app/controllers/bin/release_artifacts_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Bin 4 | class ReleaseArtifactsController < ::Api::V1::Releases::Relationships::ReleaseArtifactsController; end 5 | end 6 | -------------------------------------------------------------------------------- /app/controllers/bin/v1x0/release_artifacts_controller.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Bin::V1x0 4 | class ReleaseArtifactsController < ::Api::V1::ReleaseArtifactsController; end 5 | end 6 | -------------------------------------------------------------------------------- /app/controllers/concerns/authorization.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Authorization 4 | extend ActiveSupport::Concern 5 | end 6 | -------------------------------------------------------------------------------- /app/controllers/concerns/current_request_attributes.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module CurrentRequestAttributes 4 | extend ActiveSupport::Concern 5 | 6 | included do 7 | before_action do 8 | Current.api_version = RequestMigrations.config.request_version_resolver.call(request) 9 | Current.request_id = request.request_id = UUID7.generate 10 | Current.host = request.host 11 | Current.ip = request.remote_ip 12 | end 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /app/controllers/concerns/default_url_options.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module DefaultUrlOptions 4 | extend ActiveSupport::Concern 5 | 6 | class_methods do 7 | # FIXME(ezekg) Why is this needed? 8 | def default_url_options(...) = Rails.application.default_url_options(...) 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /app/helpers/url_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module UrlHelper 4 | include Rails.application.routes.url_helpers 5 | 6 | def default_url_options = Rails.application.default_url_options 7 | end 8 | -------------------------------------------------------------------------------- /app/mailers/application_mailer.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class ApplicationMailer < ActionMailer::Base 4 | DEFAULT_FROM_EMAIL = ENV.fetch('KEYGEN_FROM_EMAIL') { 'noreply@keygen.sh' } 5 | .freeze 6 | 7 | default from: "Keygen Support <#{DEFAULT_FROM_EMAIL}>" 8 | default precedence: 'normal' 9 | end 10 | -------------------------------------------------------------------------------- /app/migrations/base_migration.rb: -------------------------------------------------------------------------------- 1 | class BaseMigration < RequestMigrations::Migration 2 | include Rails.application.routes.url_helpers 3 | end 4 | -------------------------------------------------------------------------------- /app/models/concerns/idempotentable.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Idempotentable 4 | extend ActiveSupport::Concern 5 | include Tokenable 6 | 7 | included do 8 | after_initialize :set_idempotency_token, if: -> { idempotency_token.nil? } 9 | end 10 | 11 | private 12 | 13 | def set_idempotency_token 14 | self.idempotency_token = generate_token :idempotency_token, length: 32 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /app/models/concerns/orderable.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Orderable 4 | extend ActiveSupport::Concern 5 | 6 | included do 7 | scope :with_order, -> order { 8 | case order.to_s.upcase 9 | when 'DESC' 10 | reorder(created_at: :desc) 11 | when 'ASC' 12 | reorder(created_at: :asc) 13 | else 14 | raise Keygen::Error::InvalidParameterError.new(parameter: 'order'), 'order is invalid' 15 | end 16 | } 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /app/models/null_billing.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class NullBilling < NullObject 4 | def state = 'subscribed' 5 | def subscribed? = true 6 | def canceled? = false 7 | def trialing? = false 8 | def active? = true 9 | def card = nil 10 | end 11 | -------------------------------------------------------------------------------- /app/models/null_object.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class NullObject 4 | def present? = false 5 | def blank? = true 6 | def nil? = true 7 | end 8 | -------------------------------------------------------------------------------- /app/models/receipt.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class Receipt < ApplicationRecord 4 | belongs_to :billing 5 | 6 | scope :unpaid, -> { where paid: false } 7 | scope :paid, -> { where paid: true } 8 | end 9 | -------------------------------------------------------------------------------- /app/models/token_permission.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class TokenPermission < ApplicationRecord 4 | belongs_to :token 5 | belongs_to :permission 6 | 7 | # FIXME(ezekg) should have an account_id foreign key 8 | delegate :account, :account_id, 9 | allow_nil: true, 10 | to: :token 11 | 12 | def self.actions 13 | joins(:permission).reorder('permissions.action ASC') 14 | .pluck('permissions.action') 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /app/policies/accounts/analytics_policy.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Accounts 4 | class AnalyticsPolicy < ApplicationPolicy 5 | def show? 6 | verify_permissions!('account.analytics.read') 7 | verify_environment! 8 | 9 | case bearer 10 | in role: Role(:admin | :developer | :sales_agent | :support_agent | :read_only) 11 | allow! 12 | else 13 | deny! 14 | end 15 | end 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /app/policies/nil_class_policy.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class NilClassPolicy < ApplicationPolicy 4 | def index? = deny! 5 | def show? = deny! 6 | def create? = deny! 7 | def update? = deny! 8 | def destroy? = deny! 9 | end 10 | -------------------------------------------------------------------------------- /app/policies/plan_policy.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class PlanPolicy < ApplicationPolicy 4 | skip_pre_check :verify_authenticated! 5 | 6 | authorize :account, allow_nil: true 7 | 8 | def index? = allow! 9 | def show? = allow! 10 | end 11 | -------------------------------------------------------------------------------- /app/policies/release_engines/oci/release_policy.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module ReleaseEngines::Oci 4 | class ReleasePolicy < ::ReleasePolicy; end 5 | end 6 | -------------------------------------------------------------------------------- /app/policies/search_policy.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class SearchPolicy < ApplicationPolicy 4 | def search? 5 | verify_environment!( 6 | strict: false, 7 | ) 8 | 9 | case bearer 10 | in role: Role(:admin | :developer | :read_only | :sales_agent | :support_agent) 11 | allow! 12 | else 13 | deny! 14 | end 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /app/services/base_service.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class BaseService 4 | def call 5 | raise NotImplementedError, '#call must be implemented by the service' 6 | end 7 | 8 | def self.call!(...) 9 | new(...).call! 10 | end 11 | 12 | def self.call(...) 13 | new(...).call 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /app/services/billings/base_service.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'stripe' 4 | 5 | module Billings 6 | Event = ::Stripe::Event 7 | BillingPortal = ::Stripe::BillingPortal 8 | Subscription = ::Stripe::Subscription 9 | Schedule = ::Stripe::SubscriptionSchedule 10 | Customer = ::Stripe::Customer 11 | Error = ::Stripe::StripeError 12 | 13 | class BaseService < ::BaseService; end 14 | end 15 | -------------------------------------------------------------------------------- /app/services/billings/delete_customer_service.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Billings 4 | class DeleteCustomerService < BaseService 5 | 6 | def initialize(customer:) 7 | @customer = customer 8 | end 9 | 10 | def call 11 | c = Billings::Customer.retrieve(customer) 12 | c.delete 13 | rescue Billings::Error => e 14 | Keygen.logger.exception(e) 15 | 16 | nil 17 | end 18 | 19 | private 20 | 21 | attr_reader :customer 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /app/services/billings/retrieve_event_service.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Billings 4 | class RetrieveEventService < BaseService 5 | 6 | def initialize(event:) 7 | @event = event 8 | end 9 | 10 | def call 11 | Billings::Event.retrieve(event) 12 | rescue Billings::Error => e 13 | Keygen.logger.exception(e) 14 | 15 | nil 16 | end 17 | 18 | private 19 | 20 | attr_reader :event 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /app/services/template_format_service.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class TemplateFormatService < BaseService 4 | TEMPLATE_FORMAT_RE = /{{(\w+)}}/i 5 | 6 | def initialize(template:, **vars) 7 | @template = template.to_s 8 | @vars = vars.with_indifferent_access 9 | end 10 | 11 | def call 12 | template.gsub(TEMPLATE_FORMAT_RE) { vars[$1.underscore.parameterize(separator: '_')] } 13 | end 14 | 15 | private 16 | 17 | attr_reader :template, 18 | :vars 19 | end 20 | -------------------------------------------------------------------------------- /app/views/layouts/simple.html.haml: -------------------------------------------------------------------------------- 1 | -# frozen_string_literal: true 2 | !!! 3 | %html 4 | %head 5 | %title= yield :title 6 | = yield :head 7 | %body 8 | = yield 9 | -------------------------------------------------------------------------------- /app/workers/base_worker.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class BaseWorker 4 | include Sidekiq::Worker 5 | 6 | sidekiq_options cronitor_disabled: true 7 | end 8 | -------------------------------------------------------------------------------- /app/workers/event_log_worker2.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # FIXME(ezekg) rename after old worker queue drains 4 | class EventLogWorker2 < BaseWorker 5 | include PerformBulk::Job 6 | 7 | sidekiq_options queue: :logs 8 | 9 | def perform(*event_logs_attributes) 10 | EventLog.insert_all(event_logs_attributes) 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /app/workers/request_log_worker2.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # FIXME(ezekg) rename after old worker queue drains 4 | class RequestLogWorker2 < BaseWorker 5 | include PerformBulk::Job 6 | 7 | sidekiq_options queue: :logs 8 | 9 | def perform(*request_logs_attributes) 10 | RequestLog.insert_all(request_logs_attributes) 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /app/workers/vacuum_analyze_event_logs_worker.rb: -------------------------------------------------------------------------------- 1 | class VacuumAnalyzeEventLogsWorker < BaseWorker 2 | STATEMENT_TIMEOUT = ENV.fetch('KEYGEN_VACUUM_STATEMENT_TIMEOUT') { '5min' } 3 | 4 | sidekiq_options queue: :cron, 5 | cronitor_disabled: false 6 | 7 | def perform 8 | EventLog.statement_timeout(STATEMENT_TIMEOUT) do |conn| 9 | conn.execute 'VACUUM ANALYZE event_logs' 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /app/workers/vacuum_analyze_metrics_worker.rb: -------------------------------------------------------------------------------- 1 | class VacuumAnalyzeMetricsWorker < BaseWorker 2 | STATEMENT_TIMEOUT = ENV.fetch('KEYGEN_VACUUM_STATEMENT_TIMEOUT') { '5min' } 3 | 4 | sidekiq_options queue: :cron, 5 | cronitor_disabled: false 6 | 7 | def perform 8 | Metric.statement_timeout(STATEMENT_TIMEOUT) do |conn| 9 | conn.execute 'VACUUM ANALYZE metrics' 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /app/workers/vacuum_analyze_request_logs_worker.rb: -------------------------------------------------------------------------------- 1 | class VacuumAnalyzeRequestLogsWorker < BaseWorker 2 | STATEMENT_TIMEOUT = ENV.fetch('KEYGEN_VACUUM_STATEMENT_TIMEOUT') { '5min' } 3 | 4 | sidekiq_options queue: :cron, 5 | cronitor_disabled: false 6 | 7 | def perform 8 | RequestLog.statement_timeout(STATEMENT_TIMEOUT) do |conn| 9 | conn.execute 'VACUUM ANALYZE request_logs' 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /app/workers/vacuum_analyze_webhook_events_worker.rb: -------------------------------------------------------------------------------- 1 | class VacuumAnalyzeWebhookEventsWorker < BaseWorker 2 | STATEMENT_TIMEOUT = ENV.fetch('KEYGEN_VACUUM_STATEMENT_TIMEOUT') { '5min' } 3 | 4 | sidekiq_options queue: :cron, 5 | cronitor_disabled: false 6 | 7 | def perform 8 | WebhookEvent.statement_timeout(STATEMENT_TIMEOUT) do |conn| 9 | conn.execute 'VACUUM ANALYZE webhook_events' 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /app/workers/yank_artifact_worker.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class YankArtifactWorker < BaseWorker 4 | sidekiq_options queue: :critical 5 | 6 | def perform(artifact_id) 7 | artifact = ReleaseArtifact.find(artifact_id) 8 | 9 | artifact.client.delete_object( 10 | bucket: artifact.bucket, 11 | key: artifact.key, 12 | ) 13 | 14 | artifact.destroy 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /bin/bundle: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 3 | load Gem.bin_path('bundler', 'bundle') 4 | -------------------------------------------------------------------------------- /bin/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | APP_PATH = File.expand_path("../config/application", __dir__) 3 | require_relative "../config/boot" 4 | require "rails/commands" 5 | -------------------------------------------------------------------------------- /bin/rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require_relative "../config/boot" 3 | require "rake" 4 | Rake.application.run 5 | -------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # This file is used by Rack-based servers to start the application. 4 | 5 | require_relative 'config/environment' 6 | 7 | run Rails.application 8 | -------------------------------------------------------------------------------- /config/boot.rb: -------------------------------------------------------------------------------- 1 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) 2 | 3 | require "bundler/setup" # Set up gems listed in the Gemfile. 4 | -------------------------------------------------------------------------------- /config/cable.yml: -------------------------------------------------------------------------------- 1 | # Action Cable uses Redis by default to administer connections, channels, and sending/receiving messages over the WebSocket. 2 | production: 3 | adapter: redis 4 | url: redis://localhost:6379/1 5 | 6 | development: 7 | adapter: async 8 | 9 | test: 10 | adapter: async 11 | -------------------------------------------------------------------------------- /config/environment.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Load the Rails application. 4 | require_relative 'application' 5 | 6 | # Initialize the Rails application. 7 | Rails.application.initialize! 8 | -------------------------------------------------------------------------------- /config/initializers/application_controller_renderer.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Be sure to restart your server when you modify this file. 4 | 5 | # ApplicationController.renderer.defaults.merge!( 6 | # http_host: 'example.org', 7 | # https: false 8 | # ) 9 | -------------------------------------------------------------------------------- /config/initializers/cache_key_version.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # NOTE(ezekg) This saves us the headache of busting caches when upgrading 4 | # Rails (which has caused downtime before). 5 | rails_major_version, rails_minor_version, * = Rails.version.split('.') 6 | 7 | CACHE_KEY_VERSION = "v#{rails_major_version}.#{rails_minor_version}" 8 | -------------------------------------------------------------------------------- /config/initializers/cache_logger.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | Rails.cache.logger = Rails.logger 4 | -------------------------------------------------------------------------------- /config/initializers/crypto.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | RSA_KEY_SIZE = 2048 4 | RSA_MAX_BYTE_SIZE = RSA_KEY_SIZE / 8 - 11 5 | -------------------------------------------------------------------------------- /config/initializers/digest_io.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require_dependency Rails.root / 'lib' / 'digest_io' 4 | -------------------------------------------------------------------------------- /config/initializers/enumerator_io.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require_dependency Rails.root / 'lib' / 'enumerator_io' 4 | -------------------------------------------------------------------------------- /config/initializers/envented.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require_dependency Rails.root / 'lib' / 'envented' 4 | -------------------------------------------------------------------------------- /config/initializers/filter_parameter_logging.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # Be sure to restart your server when you modify this file. 4 | 5 | # Configure sensitive parameters which will be filtered from the log file. 6 | Rails.application.config.filter_parameters += %i[ 7 | password 8 | token 9 | passw 10 | secret 11 | private_key 12 | salt 13 | otp 14 | ssn 15 | auth 16 | ] 17 | -------------------------------------------------------------------------------- /config/initializers/has_scope.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | HasScope.tap do |config| 4 | config::ALLOWED_TYPES[:any] = [[String, Numeric, Array, Hash, ActionController::Parameters]] 5 | end 6 | -------------------------------------------------------------------------------- /config/initializers/kaminari_config.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | Kaminari.configure do |config| 4 | # config.default_per_page = 25 5 | # config.max_per_page = nil 6 | # config.window = 4 7 | # config.outer_window = 0 8 | # config.left = 0 9 | # config.right = 0 10 | config.page_method_name = :paginate 11 | config.param_name = :page 12 | end 13 | -------------------------------------------------------------------------------- /config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | Mime::Type.register 'application/octet-stream', :binary 4 | Mime::Type.register 'application/vnd.api+json', :jsonapi, %w[ 5 | application/vnd.keygen+json 6 | ] 7 | 8 | # adds pattern matching 9 | class Mime::Type 10 | def deconstruct_keys(*) = { string:, symbol:, synonyms: } 11 | def deconstruct = [symbol] 12 | end 13 | -------------------------------------------------------------------------------- /config/initializers/oj_json.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'oj' 4 | 5 | Oj::Rails.tap do |oj| 6 | oj.set_encoder 7 | oj.set_decoder 8 | oj.optimize 9 | oj.mimic_JSON 10 | end 11 | -------------------------------------------------------------------------------- /config/initializers/perform_bulk.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require_dependency Rails.root / 'lib' / 'perform_bulk' 4 | -------------------------------------------------------------------------------- /config/initializers/rack_timeout.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | middleware = Rails.application.config.middleware 4 | 5 | middleware.insert_before 0, Rack::Timeout 6 | -------------------------------------------------------------------------------- /config/initializers/redis.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | Redis.silence_deprecations = Rails.env.production? 4 | -------------------------------------------------------------------------------- /config/initializers/slack.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require_dependency Rails.root / 'lib' / 'slack' 4 | 5 | SLACK_SIGNING_SECRET = ENV['SLACK_SIGNING_SECRET'] 6 | SLACK_TOKEN = ENV['SLACK_TOKEN'] 7 | SLACK_ADMIN_EMAIL = ENV['SLACK_ADMIN_EMAIL'] 8 | SLACK_TEAM_ID = ENV['SLACK_TEAM_ID'] 9 | -------------------------------------------------------------------------------- /config/initializers/strong_migrations.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | StrongMigrations.tap do |config| 4 | # migrations created prior to installing the gem are safe 5 | config.start_after = 2024_04_03_173726 6 | 7 | # timeouts 8 | config.lock_timeout = 10.seconds 9 | config.statement_timeout = 1.hour 10 | end 11 | -------------------------------------------------------------------------------- /config/initializers/workos.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | WORKOS_CLIENT_ID = ENV['WORKOS_CLIENT_ID'] 4 | WORKOS_API_KEY = ENV['WORKOS_API_KEY'] 5 | 6 | WorkOS.configure do |config| 7 | config.key = WORKOS_API_KEY 8 | end 9 | -------------------------------------------------------------------------------- /config/initializers/zietwork.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | Rails.autoloaders.each do |autoloader| 4 | # FIXME(ezekg) Should we rename these to follow conventions? 5 | autoloader.inflector.inflect( 6 | 'enumerator_io' => 'EnumeratorIO', 7 | 'digest_io' => 'DigestIO', 8 | 'jsonapi' => 'JSONAPI', 9 | 'ee' => 'EE', 10 | 'sso' => 'SSO', 11 | ) 12 | end 13 | -------------------------------------------------------------------------------- /config/sidekiq.yml: -------------------------------------------------------------------------------- 1 | :concurrency: <%= ENV['SIDEKIQ_CONCURRENCY'] || 10 %> 2 | :queues: 3 | # NOTE(ezekg) The higher the weight, the more often it is checked. 4 | - [critical, 10] 5 | - [deletes, 6] # Deprecated 6 | - [webhooks, 5] 7 | - [default, 4] 8 | - [mailers, 3] 9 | - [billing, 2] 10 | - [metrics, 1] 11 | - [system, 1] # Deprecated 12 | - [logs, 1] 13 | - [cron, 1] 14 | -------------------------------------------------------------------------------- /config/spring.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | %w( 4 | .ruby-version 5 | .rbenv-vars 6 | tmp/restart.txt 7 | tmp/caching-dev.txt 8 | ).each { |path| Spring.watch(path) } 9 | -------------------------------------------------------------------------------- /config/whacamole.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | Whacamole.configure ENV['WHACAMOLE_APP_NAME'] do |config| 4 | config.api_token = ENV['WHACAMOLE_API_TOKEN'] 5 | config.dynos = %w[web] 6 | config.restart_threshold = ENV.fetch('WHACAMOLE_RESTART_THRESHOLD') { 500 }.to_i 7 | config.restart_window = ENV.fetch('WHACAMOLE_RESTART_WINDOW') { 30 * 60 }.to_i 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20160521203749_create_licenses.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class CreateLicenses < ActiveRecord::Migration[5.0] 4 | def change 5 | create_table :licenses do |t| 6 | t.string :key 7 | t.datetime :expiry 8 | t.integer :activations 9 | t.references :user 10 | 11 | t.timestamps 12 | end 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /db/migrate/20160521203755_create_policies.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class CreatePolicies < ActiveRecord::Migration[5.0] 4 | def change 5 | create_table :policies do |t| 6 | t.string :name 7 | t.integer :price 8 | t.integer :duration 9 | t.boolean :strict 10 | t.boolean :recurring 11 | t.boolean :floating 12 | t.boolean :use_pool 13 | 14 | t.timestamps 15 | end 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /db/migrate/20160521203951_create_users.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class CreateUsers < ActiveRecord::Migration[5.0] 4 | def change 5 | create_table :users do |t| 6 | t.string :name 7 | t.string :email 8 | t.string :password_digest 9 | t.string :role 10 | t.integer :account_id 11 | 12 | t.timestamps 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /db/migrate/20160521205600_create_accounts.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class CreateAccounts < ActiveRecord::Migration[5.0] 4 | def change 5 | create_table :accounts do |t| 6 | t.string :name 7 | t.string :email 8 | t.string :subdomain 9 | 10 | t.timestamps 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /db/migrate/20160523033249_add_license_to_users.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddLicenseToUsers < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :users, :license_id, :integer 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20160523033613_add_policy_to_license.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddPolicyToLicense < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :licenses, :policy_id, :integer 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20160523033950_add_account_to_policies.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddAccountToPolicies < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :policies, :account_id, :integer 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20160523035909_add_active_machines_to_licenses.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddActiveMachinesToLicenses < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :licenses, :active_machines, :string 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20160523040214_add_pool_to_policies.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddPoolToPolicies < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :policies, :pool, :string 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20160523141521_add_plan_to_accounts.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddPlanToAccounts < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :accounts, :plan_id, :integer 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20160523144935_create_plans.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class CreatePlans < ActiveRecord::Migration[5.0] 4 | def change 5 | create_table :plans do |t| 6 | t.string :name 7 | t.integer :price 8 | t.integer :max_users 9 | t.integer :max_policies 10 | t.integer :max_licenses 11 | 12 | t.timestamps 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /db/migrate/20160530024204_add_auth_token_to_users.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddAuthTokenToUsers < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :users, :auth_token, :string 6 | add_column :users, :reset_auth_token, :string 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20160530033523_add_password_reset_to_users.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddPasswordResetToUsers < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :users, :password_reset_token, :string 6 | add_column :users, :password_reset_sent_at, :datetime 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20160530040830_add_default_value_to_role.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddDefaultValueToRole < ActiveRecord::Migration[5.0] 4 | def change 5 | change_column :users, :role, :string, default: "user" 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20160530044342_remove_email_from_accounts.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class RemoveEmailFromAccounts < ActiveRecord::Migration[5.0] 4 | def change 5 | remove_column :accounts, :email, :string 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20160530050836_create_billings.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class CreateBillings < ActiveRecord::Migration[5.0] 4 | def change 5 | create_table :billings do |t| 6 | t.string :stripe_id 7 | t.string :status 8 | 9 | t.timestamps 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /db/migrate/20160530051016_add_billing_to_users.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddBillingToUsers < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :users, :billing_id, :integer 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20160530051022_add_billing_to_accounts.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddBillingToAccounts < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :accounts, :billing_id, :integer 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20160601022240_add_customer_to_billings.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddCustomerToBillings < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :billings, :customer_id, :integer 6 | add_column :billings, :customer_type, :string 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20160601023618_remove_billing_id_from_users.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class RemoveBillingIdFromUsers < ActiveRecord::Migration[5.0] 4 | def change 5 | remove_column :users, :billing_id, :integer 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20160601023633_remove_billing_id_from_accounts.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class RemoveBillingIdFromAccounts < ActiveRecord::Migration[5.0] 4 | def change 5 | remove_column :accounts, :billing_id, :integer 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20160601145430_add_lock_version_to_policies.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddLockVersionToPolicies < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :policies, :lock_version, :integer, default: 0, null: false 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20160605002506_create_products.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class CreateProducts < ActiveRecord::Migration[5.0] 4 | def change 5 | create_table :products do |t| 6 | t.string :name 7 | t.string :platforms 8 | t.integer :account_id 9 | 10 | t.timestamps 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /db/migrate/20160605003217_add_product_id_to_users.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddProductIdToUsers < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :users, :product_id, :integer 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20160605003223_add_product_id_to_policies.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddProductIdToPolicies < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :policies, :product_id, :integer 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20160605003647_add_max_products_to_plans.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddMaxProductsToPlans < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :plans, :max_products, :integer 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20160605004207_remove_license_id_from_users.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class RemoveLicenseIdFromUsers < ActiveRecord::Migration[5.0] 4 | def change 5 | remove_column :users, :license_id, :integer 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20160606164154_create_products_users.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class CreateProductsUsers < ActiveRecord::Migration[5.0] 4 | def change 5 | create_table :products_users do |t| 6 | t.references :product 7 | t.references :user 8 | end 9 | add_index :products_users, [:user_id, :product_id], unique: true 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20160606171944_remove_account_id_from_policies.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class RemoveAccountIdFromPolicies < ActiveRecord::Migration[5.0] 4 | def change 5 | remove_column :policies, :account_id, :integer 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20160606173406_remove_product_id_from_users.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class RemoveProductIdFromUsers < ActiveRecord::Migration[5.0] 4 | def change 5 | remove_column :users, :product_id, :integer 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20160606200838_add_account_id_to_policies.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddAccountIdToPolicies < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :policies, :account_id, :integer 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20160606200844_add_account_id_to_licenses.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddAccountIdToLicenses < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :licenses, :account_id, :integer 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20160608001847_add_status_to_accounts.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddStatusToAccounts < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :accounts, :status, :string, default: "active" 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20160610015703_remove_activations_from_licenses.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class RemoveActivationsFromLicenses < ActiveRecord::Migration[5.0] 4 | def change 5 | remove_column :licenses, :activations, :integer 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20160610225535_add_max_activations_to_policy.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddMaxActivationsToPolicy < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :policies, :max_activations, :integer 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20160611211620_add_activation_to_accounts.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddActivationToAccounts < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :accounts, :activation_token, :string 6 | add_column :accounts, :activation_sent_at, :datetime 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20160611212320_add_activated_to_accounts.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddActivatedToAccounts < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :accounts, :activated, :boolean, default: false 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20160613172328_add_meta_to_users.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddMetaToUsers < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :users, :meta, :string 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20160624200649_change_stripe_id.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class ChangeStripeId < ActiveRecord::Migration[5.0] 4 | def change 5 | rename_column :billings, :stripe_id, :external_customer_id 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20160624222452_add_external_plan_id_to_plans.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddExternalPlanIdToPlans < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :plans, :external_plan_id, :string 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20160624225008_add_external_subscription_id_to_billings.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddExternalSubscriptionIdToBillings < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :billings, :external_subscription_id, :string 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20160625170213_add_external_subscription_periods_to_billings.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddExternalSubscriptionPeriodsToBillings < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :billings, :external_subscription_period_start, :datetime 6 | add_column :billings, :external_subscription_period_end, :datetime 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20160625172108_change_status_on_billings.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class ChangeStatusOnBillings < ActiveRecord::Migration[5.0] 4 | def change 5 | rename_column :billings, :status, :external_status 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20160823140738_create_machines.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class CreateMachines < ActiveRecord::Migration[5.0] 4 | def change 5 | create_table :machines do |t| 6 | t.string :fingerprint 7 | t.string :ip 8 | t.string :hostname 9 | t.string :platform 10 | t.integer :account_id 11 | t.integer :license_id 12 | 13 | t.timestamps 14 | end 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /db/migrate/20160823141837_add_name_to_machines.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddNameToMachines < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :machines, :name, :string 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20160823142134_add_user_id_to_machines.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddUserIdToMachines < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :machines, :user_id, :integer 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20160823144125_create_pools.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class CreatePools < ActiveRecord::Migration[5.0] 4 | def change 5 | create_table :pools do |t| 6 | t.string :key 7 | t.integer :policy_id 8 | 9 | t.timestamps 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /db/migrate/20160823150843_add_account_id_to_pools.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddAccountIdToPools < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :pools, :account_id, :integer 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20160823161731_rename_pools.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class RenamePools < ActiveRecord::Migration[5.0] 4 | def change 5 | rename_table :pools, :keys 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20160823162151_remove_pool_from_policies.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class RemovePoolFromPolicies < ActiveRecord::Migration[5.0] 4 | def change 5 | remove_column :policies, :pool, :string 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20160823170245_create_tokens.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class CreateTokens < ActiveRecord::Migration[5.0] 4 | def change 5 | create_table :tokens do |t| 6 | t.string :auth_token 7 | t.string :reset_token 8 | t.integer :bearer_id 9 | t.string :bearer_type 10 | 11 | t.timestamps 12 | end 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /db/migrate/20160823171439_add_account_id_to_tokens.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddAccountIdToTokens < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :tokens, :account_id, :integer 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20160823222717_rename_max_activations.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class RenameMaxActivations < ActiveRecord::Migration[5.0] 4 | def change 5 | rename_column :policies, :max_activations, :max_machines 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20160824140927_remove_active_machines_from_licenses.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class RemoveActiveMachinesFromLicenses < ActiveRecord::Migration[5.0] 4 | def change 5 | remove_column :licenses, :active_machines, :string 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20160922154405_remove_auth_token_from_users.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class RemoveAuthTokenFromUsers < ActiveRecord::Migration[5.0] 4 | def change 5 | remove_column :users, :auth_token, :string 6 | remove_column :users, :reset_auth_token, :string 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20160927225336_remove_role_from_users.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class RemoveRoleFromUsers < ActiveRecord::Migration[5.0] 4 | def change 5 | remove_column :users, :role, :string 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20160930194911_add_card_details_to_billings.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddCardDetailsToBillings < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :billings, :card_expiry, :timestamp 6 | add_column :billings, :card_brand, :string 7 | add_column :billings, :card_last4, :string 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20160930210412_rename_external_status_for_billings.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class RenameExternalStatusForBillings < ActiveRecord::Migration[5.0] 4 | def change 5 | rename_column :billings, :external_status, :external_subscription_status 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20161002141658_remove_user_id_from_machine.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class RemoveUserIdFromMachine < ActiveRecord::Migration[5.0] 4 | def change 5 | remove_column :machines, :user_id, :integer 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20161003231717_create_webhook_endpoints.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class CreateWebhookEndpoints < ActiveRecord::Migration[5.0] 4 | def change 5 | create_table :webhook_endpoints do |t| 6 | t.integer :account_id 7 | t.string :url 8 | 9 | t.timestamps 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /db/migrate/20161004141729_create_webhook_events.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class CreateWebhookEvents < ActiveRecord::Migration[5.0] 4 | def change 5 | create_table :webhook_events do |t| 6 | t.integer :account_id 7 | t.string :payload 8 | t.string :jid 9 | 10 | t.timestamps 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /db/migrate/20161004173254_add_endpoint_to_webhook_events.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddEndpointToWebhookEvents < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :webhook_events, :endpoint, :string 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20161004214055_add_indices_to_webhooks.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddIndicesToWebhooks < ActiveRecord::Migration[5.0] 4 | def change 5 | add_index :webhook_endpoints, :account_id 6 | 7 | add_index :webhook_events, :account_id 8 | add_index :webhook_events, :jid 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20161014211305_drop_products_users_table.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class DropProductsUsersTable < ActiveRecord::Migration[5.0] 4 | def up 5 | drop_table :products_users 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20161016210357_add_encryption_to_tokens.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddEncryptionToTokens < ActiveRecord::Migration[5.0] 4 | def up 5 | rename_column :tokens, :auth_token, :digest 6 | remove_column :tokens, :reset_token 7 | remove_index :tokens, :digest 8 | end 9 | 10 | def down 11 | raise ActiveRecord::IrreversibleMigration 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /db/migrate/20161019163352_drop_tokens_roles_table.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class DropTokensRolesTable < ActiveRecord::Migration[5.0] 4 | def up 5 | drop_table :tokens_roles 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20161025160227_add_state_to_billings.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddStateToBillings < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :billings, :aasm_state, :string 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20161025160259_remove_status_from_accounts.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class RemoveStatusFromAccounts < ActiveRecord::Migration[5.0] 4 | def change 5 | remove_column :accounts, :status, :string 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20161025161721_remove_activated_from_accounts.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class RemoveActivatedFromAccounts < ActiveRecord::Migration[5.0] 4 | def change 5 | remove_column :accounts, :activated, :boolean 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20161025164655_rename_aasm_state_to_state_for_billings.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class RenameAasmStateToStateForBillings < ActiveRecord::Migration[5.0] 4 | def change 5 | rename_column :billings, :aasm_state, :state 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20161025195849_create_receipts.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class CreateReceipts < ActiveRecord::Migration[5.0] 4 | def change 5 | create_table :receipts do |t| 6 | t.integer :billing_id 7 | t.string :invoice_id 8 | t.integer :amount 9 | t.boolean :paid 10 | 11 | t.timestamps 12 | end 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /db/migrate/20161109161426_add_meta_to_licenses.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddMetaToLicenses < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :licenses, :meta, :string 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20161109161432_add_meta_to_policies.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddMetaToPolicies < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :policies, :meta, :string 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20161109161438_add_meta_to_machines.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddMetaToMachines < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :machines, :meta, :string 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20161109161521_add_meta_to_products.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddMetaToProducts < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :products, :meta, :string 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20161109162223_add_encrypted_to_policies.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddEncryptedToPolicies < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :policies, :encrypted, :boolean, default: false 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20161109175721_add_fingerprint_index_to_machines.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddFingerprintIndexToMachines < ActiveRecord::Migration[5.0] 4 | def change 5 | add_index :machines, :fingerprint 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20161110144731_add_expiry_to_tokens.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddExpiryToTokens < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :tokens, :expiry, :datetime 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20161110200754_add_key_index_to_licenses.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddKeyIndexToLicenses < ActiveRecord::Migration[5.0] 4 | def change 5 | add_index :licenses, :key 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20161113062255_add_protected_to_policies.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddProtectedToPolicies < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :policies, :protected, :boolean, default: false 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20161118203800_change_payload_type.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class ChangePayloadType < ActiveRecord::Migration[5.0] 4 | def change 5 | change_column :webhook_events, :payload, :text 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20161122225420_rename_meta_to_metadata.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class RenameMetaToMetadata < ActiveRecord::Migration[5.0] 4 | def change 5 | rename_column :licenses, :meta, :metadata 6 | 7 | rename_column :machines, :meta, :metadata 8 | 9 | rename_column :policies, :meta, :metadata 10 | 11 | rename_column :products, :meta, :metadata 12 | 13 | rename_column :users, :meta, :metadata 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /db/migrate/20161128221435_rename_subdomain_and_name_for_accounts.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class RenameSubdomainAndNameForAccounts < ActiveRecord::Migration[5.0] 4 | def change 5 | rename_column :accounts, :name, :company 6 | rename_column :accounts, :subdomain, :name 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20161212161422_rename_account_attributes.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class RenameAccountAttributes < ActiveRecord::Migration[5.0] 4 | def change 5 | rename_column :accounts, :name, :slug 6 | rename_column :accounts, :company, :name 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20161216192024_enable_uuid_extension.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class EnableUuidExtension < ActiveRecord::Migration[5.0] 4 | def change 5 | enable_extension "uuid-ossp" 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20161216194507_remove_friendly_ids.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class RemoveFriendlyIds < ActiveRecord::Migration[5.0] 4 | def up 5 | drop_table :friendly_id_slugs 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20161229170420_add_beta_invitations_to_accounts.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddBetaInvitationsToAccounts < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :accounts, :invite_state, :string 6 | add_column :accounts, :invite_token, :string 7 | add_column :accounts, :invite_sent_at, :timestamp 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20161230174909_add_idempotency_tokens_to_webhook_events.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddIdempotencyTokensToWebhookEvents < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :webhook_events, :idempotency_token, :string 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20170103225920_remove_activation_from_accounts.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class RemoveActivationFromAccounts < ActiveRecord::Migration[5.0] 4 | def change 5 | remove_column :accounts, :activation_token, :string 6 | remove_column :accounts, :activation_sent_at, :datetime 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20170105161602_add_protected_to_accounts.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddProtectedToAccounts < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :accounts, :protected, :boolean, default: false 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20170108191700_add_event_to_webhook_events.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddEventToWebhookEvents < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :webhook_events, :event, :string 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20170123141516_add_suspended_to_licenses.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddSuspendedToLicenses < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :licenses, :suspended, :boolean, default: false 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20170207171359_create_metrics.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class CreateMetrics < ActiveRecord::Migration[5.0] 4 | def change 5 | create_table :metrics, id: :uuid do |t| 6 | t.uuid :account_id 7 | t.string :metric 8 | t.jsonb :data 9 | 10 | t.timestamps 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /db/migrate/20170207230359_add_index_to_metrics.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddIndexToMetrics < ActiveRecord::Migration[5.0] 4 | def change 5 | add_index :metrics, [:created_at, :id], unique: true 6 | add_index :metrics, [:created_at, :account_id] 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20170207233326_remove_attributes_from_policies.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class RemoveAttributesFromPolicies < ActiveRecord::Migration[5.0] 4 | def change 5 | remove_column :policies, :price, :integer 6 | remove_column :policies, :recurring, :boolean 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20170220152847_change_name_fields_for_users.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class ChangeNameFieldsForUsers < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :users, :first_name, :string 6 | add_column :users, :last_name, :string 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20170220160538_remove_name_field_from_users.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class RemoveNameFieldFromUsers < ActiveRecord::Migration[5.0] 4 | def change 5 | remove_column :users, :name, :string 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20170314014254_update_max_machines_for_policies.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class UpdateMaxMachinesForPolicies < ActiveRecord::Migration[5.0] 4 | def change 5 | Policy.where(max_machines: nil).update_all max_machines: 1 6 | 7 | change_column_default :policies, :max_machines, 1 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20170314030836_update_floating_for_policies.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class UpdateFloatingForPolicies < ActiveRecord::Migration[5.0] 4 | def change 5 | change_column_default :policies, :floating, false 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20170425195815_add_private_to_plans.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddPrivateToPlans < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :plans, :private, :boolean, default: false 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20170502003137_add_unique_slug_index_to_accounts.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddUniqueSlugIndexToAccounts < ActiveRecord::Migration[5.0] 4 | def change 5 | add_index :accounts, [:created_at, :slug], unique: true 6 | add_index :accounts, :slug, unique: true 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20170509144501_remove_invite_state_from_accounts.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class RemoveInviteStateFromAccounts < ActiveRecord::Migration[5.0] 4 | def change 5 | remove_column :accounts, :invite_state 6 | remove_column :accounts, :invite_token 7 | remove_column :accounts, :invite_sent_at 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20170520205233_add_check_in_to_policies.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddCheckInToPolicies < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :policies, :check_in_duration, :string 6 | add_column :policies, :check_in_interval, :integer 7 | add_column :policies, :require_check_in, :boolean, default: false 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20170520205238_add_check_in_to_licenses.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddCheckInToLicenses < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :licenses, :last_check_in_at, :datetime 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20170530221041_add_trial_duration_to_plans.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddTrialDurationToPlans < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :plans, :trial_duration, :integer 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20170531143646_add_last_event_timestamps_to_licenses.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddLastEventTimestampsToLicenses < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :licenses, :last_expiration_event_sent_at, :datetime 6 | add_column :licenses, :last_check_in_event_sent_at, :datetime 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20170601145115_rename_check_in_fields_for_policies.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class RenameCheckInFieldsForPolicies < ActiveRecord::Migration[5.0] 4 | def change 5 | rename_column :policies, :check_in_interval, :check_in_interval_count 6 | rename_column :policies, :check_in_duration, :check_in_interval 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20170623141428_add_cron_event_fields_to_licenses.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddCronEventFieldsToLicenses < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :licenses, :last_expiring_soon_event_sent_at, :datetime 6 | add_column :licenses, :last_check_in_soon_event_sent_at, :datetime 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20170726144233_add_url_to_products.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddUrlToProducts < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :products, :url, :string 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20171013161238_change_max_machines_default_for_policies.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class ChangeMaxMachinesDefaultForPolicies < ActiveRecord::Migration[5.0] 4 | def change 5 | change_column_default :policies, :max_machines, nil 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20171016142634_change_protected_default_for_policies.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class ChangeProtectedDefaultForPolicies < ActiveRecord::Migration[5.0] 4 | def change 5 | change_column_default :policies, :protected, nil 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20171025153644_add_max_reqs_to_plans.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddMaxReqsToPlans < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :plans, :max_reqs, :integer 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20171025174051_add_max_admins_to_plans.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddMaxAdminsToPlans < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :plans, :max_admins, :integer 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20171107210504_enable_pg_stats_extension.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class EnablePgStatsExtension < ActiveRecord::Migration[5.0] 4 | def change 5 | enable_extension "pg_stat_statements" 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20171109155034_add_idempotency_token_index_for_webhook_events.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddIdempotencyTokenIndexForWebhookEvents < ActiveRecord::Migration[5.0] 4 | def change 5 | add_index :webhook_events, :idempotency_token 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20171213213747_add_index_for_license_keys.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddIndexForLicenseKeys < ActiveRecord::Migration[5.0] 4 | def change 5 | add_index :licenses, [:key, :created_at, :account_id] 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20171227201645_add_required_scopes_to_policies.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddRequiredScopesToPolicies < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :policies, :require_product_scope, :boolean, default: false 6 | add_column :policies, :require_policy_scope, :boolean, default: false 7 | add_column :policies, :require_machine_scope, :boolean, default: false 8 | add_column :policies, :require_fingerprint_scope, :boolean, default: false 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20180102202231_add_concurrent_to_policies.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddConcurrentToPolicies < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :policies, :concurrent, :boolean, default: true 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20180309035004_add_max_uses_to_policies.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddMaxUsesToPolicies < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :policies, :max_uses, :integer 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20180309035015_add_uses_to_licenses.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddUsesToLicenses < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :licenses, :uses, :integer, default: 0 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20180423205146_add_response_to_webhook_events.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddResponseToWebhookEvents < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :webhook_events, :last_response_code, :integer 6 | add_column :webhook_events, :last_response_body, :text 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20180511152944_add_index_to_token_digest.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddIndexToTokenDigest < ActiveRecord::Migration[5.0] 4 | def change 5 | add_index :tokens, [:digest, :created_at, :account_id], unique: true 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20180516174435_add_activation_fields_to_tokens.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddActivationFieldsToTokens < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :tokens, :max_activations, :integer 6 | add_column :tokens, :max_deactivations, :integer 7 | 8 | add_column :tokens, :activations, :integer, default: 0 9 | add_column :tokens, :deactivations, :integer, default: 0 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20180516223746_add_role_to_licenses.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddRoleToLicenses < ActiveRecord::Migration[5.0] 4 | def change 5 | License.find_each do |license| 6 | license.update role: Role.new(name: :license) 7 | end 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20180523141900_enable_btree_gin_extension.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class EnableBtreeGinExtension < ActiveRecord::Migration[5.0] 4 | def change 5 | enable_extension 'btree_gin' 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20180805070855_add_scheme_to_policies.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddSchemeToPolicies < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :policies, :scheme, :string 6 | 7 | # Mark all older policies with the legacy scheme 8 | legacy_policies = Policy.where encrypted: true, scheme: nil 9 | legacy_policies.update_all scheme: 'LEGACY_ENCRYPT' 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20180816022827_add_protected_to_licenses.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddProtectedToLicenses < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :licenses, :protected, :boolean 6 | 7 | # Update all licenses to inherit their policy's protected attribute 8 | License.connection.update(' 9 | UPDATE licenses AS l 10 | SET protected = p.protected 11 | FROM policies AS p 12 | WHERE l.policy_id = p.id 13 | ') 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /db/migrate/20180919204113_add_subscriptions_to_webhook_endpoints.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddSubscriptionsToWebhookEndpoints < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :webhook_endpoints, :subscriptions, :jsonb, default: ['*'] 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20180921132829_add_name_to_licenses.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddNameToLicenses < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :licenses, :name, :string 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20180921153258_drop_key_index_for_licenses.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class DropKeyIndexForLicenses < ActiveRecord::Migration[5.0] 4 | def change 5 | remove_index :licenses, name: :index_licenses_on_key_and_created_at_and_account_id 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20180925151249_add_name_tsv_index_to_licenses.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddNameTsvIndexToLicenses < ActiveRecord::Migration[5.0] 4 | def change 5 | add_index :licenses, %[to_tsvector('pg_catalog.simple', coalesce(name::TEXT, ''))], 6 | name: "licenses_tsv_name_idx", 7 | using: :gin 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20180927172712_add_max_machines_to_node_locked_policies.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddMaxMachinesToNodeLockedPolicies < ActiveRecord::Migration[5.0] 4 | def change 5 | policies = Policy.where floating: false 6 | policies.update_all max_machines: 1 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20181025150012_add_interval_to_plans.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddIntervalToPlans < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :plans, :interval, :string 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20181025164052_add_machines_counter_cache_to_licenses.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddMachinesCounterCacheToLicenses < ActiveRecord::Migration[5.0] 4 | def change 5 | add_column :licenses, :machines_count, :integer, default: 0 6 | 7 | License.find_each do |license| 8 | License.reset_counters license.id, :machines 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20181026185313_add_key_hash_index_to_licenses.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddKeyHashIndexToLicenses < ActiveRecord::Migration[5.0] 4 | def change 5 | add_index :licenses, :key, name: "licenses_hash_key_idx", using: :hash 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20181027145359_add_fingerprint_hash_index_to_machines.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddFingerprintHashIndexToMachines < ActiveRecord::Migration[5.0] 4 | def change 5 | add_index :machines, :fingerprint, name: "machines_hash_fingerprint_idx", using: :hash 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20181219165525_add_requestor_to_request_logs.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddRequestorToRequestLogs < ActiveRecord::Migration[5.2] 4 | def change 5 | add_column :request_logs, :requestor_type, :string 6 | add_column :request_logs, :requestor_id, :uuid 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20190125192607_add_index_to_metric_for_metrics.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddIndexToMetricForMetrics < ActiveRecord::Migration[5.2] 4 | disable_ddl_transaction! 5 | 6 | def change 7 | add_index :metrics, [:metric, :account_id, :created_at], algorithm: :concurrently 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20190527161025_add_last_heartbeat_at_to_machines.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class AddLastHeartbeatAtToMachines < ActiveRecord::Migration[5.2] 4 | def change 5 | add_column :machines, :last_heartbeat_at, :datetime 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20200819164545_change_metrics_metric_index.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class ChangeMetricsMetricIndex < ActiveRecord::Migration[5.2] 4 | disable_ddl_transaction! 5 | 6 | def change 7 | remove_index :metrics, [:metric, :account_id, :created_at] 8 | 9 | add_index :metrics, :metric, algorithm: :concurrently 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20200901161659_add_event_index_to_webhook_events.rb: -------------------------------------------------------------------------------- 1 | class AddEventIndexToWebhookEvents < ActiveRecord::Migration[5.2] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | add_index :webhook_events, :event, algorithm: :concurrently 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20200901161939_change_id_index_for_request_logs.rb: -------------------------------------------------------------------------------- 1 | class ChangeIdIndexForRequestLogs < ActiveRecord::Migration[5.2] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | remove_index :request_logs, [:id, :created_at] 6 | 7 | add_index :request_logs, [:request_id, :created_at], unique: true, algorithm: :concurrently 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20200902140942_update_metric_index_for_metrics.rb: -------------------------------------------------------------------------------- 1 | class UpdateMetricIndexForMetrics < ActiveRecord::Migration[5.2] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | remove_index :metrics, [:account_id, :created_at] 6 | remove_index :metrics, :metric 7 | 8 | add_index :metrics, [:account_id, :created_at, :metric], algorithm: :concurrently 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20200910202414_add_secret_key_to_accounts.rb: -------------------------------------------------------------------------------- 1 | class AddSecretKeyToAccounts < ActiveRecord::Migration[5.2] 2 | def change 3 | add_column :accounts, :secret_key, :text 4 | 5 | Account.find_each do |account| 6 | next if account.secret_key.present? 7 | 8 | account.send :generate_secret_key! # Private method 9 | account.save! validate: false 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /db/migrate/20200916174908_add_machine_heartbeat_duration_to_policies.rb: -------------------------------------------------------------------------------- 1 | class AddMachineHeartbeatDurationToPolicies < ActiveRecord::Migration[5.2] 2 | def change 3 | add_column :policies, :heartbeat_duration, :integer 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20200924153915_add_multi_column_index_for_metrics.rb: -------------------------------------------------------------------------------- 1 | class AddMultiColumnIndexForMetrics < ActiveRecord::Migration[5.2] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | add_index :metrics, [:created_at, :account_id, :metric], algorithm: :concurrently 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20200924154923_update_multi_column_index_for_metrics.rb: -------------------------------------------------------------------------------- 1 | class UpdateMultiColumnIndexForMetrics < ActiveRecord::Migration[5.2] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | remove_index :metrics, [:created_at, :account_id, :metric] 6 | 7 | add_index :metrics, [:account_id, :metric], algorithm: :concurrently 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20200924161033_revert_multi_column_index_for_metrics.rb: -------------------------------------------------------------------------------- 1 | class RevertMultiColumnIndexForMetrics < ActiveRecord::Migration[5.2] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | remove_index :metrics, [:account_id, :metric] 6 | 7 | add_index :metrics, [:account_id, :created_at, :metric], algorithm: :concurrently 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20200924171000_add_event_type_to_metrics.rb: -------------------------------------------------------------------------------- 1 | class AddEventTypeToMetrics < ActiveRecord::Migration[5.2] 2 | disable_ddl_transaction! 3 | 4 | def up 5 | unless column_exists?(:metrics, :event_type_id) 6 | add_column :metrics, :event_type_id, :uuid, null: true 7 | end 8 | add_index :metrics, :event_type_id, algorithm: :concurrently 9 | end 10 | 11 | def down 12 | remove_column :metrics, :event_type_id 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /db/migrate/20200924194746_add_event_type_to_webhook_events.rb: -------------------------------------------------------------------------------- 1 | class AddEventTypeToWebhookEvents < ActiveRecord::Migration[5.2] 2 | disable_ddl_transaction! 3 | 4 | def up 5 | unless column_exists?(:webhook_events, :event_type_id) 6 | add_column :webhook_events, :event_type_id, :uuid, null: true 7 | end 8 | add_index :webhook_events, :event_type_id, algorithm: :concurrently 9 | end 10 | 11 | def down 12 | remove_column :webhook_events, :event_type_id 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /db/migrate/20200925030545_remove_nullable_event_type_for_metrics.rb: -------------------------------------------------------------------------------- 1 | class RemoveNullableEventTypeForMetrics < ActiveRecord::Migration[5.2] 2 | def up 3 | change_column :metrics, :event_type_id, :uuid, null: false 4 | end 5 | 6 | def down 7 | change_column :metrics, :event_type_id, :uuid, null: true 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20200925030549_remove_nullable_event_type_for_webhook_events.rb: -------------------------------------------------------------------------------- 1 | class RemoveNullableEventTypeForWebhookEvents < ActiveRecord::Migration[5.2] 2 | def up 3 | change_column :webhook_events, :event_type_id, :uuid, null: false 4 | end 5 | 6 | def down 7 | change_column :webhook_events, :event_type_id, :uuid, null: true 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20200925215123_drop_indexes_for_metrics.rb: -------------------------------------------------------------------------------- 1 | class DropIndexesForMetrics < ActiveRecord::Migration[5.2] 2 | def change 3 | remove_index :metrics, [:account_id, :created_at, :metric] 4 | remove_index :metrics, :account_id 5 | remove_index :metrics, :created_at 6 | remove_index :metrics, :event_type_id 7 | remove_index :metrics, :metric 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20200925225600_add_seed_migration_indexes_for_metrics.rb: -------------------------------------------------------------------------------- 1 | class AddSeedMigrationIndexesForMetrics < ActiveRecord::Migration[5.2] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | add_index :metrics, :event_type_id, algorithm: :concurrently 6 | add_index :metrics, :metric, algorithm: :concurrently 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20200926141921_add_indexes_for_metrics.rb: -------------------------------------------------------------------------------- 1 | class AddIndexesForMetrics < ActiveRecord::Migration[5.2] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | add_index :metrics, [:account_id, :created_at, :event_type_id], algorithm: :concurrently 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20201001140831_update_indexes_for_metrics.rb: -------------------------------------------------------------------------------- 1 | class UpdateIndexesForMetrics < ActiveRecord::Migration[5.2] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | remove_index :metrics, [:account_id, :created_at, :event_type_id] 6 | remove_index :metrics, :metric 7 | 8 | add_index :metrics, [:account_id, :created_at], order: { created_at: :desc }, algorithm: :concurrently 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20201001141046_update_indexes_for_webhook_events.rb: -------------------------------------------------------------------------------- 1 | class UpdateIndexesForWebhookEvents < ActiveRecord::Migration[5.2] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | remove_index :webhook_events, [:account_id, :created_at] 6 | remove_index :webhook_events, :created_at 7 | remove_index :webhook_events, :event 8 | 9 | add_index :webhook_events, [:account_id, :created_at], order: { created_at: :desc }, algorithm: :concurrently 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20201203145314_add_fingerprint_uniqueness_strategy_to_policies.rb: -------------------------------------------------------------------------------- 1 | class AddFingerprintUniquenessStrategyToPolicies < ActiveRecord::Migration[5.2] 2 | def change 3 | add_column :policies, :fingerprint_uniqueness_strategy, :string, null: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20201203153606_add_default_fingerprint_uniqueness_strategy_to_policies.rb: -------------------------------------------------------------------------------- 1 | class AddDefaultFingerprintUniquenessStrategyToPolicies < ActiveRecord::Migration[5.2] 2 | def up 3 | Policy.update_all fingerprint_uniqueness_strategy: 'UNIQUE_PER_LICENSE' 4 | end 5 | 6 | def down 7 | Policy.update_all fingerprint_uniqueness_strategy: nil 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20201214151336_add_fingerprint_matching_strategy_to_policies.rb: -------------------------------------------------------------------------------- 1 | class AddFingerprintMatchingStrategyToPolicies < ActiveRecord::Migration[5.2] 2 | def change 3 | add_column :policies, :fingerprint_matching_strategy, :string, null: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20201214151403_add_default_fingerprint_matching_strategy_to_policies.rb: -------------------------------------------------------------------------------- 1 | class AddDefaultFingerprintMatchingStrategyToPolicies < ActiveRecord::Migration[5.2] 2 | def up 3 | Policy.update_all fingerprint_matching_strategy: 'MATCH_ANY' 4 | end 5 | 6 | def down 7 | Policy.update_all fingerprint_matching_strategy: nil 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20210122170212_drop_metric_for_metrics.rb: -------------------------------------------------------------------------------- 1 | class DropMetricForMetrics < ActiveRecord::Migration[5.2] 2 | def change 3 | remove_column :metrics, :metric 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210122170219_drop_event_for_webhook_events.rb: -------------------------------------------------------------------------------- 1 | class DropEventForWebhookEvents < ActiveRecord::Migration[5.2] 2 | def change 3 | remove_column :webhook_events, :event 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210201141823_add_last_validated_at_to_licenses.rb: -------------------------------------------------------------------------------- 1 | class AddLastValidatedAtToLicenses < ActiveRecord::Migration[5.2] 2 | def change 3 | add_column :licenses, :last_validated_at, :datetime 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210212224112_add_request_body_to_request_logs.rb: -------------------------------------------------------------------------------- 1 | class AddRequestBodyToRequestLogs < ActiveRecord::Migration[5.2] 2 | def change 3 | add_column :request_logs, :request_body, :text 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210212224117_add_response_body_to_request_logs.rb: -------------------------------------------------------------------------------- 1 | class AddResponseBodyToRequestLogs < ActiveRecord::Migration[5.2] 2 | def change 3 | add_column :request_logs, :response_body, :text 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210212224123_add_response_signature_to_request_logs.rb: -------------------------------------------------------------------------------- 1 | class AddResponseSignatureToRequestLogs < ActiveRecord::Migration[5.2] 2 | def change 3 | add_column :request_logs, :response_signature, :text 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210212224231_add_resource_to_request_logs.rb: -------------------------------------------------------------------------------- 1 | class AddResourceToRequestLogs < ActiveRecord::Migration[5.2] 2 | def change 3 | add_column :request_logs, :resource_type, :string 4 | add_column :request_logs, :resource_id, :uuid 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20210217132347_add_resource_index_to_request_logs.rb: -------------------------------------------------------------------------------- 1 | class AddResourceIndexToRequestLogs < ActiveRecord::Migration[5.2] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | add_index :request_logs, "to_tsvector('simple'::regconfig, (resource_id)::text)", name: :request_logs_tsv_resource_id_idx, algorithm: :concurrently, using: :gin 6 | add_index :request_logs, [:resource_id, :resource_type, :created_at], name: :request_logs_resource_idx, algorithm: :concurrently 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20210217144509_add_requestor_index_to_request_logs.rb: -------------------------------------------------------------------------------- 1 | class AddRequestorIndexToRequestLogs < ActiveRecord::Migration[5.2] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | add_index :request_logs, "to_tsvector('simple'::regconfig, (requestor_id)::text)", name: :request_logs_tsv_requestor_id_idx, algorithm: :concurrently, using: :gin 6 | add_index :request_logs, [:requestor_id, :requestor_type, :created_at], name: :request_logs_requestor_idx, algorithm: :concurrently 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20210218210227_add_key_gin_index_to_licenses.rb: -------------------------------------------------------------------------------- 1 | class AddKeyGinIndexToLicenses < ActiveRecord::Migration[5.2] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | remove_index :licenses, name: :licenses_tsv_key_idx 6 | 7 | add_index :licenses, :key, algorithm: :concurrently, using: :gin 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20210218210242_add_fingerprint_gin_index_to_machines.rb: -------------------------------------------------------------------------------- 1 | class AddFingerprintGinIndexToMachines < ActiveRecord::Migration[5.2] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | remove_index :machines, name: :machines_tsv_fingerprint_idx 6 | 7 | add_index :machines, :fingerprint, algorithm: :concurrently, using: :gin 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20210218210252_add_email_gin_index_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddEmailGinIndexToUsers < ActiveRecord::Migration[5.2] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | remove_index :users, name: :users_tsv_email_idx 6 | 7 | add_index :users, :email, algorithm: :concurrently, using: :gin 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20210218213930_remove_key_gin_index_from_licenses.rb: -------------------------------------------------------------------------------- 1 | class RemoveKeyGinIndexFromLicenses < ActiveRecord::Migration[5.2] 2 | def change 3 | # FIXME(ezekg) Indexed values were too big and this caused the GIN index to fail 4 | remove_index :licenses, name: :index_licenses_on_key 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20210302163826_add_multi_column_event_type_index_to_metrics.rb: -------------------------------------------------------------------------------- 1 | class AddMultiColumnEventTypeIndexToMetrics < ActiveRecord::Migration[5.2] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | add_index :metrics, [:account_id, :created_at, :event_type_id], { 6 | name: :metrics_account_created_event_type_idx, 7 | order: { created_at: :desc }, 8 | algorithm: :concurrently 9 | } 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20210315172007_remove_nullable_key_from_licenses.rb: -------------------------------------------------------------------------------- 1 | class RemoveNullableKeyFromLicenses < ActiveRecord::Migration[5.2] 2 | def up 3 | change_column :licenses, :key, :string, null: false 4 | end 5 | 6 | def down 7 | change_column :licenses, :key, :string, null: true 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20210316212414_add_notification_timestamps_to_accounts.rb: -------------------------------------------------------------------------------- 1 | class AddNotificationTimestampsToAccounts < ActiveRecord::Migration[5.2] 2 | def change 3 | add_column :accounts, :last_low_activity_lifeline_sent_at, :datetime 4 | add_column :accounts, :last_trial_will_end_sent_at, :datetime 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20210319134050_add_max_cores_to_policies.rb: -------------------------------------------------------------------------------- 1 | class AddMaxCoresToPolicies < ActiveRecord::Migration[5.2] 2 | def change 3 | add_column :policies, :max_cores, :integer 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210319134123_add_cores_to_machines.rb: -------------------------------------------------------------------------------- 1 | class AddCoresToMachines < ActiveRecord::Migration[5.2] 2 | def change 3 | add_column :machines, :cores, :integer 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210319151903_add_machines_core_count_to_licenses.rb: -------------------------------------------------------------------------------- 1 | class AddMachinesCoreCountToLicenses < ActiveRecord::Migration[5.2] 2 | def change 3 | add_column :licenses, :machines_core_count, :integer 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210323152738_add_limit_notification_sent_at_timestamps_to_accounts.rb: -------------------------------------------------------------------------------- 1 | class AddLimitNotificationSentAtTimestampsToAccounts < ActiveRecord::Migration[5.2] 2 | def change 3 | add_column :accounts, :last_license_limit_exceeded_sent_at, :datetime 4 | add_column :accounts, :last_request_limit_exceeded_sent_at, :datetime 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20210402200339_create_entitlements.rb: -------------------------------------------------------------------------------- 1 | class CreateEntitlements < ActiveRecord::Migration[6.1] 2 | def change 3 | create_table :entitlements, id: :uuid, default: -> { "uuid_generate_v4()" } do |t| 4 | t.uuid :account_id, null: false 5 | t.string :name, null: false 6 | t.string :code, null: false 7 | t.jsonb :metadata 8 | t.timestamps 9 | end 10 | 11 | add_index :entitlements, [:account_id, :code], unique: true 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /db/migrate/20210405173015_add_code_index_to_entitlements.rb: -------------------------------------------------------------------------------- 1 | class AddCodeIndexToEntitlements < ActiveRecord::Migration[6.1] 2 | def change 3 | add_index :entitlements, :code 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210413152928_update_created_at_index_for_metrics.rb: -------------------------------------------------------------------------------- 1 | class UpdateCreatedAtIndexForMetrics < ActiveRecord::Migration[6.1] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | remove_index(:metrics, [:account_id, :created_at]) if index_exists?(:metrics, [:account_id, :created_at]) 6 | 7 | add_index(:metrics, :created_at, algorithm: :concurrently) 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20210413153307_update_created_at_index_order_for_metrics.rb: -------------------------------------------------------------------------------- 1 | class UpdateCreatedAtIndexOrderForMetrics < ActiveRecord::Migration[6.1] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | remove_index(:metrics, :created_at) if index_exists?(:metrics, :created_at) 6 | 7 | add_index(:metrics, :created_at, order: { created_at: :desc }, algorithm: :concurrently) 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20210413161847_add_account_id_index_to_metrics.rb: -------------------------------------------------------------------------------- 1 | class AddAccountIdIndexToMetrics < ActiveRecord::Migration[6.1] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | add_index :metrics, :account_id, algorithm: :concurrently 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20210417124736_update_digest_index_for_tokens.rb: -------------------------------------------------------------------------------- 1 | class UpdateDigestIndexForTokens < ActiveRecord::Migration[6.1] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | remove_index :tokens, [:digest, :created_at, :account_id] 6 | 7 | add_index :tokens, :digest, unique: true, algorithm: :concurrently 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20210417125404_add_unique_index_to_email_for_users.rb: -------------------------------------------------------------------------------- 1 | class AddUniqueIndexToEmailForUsers < ActiveRecord::Migration[6.1] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | remove_index :users, [:email, :account_id, :created_at], if_exists: true 6 | 7 | add_index :users, [:email, :account_id], unique: true, algorithm: :concurrently 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20210513142214_add_prompt_for_review_notification_to_accounts.rb: -------------------------------------------------------------------------------- 1 | class AddPromptForReviewNotificationToAccounts < ActiveRecord::Migration[6.1] 2 | def change 3 | add_column :accounts, :last_prompt_for_review_sent_at, :datetime 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210514142902_create_release_channels.rb: -------------------------------------------------------------------------------- 1 | class CreateReleaseChannels < ActiveRecord::Migration[6.1] 2 | def change 3 | create_table :release_channels, id: :uuid, default: -> { "uuid_generate_v4()" } do |t| 4 | t.uuid :account_id, null: false 5 | 6 | t.string :name 7 | t.string :key 8 | 9 | t.timestamps 10 | 11 | t.index %i[account_id created_at], order: { created_at: :desc } 12 | t.index %i[account_id key], unique: true 13 | end 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /db/migrate/20210514152427_rename_download_counter_for_releases.rb: -------------------------------------------------------------------------------- 1 | class RenameDownloadCounterForReleases < ActiveRecord::Migration[6.1] 2 | def change 3 | rename_column :releases, :download_links_count, :download_count 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210517160709_remove_require_license_key_from_releases.rb: -------------------------------------------------------------------------------- 1 | class RemoveRequireLicenseKeyFromReleases < ActiveRecord::Migration[6.1] 2 | def change 3 | remove_column :releases, :require_license_key 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210518191955_add_update_count_to_releases.rb: -------------------------------------------------------------------------------- 1 | class AddUpdateCountToReleases < ActiveRecord::Migration[6.1] 2 | def change 3 | add_column :releases, :update_count, :bigint, default: 0 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210519131955_backfill_release_filetype_for_releases.rb: -------------------------------------------------------------------------------- 1 | class BackfillReleaseFiletypeForReleases < ActiveRecord::Migration[6.1] 2 | def change 3 | Release.find_each do |release| 4 | fileext = File.extname(release.key).strip.downcase.delete('.') 5 | filetype = ReleaseFiletype.find_or_create_by!(key: fileext, account: release.account) 6 | 7 | release.update! filetype: filetype 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20210519132033_remove_nullable_release_filetype_for_releases.rb: -------------------------------------------------------------------------------- 1 | class RemoveNullableReleaseFiletypeForReleases < ActiveRecord::Migration[6.1] 2 | def change 3 | change_column :releases, :release_filetype_id, :uuid, null: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210519133839_rename_size_to_filesize_for_releases.rb: -------------------------------------------------------------------------------- 1 | class RenameSizeToFilesizeForReleases < ActiveRecord::Migration[6.1] 2 | def change 3 | rename_column :releases, :size, :filesize 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210527193718_add_referral_id_to_billings.rb: -------------------------------------------------------------------------------- 1 | class AddReferralIdToBillings < ActiveRecord::Migration[6.1] 2 | def change 3 | add_column :billings, :referral_id, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210528133457_rename_key_to_filename_for_releases.rb: -------------------------------------------------------------------------------- 1 | class RenameKeyToFilenameForReleases < ActiveRecord::Migration[6.1] 2 | def change 3 | rename_column :releases, :key, :filename 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210531130826_add_ed25519_keys_to_accounts.rb: -------------------------------------------------------------------------------- 1 | class AddEd25519KeysToAccounts < ActiveRecord::Migration[6.1] 2 | def change 3 | add_column :accounts, :ed25519_private_key, :text 4 | add_column :accounts, :ed25519_public_key, :text 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20210531130928_seed_ed25519_keys_for_accounts.rb: -------------------------------------------------------------------------------- 1 | class SeedEd25519KeysForAccounts < ActiveRecord::Migration[6.1] 2 | def change 3 | Account.find_each do |account| 4 | next if account.ed25519_private_key.present? || 5 | account.ed25519_public_key.present? 6 | 7 | account.send(:generate_ed25519_keys!) 8 | account.save!(validate: false) 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20210607163343_add_signature_algorithm_to_webhook_endpoints.rb: -------------------------------------------------------------------------------- 1 | class AddSignatureAlgorithmToWebhookEndpoints < ActiveRecord::Migration[6.1] 2 | def change 3 | add_column :webhook_endpoints, :signature_algorithm, :string, default: 'ed25519' 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210625161816_rename_release_update_links_to_release_upgrade_links.rb: -------------------------------------------------------------------------------- 1 | class RenameReleaseUpdateLinksToReleaseUpgradeLinks < ActiveRecord::Migration[6.1] 2 | def change 3 | rename_table :release_update_links, :release_upgrade_links 4 | rename_column :releases, :update_count, :upgrade_count 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20210727191029_add_content_info_to_release_artifacts.rb: -------------------------------------------------------------------------------- 1 | class AddContentInfoToReleaseArtifacts < ActiveRecord::Migration[6.1] 2 | def change 3 | add_column :release_artifacts, :content_length, :integer 4 | add_column :release_artifacts, :content_type, :string 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20210908172546_add_max_machines_override_to_licenses.rb: -------------------------------------------------------------------------------- 1 | class AddMaxMachinesOverrideToLicenses < ActiveRecord::Migration[6.1] 2 | def change 3 | add_column :licenses, :max_machines_override, :integer 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210908172555_add_max_cores_override_to_licenses.rb: -------------------------------------------------------------------------------- 1 | class AddMaxCoresOverrideToLicenses < ActiveRecord::Migration[6.1] 2 | def change 3 | add_column :licenses, :max_cores_override, :integer 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20210908172755_add_max_uses_override_to_licenses.rb: -------------------------------------------------------------------------------- 1 | class AddMaxUsesOverrideToLicenses < ActiveRecord::Migration[6.1] 2 | def change 3 | add_column :licenses, :max_uses_override, :integer 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20211018135339_add_expiration_strategy_to_policies.rb: -------------------------------------------------------------------------------- 1 | class AddExpirationStrategyToPolicies < ActiveRecord::Migration[6.1] 2 | def change 3 | add_column :policies, :expiration_strategy, :string, null: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20211021145359_add_description_to_releases.rb: -------------------------------------------------------------------------------- 1 | class AddDescriptionToReleases < ActiveRecord::Migration[6.1] 2 | def change 3 | add_column :releases, :description, :text, null: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20211021145405_add_signature_to_releases.rb: -------------------------------------------------------------------------------- 1 | class AddSignatureToReleases < ActiveRecord::Migration[6.1] 2 | def change 3 | add_column :releases, :signature, :string, null: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20211021145410_add_checksum_to_releases.rb: -------------------------------------------------------------------------------- 1 | class AddChecksumToReleases < ActiveRecord::Migration[6.1] 2 | def change 3 | add_column :releases, :checksum, :string, null: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20211101211819_change_filesize_to_bigint_for_releases.rb: -------------------------------------------------------------------------------- 1 | class ChangeFilesizeToBigintForReleases < ActiveRecord::Migration[6.1] 2 | def up 3 | change_column :releases, :filesize, :bigint 4 | end 5 | 6 | def down 7 | change_column :releases, :filesize, :integer 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20211101212402_change_content_length_to_bigint_for_release_artifacts.rb: -------------------------------------------------------------------------------- 1 | class ChangeContentLengthToBigintForReleaseArtifacts < ActiveRecord::Migration[6.1] 2 | def up 3 | change_column :release_artifacts, :content_length, :bigint 4 | end 5 | 6 | def down 7 | change_column :release_artifacts, :content_length, :integer 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20211105145230_add_distribution_strategy_to_products.rb: -------------------------------------------------------------------------------- 1 | class AddDistributionStrategyToProducts < ActiveRecord::Migration[6.1] 2 | def change 3 | add_column :products, :distribution_strategy, :string, null: true 4 | 5 | add_index :products, :distribution_strategy 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20211127135950_add_stdout_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddStdoutToUsers < ActiveRecord::Migration[6.1] 2 | def change 3 | add_column :users, :stdout_unsubscribed_at, :datetime 4 | add_column :users, :stdout_last_sent_at, :datetime 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20211214215323_add_nullable_release_platform_for_releases.rb: -------------------------------------------------------------------------------- 1 | class AddNullableReleasePlatformForReleases < ActiveRecord::Migration[6.1] 2 | def up 3 | change_column :releases, :release_platform_id, :uuid, null: true 4 | end 5 | 6 | def down 7 | change_column :releases, :release_platform_id, :uuid, null: false 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20211214215330_add_nullable_release_filetype_for_releases.rb: -------------------------------------------------------------------------------- 1 | class AddNullableReleaseFiletypeForReleases < ActiveRecord::Migration[6.1] 2 | def up 3 | change_column :releases, :release_filetype_id, :uuid, null: true 4 | end 5 | 6 | def down 7 | change_column :releases, :release_filetype_id, :uuid, null: false 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20211231205833_add_expiration_basis_to_policies.rb: -------------------------------------------------------------------------------- 1 | class AddExpirationBasisToPolicies < ActiveRecord::Migration[6.1] 2 | def change 3 | add_column :policies, :expiration_basis, :string, null: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20220110224351_add_authentication_strategy_to_policies.rb: -------------------------------------------------------------------------------- 1 | class AddAuthenticationStrategyToPolicies < ActiveRecord::Migration[6.1] 2 | def change 3 | add_column :policies, :authentication_strategy, :string, null: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20220121171234_remove_request_id_from_request_logs.rb: -------------------------------------------------------------------------------- 1 | class RemoveRequestIdFromRequestLogs < ActiveRecord::Migration[6.1] 2 | def change 3 | remove_column :request_logs, :request_id 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20220131182526_add_domain_and_subdomain_to_accounts.rb: -------------------------------------------------------------------------------- 1 | class AddDomainAndSubdomainToAccounts < ActiveRecord::Migration[6.1] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | add_column :accounts, :domain, :string, null: true 6 | add_column :accounts, :subdomain, :string, null: true 7 | 8 | add_index :accounts, :domain, unique: true, algorithm: :concurrently 9 | add_index :accounts, :subdomain, unique: true, algorithm: :concurrently 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20220202214554_add_card_added_at_to_billings.rb: -------------------------------------------------------------------------------- 1 | class AddCardAddedAtToBillings < ActiveRecord::Migration[6.1] 2 | def change 3 | add_column :billings, :card_added_at, :datetime 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20220208142000_add_heartbeat_cull_strategy_to_policies.rb: -------------------------------------------------------------------------------- 1 | class AddHeartbeatCullStrategyToPolicies < ActiveRecord::Migration[6.1] 2 | def change 3 | add_column :policies, :heartbeat_cull_strategy, :string, null: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20220208143228_add_index_to_last_heartbeat_at_to_machines.rb: -------------------------------------------------------------------------------- 1 | class AddIndexToLastHeartbeatAtToMachines < ActiveRecord::Migration[6.1] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | add_index :machines, :last_heartbeat_at, algorithm: :concurrently 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20220215145514_add_heartbeat_resurrection_strategy_to_policies.rb: -------------------------------------------------------------------------------- 1 | class AddHeartbeatResurrectionStrategyToPolicies < ActiveRecord::Migration[6.1] 2 | def change 3 | add_column :policies, :heartbeat_resurrection_strategy, :string, null: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20220215153410_add_last_death_event_sent_at_to_machines.rb: -------------------------------------------------------------------------------- 1 | class AddLastDeathEventSentAtToMachines < ActiveRecord::Migration[6.1] 2 | def change 3 | add_column :machines, :last_death_event_sent_at, :timestamp, null: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20220217140029_add_require_heartbeat_to_policies.rb: -------------------------------------------------------------------------------- 1 | class AddRequireHeartbeatToPolicies < ActiveRecord::Migration[6.1] 2 | def change 3 | add_column :policies, :require_heartbeat, :boolean, default: false, null: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20220221171645_add_transfer_strategy_to_policies.rb: -------------------------------------------------------------------------------- 1 | class AddTransferStrategyToPolicies < ActiveRecord::Migration[6.1] 2 | def change 3 | add_column :policies, :transfer_strategy, :string, null: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20220223171146_add_status_to_webhook_events.rb: -------------------------------------------------------------------------------- 1 | class AddStatusToWebhookEvents < ActiveRecord::Migration[6.1] 2 | def change 3 | add_column :webhook_events, :status, :string, null: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20220224213354_add_banned_at_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddBannedAtToUsers < ActiveRecord::Migration[6.1] 2 | def change 3 | add_column :users, :banned_at, :timestamp, null: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20220228163722_add_index_to_banned_at_for_users.rb: -------------------------------------------------------------------------------- 1 | class AddIndexToBannedAtForUsers < ActiveRecord::Migration[6.1] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | add_index :users, :banned_at, algorithm: :concurrently 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20220228202804_add_require_user_scope_to_policies.rb: -------------------------------------------------------------------------------- 1 | class AddRequireUserScopeToPolicies < ActiveRecord::Migration[6.1] 2 | def change 3 | add_column :policies, :require_user_scope, :boolean, default: false, null: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20220301142902_create_groups.rb: -------------------------------------------------------------------------------- 1 | class CreateGroups < ActiveRecord::Migration[6.1] 2 | def change 3 | create_table :groups, id: :uuid, default: -> { 'uuid_generate_v4()' } do |t| 4 | t.uuid :account_id, null: false 5 | 6 | t.string :name 7 | t.integer :max_users 8 | t.integer :max_licenses 9 | t.integer :max_machines 10 | t.jsonb :metadata 11 | 12 | t.timestamps 13 | 14 | t.index %i[account_id] 15 | end 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /db/migrate/20220301174955_add_group_id_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddGroupIdToUsers < ActiveRecord::Migration[6.1] 2 | def change 3 | add_column :users, :group_id, :uuid, null: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20220301174958_add_group_id_to_licenses.rb: -------------------------------------------------------------------------------- 1 | class AddGroupIdToLicenses < ActiveRecord::Migration[6.1] 2 | def change 3 | add_column :licenses, :group_id, :uuid, null: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20220301175001_add_group_id_to_machines.rb: -------------------------------------------------------------------------------- 1 | class AddGroupIdToMachines < ActiveRecord::Migration[6.1] 2 | def change 3 | add_column :machines, :group_id, :uuid, null: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20220303230757_add_index_to_group_id_for_users.rb: -------------------------------------------------------------------------------- 1 | class AddIndexToGroupIdForUsers < ActiveRecord::Migration[6.1] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | add_index :users, :group_id, algorithm: :concurrently 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20220303230800_add_index_to_group_id_for_licenses.rb: -------------------------------------------------------------------------------- 1 | class AddIndexToGroupIdForLicenses < ActiveRecord::Migration[6.1] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | add_index :licenses, :group_id, algorithm: :concurrently 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20220303230803_add_index_to_group_id_for_machines.rb: -------------------------------------------------------------------------------- 1 | class AddIndexToGroupIdForMachines < ActiveRecord::Migration[6.1] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | add_index :machines, :group_id, algorithm: :concurrently 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20220330152915_add_index_to_last_validated_at_for_licenses.rb: -------------------------------------------------------------------------------- 1 | class AddIndexToLastValidatedAtForLicenses < ActiveRecord::Migration[6.1] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | add_index :licenses, :last_validated_at, algorithm: :concurrently 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20220415131253_add_leasing_strategy_to_policies.rb: -------------------------------------------------------------------------------- 1 | class AddLeasingStrategyToPolicies < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :policies, :leasing_strategy, :string, null: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20220415131545_add_max_processes_to_policies.rb: -------------------------------------------------------------------------------- 1 | class AddMaxProcessesToPolicies < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :policies, :max_processes, :integer, null: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20220415131658_add_max_processes_override_to_licenses.rb: -------------------------------------------------------------------------------- 1 | class AddMaxProcessesOverrideToLicenses < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :licenses, :max_processes_override, :integer, null: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20220415131706_add_max_processes_override_to_machines.rb: -------------------------------------------------------------------------------- 1 | class AddMaxProcessesOverrideToMachines < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :machines, :max_processes_override, :integer, null: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20220421190505_add_api_version_to_accounts.rb: -------------------------------------------------------------------------------- 1 | class AddApiVersionToAccounts < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :accounts, :api_version, :string, null: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20220421190515_add_api_version_to_webhook_endpoints.rb: -------------------------------------------------------------------------------- 1 | class AddApiVersionToWebhookEndpoints < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :webhook_endpoints, :api_version, :string, null: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20220422203901_add_api_version_to_webhook_events.rb: -------------------------------------------------------------------------------- 1 | class AddApiVersionToWebhookEvents < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :webhook_events, :api_version, :string, null: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20220502194111_add_release_arch_to_release_artifacts.rb: -------------------------------------------------------------------------------- 1 | class AddReleaseArchToReleaseArtifacts < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :release_artifacts, :release_arch_id, :uuid 4 | 5 | add_index :release_artifacts, %i[release_arch_id] 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20220502202159_remove_uniq_index_from_release_artifacts.rb: -------------------------------------------------------------------------------- 1 | class RemoveUniqIndexFromReleaseArtifacts < ActiveRecord::Migration[7.0] 2 | def change 3 | remove_index :release_artifacts, %i[account_id product_id release_id], 4 | name: :releases_artifacts_acct_prod_rel_idx 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /db/migrate/20220502203322_update_key_uniq_index_for_release_artifacts.rb: -------------------------------------------------------------------------------- 1 | class UpdateKeyUniqIndexForReleaseArtifacts < ActiveRecord::Migration[7.0] 2 | def change 3 | remove_index :release_artifacts, %i[key product_id account_id] 4 | 5 | add_index :release_artifacts, %i[key product_id account_id], 6 | name: :release_artifacts_uniq_key_idx, 7 | where: 'key is not null', 8 | unique: true 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20220502205445_remove_product_id_from_release_artifacts.rb: -------------------------------------------------------------------------------- 1 | class RemoveProductIdFromReleaseArtifacts < ActiveRecord::Migration[7.0] 2 | def change 3 | remove_column :release_artifacts, :product_id 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20220502205642_rename_key_to_filename_for_release_artifacts.rb: -------------------------------------------------------------------------------- 1 | class RenameKeyToFilenameForReleaseArtifacts < ActiveRecord::Migration[7.0] 2 | def change 3 | remove_column :release_artifacts, :filename 4 | 5 | rename_column :release_artifacts, :key, :filename 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20220503162720_add_status_to_releases.rb: -------------------------------------------------------------------------------- 1 | class AddStatusToReleases < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :releases, :status, :string, null: true 4 | 5 | add_index :releases, :status 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20220503205130_add_filename_index_to_release_artifacts.rb: -------------------------------------------------------------------------------- 1 | class AddFilenameIndexToReleaseArtifacts < ActiveRecord::Migration[7.0] 2 | def change 3 | add_index :release_artifacts, %i[filename release_id account_id], 4 | name: :release_artifacts_uniq_filename_idx, 5 | where: 'filename is not null', 6 | unique: true 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20220504130054_add_api_version_to_releases.rb: -------------------------------------------------------------------------------- 1 | class AddApiVersionToReleases < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :releases, :api_version, :string, null: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20220504130127_update_version_uniq_index_for_releases.rb: -------------------------------------------------------------------------------- 1 | class UpdateVersionUniqIndexForReleases < ActiveRecord::Migration[7.0] 2 | def change 3 | remove_index :releases, %i[account_id product_id release_platform_id release_channel_id release_filetype_id version], 4 | name: :releases_acct_prod_plat_chan_type_ver_idx 5 | 6 | add_index :releases, %i[version product_id account_id], 7 | where: %(api_version != '1.0'), 8 | unique: true 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20220505151926_add_status_to_release_artifacts.rb: -------------------------------------------------------------------------------- 1 | class AddStatusToReleaseArtifacts < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :release_artifacts, :status, :string, null: true 4 | 5 | add_index :release_artifacts, :status 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20220511130657_add_metadata_to_release_artifacts.rb: -------------------------------------------------------------------------------- 1 | class AddMetadataToReleaseArtifacts < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :release_artifacts, :metadata, :jsonb, null: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20220511195423_add_tag_to_releases.rb: -------------------------------------------------------------------------------- 1 | class AddTagToReleases < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :releases, :tag, :string, null: true 4 | 5 | add_index :releases, %i[tag account_id], 6 | where: %(tag IS NOT NULL), 7 | unique: true 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20220607141252_add_created_date_to_request_logs.rb: -------------------------------------------------------------------------------- 1 | class AddCreatedDateToRequestLogs < ActiveRecord::Migration[7.0] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | add_column :request_logs, :created_date, :date, null: true 6 | 7 | add_index :request_logs, %i[account_id created_date], 8 | order: { created_date: :desc }, 9 | algorithm: :concurrently 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20220607161233_remove_nullable_created_date_from_request_logs.rb: -------------------------------------------------------------------------------- 1 | class RemoveNullableCreatedDateFromRequestLogs < ActiveRecord::Migration[7.0] 2 | def change 3 | change_column_null :request_logs, :created_date, false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20220607162853_remove_nullable_created_date_from_metrics.rb: -------------------------------------------------------------------------------- 1 | class RemoveNullableCreatedDateFromMetrics < ActiveRecord::Migration[7.0] 2 | def change 3 | change_column_null :metrics, :created_date, false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20220614121605_add_resource_name_index_to_roles.rb: -------------------------------------------------------------------------------- 1 | class AddResourceNameIndexToRoles < ActiveRecord::Migration[7.0] 2 | def change 3 | add_index :roles, %i[resource_type resource_id name] 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20220617142030_add_created_at_index_to_event_logs.rb: -------------------------------------------------------------------------------- 1 | class AddCreatedAtIndexToEventLogs < ActiveRecord::Migration[7.0] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | remove_index :event_logs, %i[account_id], algorithm: :concurrently 6 | add_index :event_logs, %i[account_id created_at], 7 | order: { created_at: :desc }, 8 | algorithm: :concurrently 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20220617181052_update_resource_index_for_event_logs.rb: -------------------------------------------------------------------------------- 1 | class UpdateResourceIndexForEventLogs < ActiveRecord::Migration[7.0] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | remove_index :event_logs, %i[resource_type resource_id], algorithm: :concurrently, if_exists: true 6 | add_index :event_logs, %i[resource_type resource_id created_at], 7 | name: :event_logs_resource_crt_idx, 8 | order: { created_at: :desc }, 9 | algorithm: :concurrently 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20220629153506_add_search_indices_to_request_logs.rb: -------------------------------------------------------------------------------- 1 | class AddSearchIndicesToRequestLogs < ActiveRecord::Migration[7.0] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | add_index :request_logs, %i[method], name: :request_logs_method_idx, algorithm: :concurrently, if_not_exists: true 6 | add_index :request_logs, %i[status], name: :request_logs_status_idx, algorithm: :concurrently, if_not_exists: true 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20220704153453_add_overage_strategy_to_policies.rb: -------------------------------------------------------------------------------- 1 | class AddOverageStrategyToPolicies < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :policies, :overage_strategy, :string, null: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20220718211325_create_permissions.rb: -------------------------------------------------------------------------------- 1 | class CreatePermissions < ActiveRecord::Migration[7.0] 2 | def change 3 | create_table :permissions, id: :uuid, default: -> { 'uuid_generate_v4()' } do |t| 4 | t.string :action, null: false 5 | 6 | t.timestamps 7 | 8 | t.index :action, unique: true 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20220718211503_create_role_permissions.rb: -------------------------------------------------------------------------------- 1 | class CreateRolePermissions < ActiveRecord::Migration[7.0] 2 | def change 3 | create_table :role_permissions, id: :uuid, default: -> { 'uuid_generate_v4()' } do |t| 4 | t.uuid :permission_id, null: false, index: true 5 | t.uuid :role_id, null: false 6 | 7 | t.timestamps 8 | 9 | t.index %i[role_id permission_id], unique: true 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /db/migrate/20220718211555_create_token_permissions.rb: -------------------------------------------------------------------------------- 1 | class CreateTokenPermissions < ActiveRecord::Migration[7.0] 2 | def change 3 | create_table :token_permissions, id: :uuid, default: -> { 'uuid_generate_v4()' } do |t| 4 | t.uuid :permission_id, null: false, index: true 5 | t.uuid :token_id, null: false 6 | 7 | t.timestamps 8 | 9 | t.index %i[token_id permission_id], unique: true 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /db/migrate/20220718211700_create_group_permissions.rb: -------------------------------------------------------------------------------- 1 | class CreateGroupPermissions < ActiveRecord::Migration[7.0] 2 | def change 3 | create_table :group_permissions, id: :uuid, default: -> { 'uuid_generate_v4()' } do |t| 4 | t.uuid :permission_id, null: false, index: true 5 | t.uuid :group_id, null: false 6 | 7 | t.timestamps 8 | 9 | t.index %i[group_id permission_id], unique: true 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /db/migrate/20220723044854_drop_fingerprint_gin_index_for_machines.rb: -------------------------------------------------------------------------------- 1 | class DropFingerprintGinIndexForMachines < ActiveRecord::Migration[7.0] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | remove_index :machines, :fingerprint, name: :index_machines_on_fingerprint, algorithm: :concurrently, using: :gin 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20220723044910_drop_email_gin_index_for_users.rb: -------------------------------------------------------------------------------- 1 | class DropEmailGinIndexForUsers < ActiveRecord::Migration[7.0] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | remove_index :users, :email, name: :index_users_on_email, algorithm: :concurrently, using: :gin 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20220817183308_add_cname_to_accounts.rb: -------------------------------------------------------------------------------- 1 | class AddCnameToAccounts < ActiveRecord::Migration[7.0] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | add_column :accounts, :cname, :string, null: true 6 | 7 | add_index :accounts, :cname, unique: true, algorithm: :concurrently 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20220912134350_add_name_to_tokens.rb: -------------------------------------------------------------------------------- 1 | class AddNameToTokens < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :tokens, :name, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20221103164128_add_backend_to_release_artifacts.rb: -------------------------------------------------------------------------------- 1 | class AddBackendToReleaseArtifacts < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :release_artifacts, :backend, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20221104140501_add_backend_to_accounts.rb: -------------------------------------------------------------------------------- 1 | class AddBackendToAccounts < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :accounts, :backend, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20221115145100_add_last_check_out_at_to_licenses.rb: -------------------------------------------------------------------------------- 1 | class AddLastCheckOutAtToLicenses < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :licenses, :last_check_out_at, :timestamp, null: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20221115145108_add_last_check_out_at_to_machines.rb: -------------------------------------------------------------------------------- 1 | class AddLastCheckOutAtToMachines < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :machines, :last_check_out_at, :timestamp, null: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20221208021513_add_unique_index_to_key_for_keys.rb: -------------------------------------------------------------------------------- 1 | class AddUniqueIndexToKeyForKeys < ActiveRecord::Migration[7.0] 2 | def change 3 | add_index :keys, %i[account_id key], unique: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20230105174656_create_environments.rb: -------------------------------------------------------------------------------- 1 | class CreateEnvironments < ActiveRecord::Migration[7.0] 2 | def change 3 | create_table :environments, id: :uuid, default: -> { 'uuid_generate_v4()' } do |t| 4 | t.uuid :account_id, null: false 5 | 6 | t.string :name, null: false 7 | 8 | t.timestamps 9 | 10 | t.index %i[account_id created_at], order: { created_at: :desc } 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /db/migrate/20230105175605_add_environment_to_products.rb: -------------------------------------------------------------------------------- 1 | class AddEnvironmentToProducts < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :products, :environment_id, :uuid, null: true 4 | 5 | add_index :products, :environment_id 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20230105175709_add_environment_to_licenses.rb: -------------------------------------------------------------------------------- 1 | class AddEnvironmentToLicenses < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :licenses, :environment_id, :uuid, null: true 4 | 5 | add_index :licenses, :environment_id 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20230105175724_add_environment_to_policies.rb: -------------------------------------------------------------------------------- 1 | class AddEnvironmentToPolicies < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :policies, :environment_id, :uuid, null: true 4 | 5 | add_index :policies, :environment_id 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20230105175739_add_environment_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddEnvironmentToUsers < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :users, :environment_id, :uuid, null: true 4 | 5 | add_index :users, :environment_id 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20230105175752_add_environment_to_groups.rb: -------------------------------------------------------------------------------- 1 | class AddEnvironmentToGroups < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :groups, :environment_id, :uuid, null: true 4 | 5 | add_index :groups, :environment_id 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20230105175800_add_environment_to_machine_processes.rb: -------------------------------------------------------------------------------- 1 | class AddEnvironmentToMachineProcesses < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :machine_processes, :environment_id, :uuid, null: true 4 | 5 | add_index :machine_processes, :environment_id 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20230105175808_add_environment_to_machines.rb: -------------------------------------------------------------------------------- 1 | class AddEnvironmentToMachines < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :machines, :environment_id, :uuid, null: true 4 | 5 | add_index :machines, :environment_id 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20230105175915_add_environment_to_releases.rb: -------------------------------------------------------------------------------- 1 | class AddEnvironmentToReleases < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :releases, :environment_id, :uuid, null: true 4 | 5 | add_index :releases, :environment_id 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20230105175922_add_environment_to_release_artifacts.rb: -------------------------------------------------------------------------------- 1 | class AddEnvironmentToReleaseArtifacts < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :release_artifacts, :environment_id, :uuid, null: true 4 | 5 | add_index :release_artifacts, :environment_id 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20230105175929_add_environment_to_release_channels.rb: -------------------------------------------------------------------------------- 1 | class AddEnvironmentToReleaseChannels < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :release_channels, :environment_id, :uuid, null: true 4 | 5 | add_index :release_channels, :environment_id 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20230105175947_add_environment_to_release_filetypes.rb: -------------------------------------------------------------------------------- 1 | class AddEnvironmentToReleaseFiletypes < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :release_filetypes, :environment_id, :uuid, null: true 4 | 5 | add_index :release_filetypes, :environment_id 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20230105175955_add_environment_to_release_platforms.rb: -------------------------------------------------------------------------------- 1 | class AddEnvironmentToReleasePlatforms < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :release_platforms, :environment_id, :uuid, null: true 4 | 5 | add_index :release_platforms, :environment_id 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20230105180013_add_environment_to_release_arches.rb: -------------------------------------------------------------------------------- 1 | class AddEnvironmentToReleaseArches < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :release_arches, :environment_id, :uuid, null: true 4 | 5 | add_index :release_arches, :environment_id 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20230105180133_add_environment_to_tokens.rb: -------------------------------------------------------------------------------- 1 | class AddEnvironmentToTokens < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :tokens, :environment_id, :uuid, null: true 4 | 5 | add_index :tokens, :environment_id 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20230105180224_add_environment_to_entitlements.rb: -------------------------------------------------------------------------------- 1 | class AddEnvironmentToEntitlements < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :entitlements, :environment_id, :uuid, null: true 4 | 5 | add_index :entitlements, :environment_id 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20230105195937_add_code_to_environments.rb: -------------------------------------------------------------------------------- 1 | class AddCodeToEnvironments < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :environments, :code, :string, null: false 4 | 5 | add_index :environments, %i[account_id code], unique: true 6 | add_index :environments, :code 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20230106213748_add_environment_to_event_logs.rb: -------------------------------------------------------------------------------- 1 | class AddEnvironmentToEventLogs < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :event_logs, :environment_id, :uuid, null: true 4 | 5 | add_index :event_logs, :environment_id 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20230106213757_add_environment_to_request_logs.rb: -------------------------------------------------------------------------------- 1 | class AddEnvironmentToRequestLogs < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :request_logs, :environment_id, :uuid, null: true 4 | 5 | add_index :request_logs, :environment_id 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20230106213814_add_environment_to_webhook_events.rb: -------------------------------------------------------------------------------- 1 | class AddEnvironmentToWebhookEvents < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :webhook_events, :environment_id, :uuid, null: true 4 | 5 | add_index :webhook_events, :environment_id 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20230106213821_add_environment_to_webhook_endpoints.rb: -------------------------------------------------------------------------------- 1 | class AddEnvironmentToWebhookEndpoints < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :webhook_endpoints, :environment_id, :uuid, null: true 4 | 5 | add_index :webhook_endpoints, :environment_id 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20230116220114_add_isolation_strategy_to_environments.rb: -------------------------------------------------------------------------------- 1 | class AddIsolationStrategyToEnvironments < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :environments, :isolation_strategy, :string, null: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20230210152346_add_heartbeat_basis_to_policies.rb: -------------------------------------------------------------------------------- 1 | class AddHeartbeatBasisToPolicies < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :policies, :heartbeat_basis, :string, null: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20230210213933_add_environment_to_license_entitlements.rb: -------------------------------------------------------------------------------- 1 | class AddEnvironmentToLicenseEntitlements < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :license_entitlements, :environment_id, :uuid, null: true 4 | 5 | add_index :license_entitlements, :environment_id 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20230210213942_add_environment_to_policy_entitlements.rb: -------------------------------------------------------------------------------- 1 | class AddEnvironmentToPolicyEntitlements < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :policy_entitlements, :environment_id, :uuid, null: true 4 | 5 | add_index :policy_entitlements, :environment_id 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20230210214601_add_environment_to_second_factors.rb: -------------------------------------------------------------------------------- 1 | class AddEnvironmentToSecondFactors < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :second_factors, :environment_id, :uuid, null: true 4 | 5 | add_index :second_factors, :environment_id 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20230210214615_add_environment_to_release_entitlement_constraints.rb: -------------------------------------------------------------------------------- 1 | class AddEnvironmentToReleaseEntitlementConstraints < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :release_entitlement_constraints, :environment_id, :uuid, null: true 4 | 5 | add_index :release_entitlement_constraints, :environment_id 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20230210214627_add_environment_to_release_download_links.rb: -------------------------------------------------------------------------------- 1 | class AddEnvironmentToReleaseDownloadLinks < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :release_download_links, :environment_id, :uuid, null: true 4 | 5 | add_index :release_download_links, :environment_id 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20230210214637_add_environment_to_release_upgrade_links.rb: -------------------------------------------------------------------------------- 1 | class AddEnvironmentToReleaseUpgradeLinks < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :release_upgrade_links, :environment_id, :uuid, null: true 4 | 5 | add_index :release_upgrade_links, :environment_id 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20230210214647_add_environment_to_release_upload_links.rb: -------------------------------------------------------------------------------- 1 | class AddEnvironmentToReleaseUploadLinks < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :release_upload_links, :environment_id, :uuid, null: true 4 | 5 | add_index :release_upload_links, :environment_id 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20230210215827_add_environment_to_keys.rb: -------------------------------------------------------------------------------- 1 | class AddEnvironmentToKeys < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :keys, :environment_id, :uuid, null: true 4 | 5 | add_index :keys, :environment_id 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20230210222710_add_environment_to_group_owners.rb: -------------------------------------------------------------------------------- 1 | class AddEnvironmentToGroupOwners < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :group_owners, :environment_id, :uuid, null: true 4 | 5 | add_index :group_owners, :environment_id 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20230217220606_remove_environment_from_release_arches.rb: -------------------------------------------------------------------------------- 1 | class RemoveEnvironmentFromReleaseArches < ActiveRecord::Migration[7.0] 2 | def change 3 | remove_column :release_arches, :environment_id 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20230217220613_remove_environment_from_release_channels.rb: -------------------------------------------------------------------------------- 1 | class RemoveEnvironmentFromReleaseChannels < ActiveRecord::Migration[7.0] 2 | def change 3 | remove_column :release_channels, :environment_id 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20230217220621_remove_environment_from_release_filetypes.rb: -------------------------------------------------------------------------------- 1 | class RemoveEnvironmentFromReleaseFiletypes < ActiveRecord::Migration[7.0] 2 | def change 3 | remove_column :release_filetypes, :environment_id 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20230217220629_remove_environment_from_release_platforms.rb: -------------------------------------------------------------------------------- 1 | class RemoveEnvironmentFromReleasePlatforms < ActiveRecord::Migration[7.0] 2 | def change 3 | remove_column :release_platforms, :environment_id 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20230302171227_add_require_environment_scope_to_policies.rb: -------------------------------------------------------------------------------- 1 | class AddRequireEnvironmentScopeToPolicies < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :policies, :require_environment_scope, :boolean, default: false, null: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20230613140339_add_last_validated_checksum_to_licenses.rb: -------------------------------------------------------------------------------- 1 | class AddLastValidatedChecksumToLicenses < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :licenses, :last_validated_checksum, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20230613140348_add_last_validated_version_to_licenses.rb: -------------------------------------------------------------------------------- 1 | class AddLastValidatedVersionToLicenses < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :licenses, :last_validated_version, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20230613164115_add_require_checksum_scope_to_policies.rb: -------------------------------------------------------------------------------- 1 | class AddRequireChecksumScopeToPolicies < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :policies, :require_checksum_scope, :boolean, default: false, null: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20230613164122_add_require_version_scope_to_policies.rb: -------------------------------------------------------------------------------- 1 | class AddRequireVersionScopeToPolicies < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :policies, :require_version_scope, :boolean, default: false, null: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20230627203649_add_heartbeat_jid_to_machines.rb: -------------------------------------------------------------------------------- 1 | class AddHeartbeatJidToMachines < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :machines, :heartbeat_jid, :string, null: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20230627203655_add_heartbeat_jid_to_machine_processes.rb: -------------------------------------------------------------------------------- 1 | class AddHeartbeatJidToMachineProcesses < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :machine_processes, :heartbeat_jid, :string, null: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20230630142611_readd_requestor_index_to_request_logs.rb: -------------------------------------------------------------------------------- 1 | class ReaddRequestorIndexToRequestLogs < ActiveRecord::Migration[7.0] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | add_index :request_logs, %i[requestor_id requestor_type], 6 | name: :request_logs_requestor_idx, 7 | algorithm: :concurrently 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20230717173304_add_release_package_to_releases.rb: -------------------------------------------------------------------------------- 1 | class AddReleasePackageToReleases < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :releases, :release_package_id, :uuid, null: true 4 | 5 | add_index :releases, :release_package_id 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20230823164814_add_require_components_scope_to_policies.rb: -------------------------------------------------------------------------------- 1 | class AddRequireComponentsScopeToPolicies < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :policies, :require_components_scope, :boolean, default: false, null: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20230905125535_add_machine_uniqueness_strategy_to_policies.rb: -------------------------------------------------------------------------------- 1 | class AddMachineUniquenessStrategyToPolicies < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :policies, :machine_uniqueness_strategy, :string, null: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20230905125544_add_machine_matching_strategy_to_policies.rb: -------------------------------------------------------------------------------- 1 | class AddMachineMatchingStrategyToPolicies < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :policies, :machine_matching_strategy, :string, null: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20230905125608_add_component_uniqueness_strategy_to_policies.rb: -------------------------------------------------------------------------------- 1 | class AddComponentUniquenessStrategyToPolicies < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :policies, :component_uniqueness_strategy, :string, null: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20230905125612_add_component_matching_strategy_to_policies.rb: -------------------------------------------------------------------------------- 1 | class AddComponentMatchingStrategyToPolicies < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :policies, :component_matching_strategy, :string, null: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20230912191622_add_request_headers_to_request_logs.rb: -------------------------------------------------------------------------------- 1 | class AddRequestHeadersToRequestLogs < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :request_logs, :request_headers, :jsonb 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20230912191630_add_response_headers_to_request_logs.rb: -------------------------------------------------------------------------------- 1 | class AddResponseHeadersToRequestLogs < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :request_logs, :response_headers, :jsonb 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20230912201106_add_runtime_to_request_logs.rb: -------------------------------------------------------------------------------- 1 | class AddRuntimeToRequestLogs < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :request_logs, :runtime, :decimal, precision: 8 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20230914172654_add_run_time_to_request_logs.rb: -------------------------------------------------------------------------------- 1 | class AddRunTimeToRequestLogs < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :request_logs, :run_time, :float 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20230914172659_add_queue_time_to_request_logs.rb: -------------------------------------------------------------------------------- 1 | class AddQueueTimeToRequestLogs < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :request_logs, :queue_time, :float 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20230914184536_drop_runtime_for_request_logs.rb: -------------------------------------------------------------------------------- 1 | class DropRuntimeForRequestLogs < ActiveRecord::Migration[7.0] 2 | def change 3 | remove_column :request_logs, :runtime 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20231013164654_add_created_date_to_event_logs.rb: -------------------------------------------------------------------------------- 1 | class AddCreatedDateToEventLogs < ActiveRecord::Migration[7.0] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | add_column :event_logs, :created_date, :date, null: true 6 | 7 | add_index :event_logs, %i[account_id created_date], 8 | order: { created_date: :desc }, 9 | algorithm: :concurrently 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20240111204752_add_owner_to_machines.rb: -------------------------------------------------------------------------------- 1 | class AddOwnerToMachines < ActiveRecord::Migration[7.0] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | add_column :machines, :owner_id, :uuid, null: true, if_not_exists: true 6 | 7 | add_index :machines, :owner_id, algorithm: :concurrently, if_not_exists: true 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20240122032049_add_renewal_basis_to_policies.rb: -------------------------------------------------------------------------------- 1 | class AddRenewalBasisToPolicies < ActiveRecord::Migration[7.0] 2 | def change 3 | add_column :policies, :renewal_basis, :string, null: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20240206170644_add_index_to_heartbeat_jid_for_machines.rb: -------------------------------------------------------------------------------- 1 | class AddIndexToHeartbeatJidForMachines < ActiveRecord::Migration[7.1] 2 | def change 3 | add_index :machines, :heartbeat_jid 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20240206170649_add_index_to_heartbeat_jid_for_machine_processes.rb: -------------------------------------------------------------------------------- 1 | class AddIndexToHeartbeatJidForMachineProcesses < ActiveRecord::Migration[7.1] 2 | def change 3 | add_index :machine_processes, :heartbeat_jid 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20240311160949_add_product_to_licenses.rb: -------------------------------------------------------------------------------- 1 | class AddProductToLicenses < ActiveRecord::Migration[7.1] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | add_column :licenses, :product_id, :uuid, null: true, if_not_exists: true 6 | 7 | add_index :licenses, :product_id, algorithm: :concurrently, if_not_exists: true 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20240410141056_add_account_id_product_id_user_id_index_to_licenses.rb: -------------------------------------------------------------------------------- 1 | class AddAccountIdProductIdUserIdIndexToLicenses < ActiveRecord::Migration[7.1] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | add_index :licenses, %i[account_id product_id user_id], algorithm: :concurrently, if_not_exists: true 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20240410153245_add_account_id_product_id_id_index_to_licenses.rb: -------------------------------------------------------------------------------- 1 | class AddAccountIdProductIdIdIndexToLicenses < ActiveRecord::Migration[7.1] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | add_index :licenses, %i[account_id product_id id], unique: true, algorithm: :concurrently, if_not_exists: true 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20240419172942_add_product_id_not_null_constraint_for_licenses.rb: -------------------------------------------------------------------------------- 1 | class AddProductIdNotNullConstraintForLicenses < ActiveRecord::Migration[7.1] 2 | def up 3 | log_level_was, ActiveRecord::Base.logger.level = ActiveRecord::Base.logger.level, Logger::DEBUG 4 | 5 | add_check_constraint :licenses, 'product_id IS NOT NULL', name: 'licenses_product_id_not_null', validate: false 6 | ensure 7 | ActiveRecord::Base.logger.level = log_level_was 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20240419172949_validate_product_id_not_null_constraint_for_licenses.rb: -------------------------------------------------------------------------------- 1 | class ValidateProductIdNotNullConstraintForLicenses < ActiveRecord::Migration[7.1] 2 | def up 3 | log_level_was, ActiveRecord::Base.logger.level = ActiveRecord::Base.logger.level, Logger::DEBUG 4 | 5 | validate_check_constraint :licenses, name: 'licenses_product_id_not_null' 6 | ensure 7 | ActiveRecord::Base.logger.level = log_level_was 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20240420043710_change_product_id_not_null_for_licenses.rb: -------------------------------------------------------------------------------- 1 | class ChangeProductIdNotNullForLicenses < ActiveRecord::Migration[7.1] 2 | def up 3 | log_level_was, ActiveRecord::Base.logger.level = ActiveRecord::Base.logger.level, Logger::DEBUG 4 | 5 | change_column_null :licenses, :product_id, false 6 | remove_check_constraint :licenses, name: 'licenses_product_id_not_null' 7 | ensure 8 | ActiveRecord::Base.logger.level = log_level_was 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20240420053540_add_account_id_not_null_constraint_for_licenses.rb: -------------------------------------------------------------------------------- 1 | class AddAccountIdNotNullConstraintForLicenses < ActiveRecord::Migration[7.1] 2 | verbose! 3 | 4 | def up 5 | add_check_constraint :licenses, 'account_id IS NOT NULL', name: 'licenses_account_id_not_null', validate: false 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20240420053552_validate_account_id_not_null_constraint_for_licenses.rb: -------------------------------------------------------------------------------- 1 | class ValidateAccountIdNotNullConstraintForLicenses < ActiveRecord::Migration[7.1] 2 | verbose! 3 | 4 | def up 5 | validate_check_constraint :licenses, name: 'licenses_account_id_not_null' 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20240420053607_change_account_id_not_null_for_licenses.rb: -------------------------------------------------------------------------------- 1 | class ChangeAccountIdNotNullForLicenses < ActiveRecord::Migration[7.1] 2 | verbose! 3 | 4 | def up 5 | change_column_null :licenses, :account_id, false 6 | remove_check_constraint :licenses, name: 'licenses_account_id_not_null' 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20240424021316_add_policy_id_not_null_constraint_for_licenses.rb: -------------------------------------------------------------------------------- 1 | class AddPolicyIdNotNullConstraintForLicenses < ActiveRecord::Migration[7.1] 2 | verbose! 3 | 4 | def up 5 | add_check_constraint :licenses, 'policy_id IS NOT NULL', name: 'licenses_policy_id_not_null', validate: false 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20240424021325_validate_policy_id_not_null_constraint_for_licenses.rb: -------------------------------------------------------------------------------- 1 | class ValidatePolicyIdNotNullConstraintForLicenses < ActiveRecord::Migration[7.1] 2 | verbose! 3 | 4 | def up 5 | validate_check_constraint :licenses, name: 'licenses_policy_id_not_null' 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20240424021336_change_policy_id_not_null_for_licenses.rb: -------------------------------------------------------------------------------- 1 | class ChangePolicyIdNotNullForLicenses < ActiveRecord::Migration[7.1] 2 | verbose! 3 | 4 | def up 5 | change_column_null :licenses, :policy_id, false 6 | remove_check_constraint :licenses, name: 'licenses_policy_id_not_null' 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20240424022315_add_account_id_not_null_constraint_for_users.rb: -------------------------------------------------------------------------------- 1 | class AddAccountIdNotNullConstraintForUsers < ActiveRecord::Migration[7.1] 2 | verbose! 3 | 4 | def up 5 | add_check_constraint :users, 'account_id IS NOT NULL', name: 'users_account_id_not_null', validate: false 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20240424022326_validate_account_id_not_null_constraint_for_users.rb: -------------------------------------------------------------------------------- 1 | class ValidateAccountIdNotNullConstraintForUsers < ActiveRecord::Migration[7.1] 2 | verbose! 3 | 4 | def up 5 | validate_check_constraint :users, name: 'users_account_id_not_null' 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20240424022335_change_account_id_not_null_for_users.rb: -------------------------------------------------------------------------------- 1 | class ChangeAccountIdNotNullForUsers < ActiveRecord::Migration[7.1] 2 | verbose! 3 | 4 | def up 5 | change_column_null :users, :account_id, false 6 | remove_check_constraint :users, name: 'users_account_id_not_null' 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20240424022554_add_account_id_not_null_constraint_for_machines.rb: -------------------------------------------------------------------------------- 1 | class AddAccountIdNotNullConstraintForMachines < ActiveRecord::Migration[7.1] 2 | verbose! 3 | 4 | def up 5 | add_check_constraint :machines, 'account_id IS NOT NULL', name: 'machines_account_id_not_null', validate: false 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20240424022606_validate_account_id_not_null_constraint_for_machines.rb: -------------------------------------------------------------------------------- 1 | class ValidateAccountIdNotNullConstraintForMachines < ActiveRecord::Migration[7.1] 2 | verbose! 3 | 4 | def up 5 | validate_check_constraint :machines, name: 'machines_account_id_not_null' 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20240424022614_change_account_id_not_null_for_machines.rb: -------------------------------------------------------------------------------- 1 | class ChangeAccountIdNotNullForMachines < ActiveRecord::Migration[7.1] 2 | verbose! 3 | 4 | def up 5 | change_column_null :machines, :account_id, false 6 | remove_check_constraint :machines, name: 'machines_account_id_not_null' 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20240424022901_add_license_id_not_null_constraint_for_machines.rb: -------------------------------------------------------------------------------- 1 | class AddLicenseIdNotNullConstraintForMachines < ActiveRecord::Migration[7.1] 2 | verbose! 3 | 4 | def up 5 | add_check_constraint :machines, 'license_id IS NOT NULL', name: 'machines_license_id_not_null', validate: false 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20240424022916_validate_license_id_not_null_constraint_for_machines.rb: -------------------------------------------------------------------------------- 1 | class ValidateLicenseIdNotNullConstraintForMachines < ActiveRecord::Migration[7.1] 2 | verbose! 3 | 4 | def up 5 | validate_check_constraint :machines, name: 'machines_license_id_not_null' 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20240424022930_change_license_id_not_null_for_machines.rb: -------------------------------------------------------------------------------- 1 | class ChangeLicenseIdNotNullForMachines < ActiveRecord::Migration[7.1] 2 | verbose! 3 | 4 | def up 5 | change_column_null :machines, :license_id, false 6 | remove_check_constraint :machines, name: 'machines_license_id_not_null' 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20240424040638_add_account_id_not_null_constraint_for_products.rb: -------------------------------------------------------------------------------- 1 | class AddAccountIdNotNullConstraintForProducts < ActiveRecord::Migration[7.1] 2 | verbose! 3 | 4 | def up 5 | add_check_constraint :products, 'account_id IS NOT NULL', name: 'products_account_id_not_null', validate: false 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20240424040646_validate_account_id_not_null_constraint_for_products.rb: -------------------------------------------------------------------------------- 1 | class ValidateAccountIdNotNullConstraintForProducts < ActiveRecord::Migration[7.1] 2 | verbose! 3 | 4 | def up 5 | validate_check_constraint :products, name: 'products_account_id_not_null' 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20240424040655_change_account_id_not_null_for_products.rb: -------------------------------------------------------------------------------- 1 | class ChangeAccountIdNotNullForProducts < ActiveRecord::Migration[7.1] 2 | verbose! 3 | 4 | def up 5 | change_column_null :products, :account_id, false 6 | remove_check_constraint :products, name: 'products_account_id_not_null' 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20240424040952_add_account_id_not_null_constraint_for_policies.rb: -------------------------------------------------------------------------------- 1 | class AddAccountIdNotNullConstraintForPolicies < ActiveRecord::Migration[7.1] 2 | verbose! 3 | 4 | def up 5 | add_check_constraint :policies, 'account_id IS NOT NULL', name: 'policies_account_id_not_null', validate: false 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20240424041001_validate_account_id_not_null_constraint_for_policies.rb: -------------------------------------------------------------------------------- 1 | class ValidateAccountIdNotNullConstraintForPolicies < ActiveRecord::Migration[7.1] 2 | verbose! 3 | 4 | def up 5 | validate_check_constraint :policies, name: 'policies_account_id_not_null' 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20240424041010_change_account_id_not_null_for_policies.rb: -------------------------------------------------------------------------------- 1 | class ChangeAccountIdNotNullForPolicies < ActiveRecord::Migration[7.1] 2 | verbose! 3 | 4 | def up 5 | change_column_null :policies, :account_id, false 6 | remove_check_constraint :policies, name: 'policies_account_id_not_null' 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20240424041221_add_product_id_not_null_constraint_for_policies.rb: -------------------------------------------------------------------------------- 1 | class AddProductIdNotNullConstraintForPolicies < ActiveRecord::Migration[7.1] 2 | verbose! 3 | 4 | def up 5 | add_check_constraint :policies, 'product_id IS NOT NULL', name: 'policies_product_id_not_null', validate: false 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20240424041233_validate_product_id_not_null_constraint_for_policies.rb: -------------------------------------------------------------------------------- 1 | class ValidateProductIdNotNullConstraintForPolicies < ActiveRecord::Migration[7.1] 2 | verbose! 3 | 4 | def up 5 | validate_check_constraint :policies, name: 'policies_product_id_not_null' 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20240424041244_change_product_id_not_null_for_policies.rb: -------------------------------------------------------------------------------- 1 | class ChangeProductIdNotNullForPolicies < ActiveRecord::Migration[7.1] 2 | verbose! 3 | 4 | def up 5 | change_column_null :policies, :product_id, false 6 | remove_check_constraint :policies, name: 'policies_product_id_not_null' 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20240503205624_add_max_users_to_policies.rb: -------------------------------------------------------------------------------- 1 | class AddMaxUsersToPolicies < ActiveRecord::Migration[7.1] 2 | def change 3 | add_column :policies, :max_users, :integer, null: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20240503205655_add_max_users_override_to_licenses.rb: -------------------------------------------------------------------------------- 1 | class AddMaxUsersOverrideToLicenses < ActiveRecord::Migration[7.1] 2 | def change 3 | add_column :licenses, :max_users_override, :integer, null: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20240503211347_add_license_users_counter_cache_to_licenses.rb: -------------------------------------------------------------------------------- 1 | class AddLicenseUsersCounterCacheToLicenses < ActiveRecord::Migration[7.1] 2 | def change 3 | add_column :licenses, :license_users_count, :integer, default: 0, null: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20240503211606_reset_license_users_counter_cache_for_licenses.rb: -------------------------------------------------------------------------------- 1 | class ResetLicenseUsersCounterCacheForLicenses < ActiveRecord::Migration[7.1] 2 | def change 3 | LicenseUser.find_each do |license_user| 4 | License.reset_counters(license_user.license_id, :license_users) 5 | end 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20240510151016_add_machine_leasing_strategy_to_policies.rb: -------------------------------------------------------------------------------- 1 | class AddMachineLeasingStrategyToPolicies < ActiveRecord::Migration[7.1] 2 | def change 3 | add_column :policies, :machine_leasing_strategy, :string, null: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20240510151025_add_process_leasing_strategy_to_policies.rb: -------------------------------------------------------------------------------- 1 | class AddProcessLeasingStrategyToPolicies < ActiveRecord::Migration[7.1] 2 | def change 3 | add_column :policies, :process_leasing_strategy, :string, null: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20240724204821_add_unique_resource_index_to_roles.rb: -------------------------------------------------------------------------------- 1 | class AddUniqueResourceIndexToRoles < ActiveRecord::Migration[7.1] 2 | disable_ddl_transaction! 3 | verbose! 4 | 5 | def change 6 | add_index :roles, %i[resource_id resource_type], unique: true, algorithm: :concurrently, if_not_exists: true 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20241007164206_add_code_to_products.rb: -------------------------------------------------------------------------------- 1 | class AddCodeToProducts < ActiveRecord::Migration[7.1] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | add_column :products, :code, :string, null: true 6 | 7 | add_index :products, %i[account_id code], algorithm: :concurrently, unique: true 8 | add_index :products, :code, algorithm: :concurrently 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20241114214652_remove_unique_index_from_release_manifests.rb: -------------------------------------------------------------------------------- 1 | class RemoveUniqueIndexFromReleaseManifests < ActiveRecord::Migration[7.2] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | remove_index :release_manifests, %i[release_artifact_id], 6 | algorithm: :concurrently, 7 | unique: true 8 | 9 | add_index :release_manifests, %i[release_artifact_id], 10 | algorithm: :concurrently 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /db/migrate/20250313130540_add_sso_organization_id_to_accounts.rb: -------------------------------------------------------------------------------- 1 | class AddSsoOrganizationIdToAccounts < ActiveRecord::Migration[7.2] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | add_column :accounts, :sso_organization_id, :string, null: true 6 | add_index :accounts, :sso_organization_id, unique: true, algorithm: :concurrently 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20250313130551_add_sso_profile_id_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddSsoProfileIdToUsers < ActiveRecord::Migration[7.2] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | add_column :users, :sso_profile_id, :string, null: true 6 | add_index :users, %i[account_id sso_profile_id], unique: true, algorithm: :concurrently 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20250313130556_add_sso_idp_id_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddSsoIdpIdToUsers < ActiveRecord::Migration[7.2] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | add_column :users, :sso_idp_id, :string, null: true 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20250313130604_add_sso_connection_id_to_users.rb: -------------------------------------------------------------------------------- 1 | class AddSsoConnectionIdToUsers < ActiveRecord::Migration[7.2] 2 | def change 3 | add_column :users, :sso_connection_id, :string, null: true 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20250313130610_add_sso_organization_domain_to_accounts.rb: -------------------------------------------------------------------------------- 1 | class AddSsoOrganizationDomainToAccounts < ActiveRecord::Migration[7.2] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | add_column :accounts, :sso_organization_domains, :string, array: true, default: [] 6 | add_index :accounts, :sso_organization_domains, algorithm: :concurrently, using: :gin 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20250313145717_add_sso_session_duration_to_accounts.rb: -------------------------------------------------------------------------------- 1 | class AddSsoSessionDurationToAccounts < ActiveRecord::Migration[7.2] 2 | def change 3 | add_column :accounts, :sso_session_duration, :integer 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20250313155620_add_nullable_token_id_to_sessions.rb: -------------------------------------------------------------------------------- 1 | class AddNullableTokenIdToSessions < ActiveRecord::Migration[7.2] 2 | def up 3 | change_column_null :sessions, :token_id, true 4 | end 5 | 6 | def down 7 | change_column_null :sessions, :token_id, false 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20250314161819_add_sso_jit_provisioning_to_accounts.rb: -------------------------------------------------------------------------------- 1 | class AddSsoJitProvisioningToAccounts < ActiveRecord::Migration[7.2] 2 | def change 3 | add_column :accounts, :sso_jit_provisioning, :boolean, null: false, default: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20250314195615_add_sso_external_authn_to_accounts.rb: -------------------------------------------------------------------------------- 1 | class AddSsoExternalAuthnToAccounts < ActiveRecord::Migration[7.2] 2 | def change 3 | add_column :accounts, :sso_external_authn, :boolean, null: false, default: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20250403140338_add_log_retention_limits_to_plans.rb: -------------------------------------------------------------------------------- 1 | class AddLogRetentionLimitsToPlans < ActiveRecord::Migration[7.2] 2 | verbose! 3 | 4 | def change 5 | add_column :plans, :request_log_retention_duration, :integer 6 | add_column :plans, :event_log_retention_duration, :integer 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20250403140401_add_distribution_limits_to_plans.rb: -------------------------------------------------------------------------------- 1 | class AddDistributionLimitsToPlans < ActiveRecord::Migration[7.2] 2 | verbose! 3 | 4 | def change 5 | add_column :plans, :max_storage, :bigint 6 | add_column :plans, :max_transfer, :bigint 7 | add_column :plans, :max_upload, :bigint 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20250404171439_add_policy_to_machines.rb: -------------------------------------------------------------------------------- 1 | class AddPolicyToMachines < ActiveRecord::Migration[7.2] 2 | disable_ddl_transaction! 3 | verbose! 4 | 5 | def change 6 | add_column :machines, :policy_id, :uuid, null: true, if_not_exists: true 7 | 8 | add_index :machines, :policy_id, algorithm: :concurrently, if_not_exists: true 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20250407173652_add_heartbeat_cull_indexes_to_policies.rb: -------------------------------------------------------------------------------- 1 | class AddHeartbeatCullIndexesToPolicies < ActiveRecord::Migration[7.2] 2 | disable_ddl_transaction! 3 | verbose! 4 | 5 | def change 6 | add_index :policies, :heartbeat_cull_strategy, algorithm: :concurrently 7 | add_index :policies, :require_heartbeat, algorithm: :concurrently 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20250408141503_add_policy_id_not_null_constraint_for_machines.rb: -------------------------------------------------------------------------------- 1 | class AddPolicyIdNotNullConstraintForMachines < ActiveRecord::Migration[7.2] 2 | verbose! 3 | 4 | def up 5 | add_check_constraint :machines, 'policy_id IS NOT NULL', name: 'machines_policy_id_not_null', validate: false 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20250408141515_validate_policy_id_not_null_constraint_for_machines.rb: -------------------------------------------------------------------------------- 1 | class ValidatePolicyIdNotNullConstraintForMachines < ActiveRecord::Migration[7.2] 2 | verbose! 3 | 4 | def up 5 | validate_check_constraint :machines, name: 'machines_policy_id_not_null' 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20250408141534_change_policy_id_not_null_for_machines.rb: -------------------------------------------------------------------------------- 1 | class ChangePolicyIdNotNullForMachines < ActiveRecord::Migration[7.2] 2 | verbose! 3 | 4 | def up 5 | change_column_null :machines, :policy_id, false 6 | remove_check_constraint :machines, name: 'machines_policy_id_not_null' 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/migrate/20250515142604_add_product_to_webhook_endpoints.rb: -------------------------------------------------------------------------------- 1 | class AddProductToWebhookEndpoints < ActiveRecord::Migration[7.2] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | add_column :webhook_endpoints, :product_id, :uuid, null: true, if_not_exists: true 6 | 7 | add_index :webhook_endpoints, :product_id, algorithm: :concurrently, if_not_exists: true 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20250515152010_add_webhook_endpoint_to_webhook_events.rb: -------------------------------------------------------------------------------- 1 | class AddWebhookEndpointToWebhookEvents < ActiveRecord::Migration[7.2] 2 | disable_ddl_transaction! 3 | 4 | def change 5 | add_column :webhook_events, :webhook_endpoint_id, :uuid, null: true, if_not_exists: true # FIXME(ezekg) make not-null 6 | 7 | add_index :webhook_events, :webhook_endpoint_id, algorithm: :concurrently, if_not_exists: true 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /db/migrate/20250529131947_add_backdated_to_to_releases.rb: -------------------------------------------------------------------------------- 1 | class AddBackdatedToToReleases < ActiveRecord::Migration[7.2] 2 | disable_ddl_transaction! 3 | verbose! 4 | 5 | def change 6 | add_column :releases, :backdated_to, :timestamp, null: true 7 | 8 | add_index :releases, %i[account_id created_at backdated_to], 9 | order: { created_at: :desc, backdated_to: :desc }, 10 | algorithm: :concurrently 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /db/migrate/20250530155151_add_account_to_roles.rb: -------------------------------------------------------------------------------- 1 | class AddAccountToRoles < ActiveRecord::Migration[7.2] 2 | disable_ddl_transaction! 3 | verbose! 4 | 5 | def change 6 | add_column :roles, :account_id, :uuid, null: true, if_not_exists: true # FIXME(ezekg) make not-null 7 | 8 | add_index :roles, :account_id, algorithm: :concurrently, if_not_exists: true 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/migrate/20250531022220_add_account_id_not_null_constraint_for_roles.rb: -------------------------------------------------------------------------------- 1 | class AddAccountIdNotNullConstraintForRoles < ActiveRecord::Migration[7.2] 2 | verbose! 3 | 4 | def up 5 | add_check_constraint :roles, 'account_id IS NOT NULL', name: 'roles_account_id_not_null', validate: false 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20250531022728_validate_account_id_not_null_constraint_for_roles.rb: -------------------------------------------------------------------------------- 1 | class ValidateAccountIdNotNullConstraintForRoles < ActiveRecord::Migration[7.2] 2 | verbose! 3 | 4 | def up 5 | validate_check_constraint :roles, name: 'roles_account_id_not_null' 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20250531023019_change_account_id_not_null_constraint_for_roles.rb: -------------------------------------------------------------------------------- 1 | class ChangeAccountIdNotNullConstraintForRoles < ActiveRecord::Migration[7.2] 2 | verbose! 3 | 4 | def up 5 | change_column_null :roles, :account_id, false 6 | remove_check_constraint :roles, name: 'roles_account_id_not_null' 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /features/support/bullet.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'bullet' 4 | -------------------------------------------------------------------------------- /features/support/factory_bot.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'factory_bot_rails' 4 | 5 | World FactoryBot::Syntax::Methods 6 | World EnvHelper::WorldMethods 7 | -------------------------------------------------------------------------------- /features/support/faker.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'faker' 4 | -------------------------------------------------------------------------------- /features/support/helpers.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | Dir[Rails.root.join('spec/support/helpers/*.rb')].each { |f| require(f) } 4 | -------------------------------------------------------------------------------- /features/support/matchers.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | Dir[Rails.root.join('spec/support/matchers/*.rb')].each { |f| require(f) } 4 | -------------------------------------------------------------------------------- /features/support/rspec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'cucumber/rspec/doubles' 4 | require 'rspec/expectations' 5 | 6 | # set this so that long strings e.g. HTML/JSON are not truncated in failure diffs 7 | RSpec::Expectations.configuration.max_formatted_output_length = nil 8 | -------------------------------------------------------------------------------- /features/support/sidekiq.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'sidekiq/testing' 4 | 5 | Sidekiq::Testing.fake! 6 | -------------------------------------------------------------------------------- /features/support/webmock.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'webmock/cucumber' 4 | -------------------------------------------------------------------------------- /lib/keygen/ee.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require_relative 'ee/license_file' 4 | require_relative 'ee/license' 5 | require_relative 'ee/protected_methods' 6 | require_relative 'ee/protected_class' 7 | require_relative 'ee/router' 8 | require_relative 'ee/sso' 9 | 10 | module Keygen 11 | module EE 12 | def self.license_file = LicenseFile.current 13 | def self.license = License.current 14 | end 15 | 16 | ActionDispatch::Routing::Mapper.send(:include, EE::Router) 17 | end 18 | -------------------------------------------------------------------------------- /lib/keygen/ee/router.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Keygen 4 | module EE 5 | module Router 6 | class Constraint 7 | def matches?(request) = Keygen.ee? 8 | end 9 | 10 | def ee(&) 11 | constraints Constraint.new do 12 | instance_eval(&) 13 | end 14 | end 15 | end 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /lib/keygen/exporter/v1/writer.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require_relative '../writer' 4 | 5 | module Keygen 6 | module Exporter 7 | module V1 8 | class Writer < Writer 9 | def write_version = super(1) 10 | def write_chunk(data) 11 | bytesize = [data.bytesize].pack('Q>') 12 | 13 | write(bytesize + data) 14 | end 15 | end 16 | end 17 | end 18 | end 19 | -------------------------------------------------------------------------------- /lib/keygen/importer/reader.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Keygen 4 | module Importer 5 | class Reader 6 | def initialize(io) 7 | raise ArgumentError, 'io object is required' unless readable?(io) 8 | 9 | @io = io 10 | end 11 | 12 | def read(n) = @io.read(n) 13 | 14 | private 15 | 16 | def readable?(io) = io.respond_to?(:read) 17 | end 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /lib/keygen/importer/version_reader.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require_relative 'reader' 4 | 5 | module Keygen 6 | module Importer 7 | class VersionReader < Reader 8 | def read_version = read(1).unpack1('C') # first byte is the version 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /lib/keygen/jsonapi.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require_relative 'jsonapi/renderer' 4 | require_relative 'jsonapi/errors' 5 | 6 | module Keygen 7 | module JSONAPI 8 | def self.render(*, **) = Renderer.new(**).render(*) 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /lib/tasks/db.rake: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | namespace :db do 4 | namespace :seed do 5 | desc 'Loads the seed data from db/seeds/development.rb' 6 | task development: %i[environment] do 7 | abort "Rails environment must be development (got #{Rails.env})" unless 8 | Rails.env.development? 9 | 10 | load Rails.root / 'db' / 'seeds' / 'development.rb' 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /lib/tasks/keygen/about.rake: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | namespace :keygen do 4 | desc 'List information about Keygen and the environment' 5 | task about: %i[environment] do 6 | Keygen::Console.about! 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /lib/tasks/silence.rake: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | desc 'Disables all logging until environment is loaded' 4 | task :silence do 5 | ActiveRecord::Base.logger = Rails.logger = ActiveSupport::Logger.new(nil) 6 | end 7 | -------------------------------------------------------------------------------- /log/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keygen-sh/keygen-api/2e0a174ef3d59304ed5019ba60000984892603c6/log/.keep -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keygen-sh/keygen-api/2e0a174ef3d59304ed5019ba60000984892603c6/public/favicon.ico -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: / 3 | -------------------------------------------------------------------------------- /spec/factories/account_setting.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | FactoryBot.define do 4 | factory :account_setting, aliases: %i[setting] do 5 | initialize_with { AccountSetting.find_by(account:, key:) || new(**attributes.reject { _2 in NIL_ACCOUNT }) } 6 | 7 | sequence :key, %w[default_license_permissions default_user_permissions].cycle 8 | value { %w[license.validate] } 9 | 10 | account { nil } 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /spec/factories/customer.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | FactoryBot.define do 4 | Stripe::Customer.send :alias_method, :save!, :save 5 | 6 | factory :customer, class: Stripe::Customer do 7 | email { Faker::Internet.safe_email } 8 | 9 | trait :with_card do 10 | source { StripeHelper.generate_card_token(last4: "4242", exp_month: 1, exp_year: 2552) } 11 | end 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /spec/factories/event_type.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | FactoryBot.define do 4 | factory :event_type do 5 | initialize_with { EventType.find_by(event:) || new(**attributes) } 6 | 7 | event { "test.event.#{SecureRandom.hex}" } 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /spec/factories/group_permission.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | FactoryBot.define do 4 | factory :group_permission do 5 | initialize_with { new(**attributes) } 6 | 7 | permission { nil } 8 | group { nil } 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /spec/factories/metric.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | FactoryBot.define do 4 | factory :metric do 5 | initialize_with { new(**attributes) } 6 | 7 | data {{ data: { foo: 'bar' } }} 8 | 9 | event_type 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /spec/factories/permission.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | FactoryBot.define do 4 | factory :permission do 5 | initialize_with { new(**attributes) } 6 | 7 | action { 'test:read' } 8 | end 9 | end 10 | -------------------------------------------------------------------------------- /spec/factories/release_arch.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | FactoryBot.define do 4 | factory :release_arch, aliases: %i[arch] do 5 | initialize_with { new(**attributes.reject { NIL_ACCOUNT == _2 }) } 6 | 7 | sequence :key, %w[386 amd64 arm arm64 mips mips64 mips64le mipsle ppc64 ppc64le s390x].cycle 8 | 9 | account { NIL_ACCOUNT } 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /spec/factories/release_download_link.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | FactoryBot.define do 4 | factory :release_download_link do 5 | initialize_with { new(**attributes.reject { _2 in NIL_ACCOUNT | NIL_ENVIRONMENT }) } 6 | 7 | account { NIL_ACCOUNT } 8 | environment { NIL_ENVIRONMENT } 9 | release { build(:release, account:, environment:) } 10 | 11 | url { Faker::Internet.url } 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /spec/factories/release_filetype.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | FactoryBot.define do 4 | factory :release_filetype, aliases: %i[filetype] do 5 | initialize_with { new(**attributes.reject { NIL_ACCOUNT == _2 }) } 6 | 7 | sequence :key, %w[dmg exe zip tar.gz appimage].cycle 8 | 9 | account { NIL_ACCOUNT } 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /spec/factories/release_platform.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | FactoryBot.define do 4 | factory :release_platform, aliases: %i[platform] do 5 | initialize_with { new(**attributes.reject { _2 in NIL_ACCOUNT }) } 6 | 7 | sequence :key, %w[darwin linux windows].cycle 8 | 9 | account { NIL_ACCOUNT } 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /spec/factories/release_upgrade_link.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | FactoryBot.define do 4 | factory :release_upgrade_link do 5 | initialize_with { new(**attributes.reject { _2 in NIL_ACCOUNT | NIL_ENVIRONMENT }) } 6 | 7 | account { NIL_ACCOUNT } 8 | environment { NIL_ENVIRONMENT } 9 | release { build(:release, account:, environment:) } 10 | 11 | url { Faker::Internet.url } 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /spec/factories/release_upload_link.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | FactoryBot.define do 4 | factory :release_upload_link do 5 | initialize_with { new(**attributes.reject { _2 in NIL_ACCOUNT | NIL_ENVIRONMENT }) } 6 | 7 | account { NIL_ACCOUNT } 8 | environment { NIL_ENVIRONMENT } 9 | release { build(:release, account:, environment:) } 10 | 11 | url { Faker::Internet.url } 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /spec/factories/role_permission.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | FactoryBot.define do 4 | factory :role_permission do 5 | initialize_with { new(**attributes) } 6 | 7 | permission { nil } 8 | role { nil } 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /spec/factories/subscription.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | FactoryBot.define do 4 | Stripe::Subscription.send :alias_method, :save!, :save 5 | 6 | factory :subscription, class: Stripe::Subscription do 7 | customer { create(:customer).id } 8 | plan { nil } 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /spec/factories/token_permission.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | FactoryBot.define do 4 | factory :token_permission do 5 | initialize_with { new(**attributes) } 6 | 7 | permission { nil } 8 | token { nil } 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /spec/fixtures/files/alpine-3.20.3.tar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keygen-sh/keygen-api/2e0a174ef3d59304ed5019ba60000984892603c6/spec/fixtures/files/alpine-3.20.3.tar -------------------------------------------------------------------------------- /spec/fixtures/files/hello-2.0.0.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keygen-sh/keygen-api/2e0a174ef3d59304ed5019ba60000984892603c6/spec/fixtures/files/hello-2.0.0.tgz -------------------------------------------------------------------------------- /spec/fixtures/files/large.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keygen-sh/keygen-api/2e0a174ef3d59304ed5019ba60000984892603c6/spec/fixtures/files/large.tar.gz -------------------------------------------------------------------------------- /spec/fixtures/files/ping-1.0.0-java.gem: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keygen-sh/keygen-api/2e0a174ef3d59304ed5019ba60000984892603c6/spec/fixtures/files/ping-1.0.0-java.gem -------------------------------------------------------------------------------- /spec/fixtures/files/ping-1.0.0.gem: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keygen-sh/keygen-api/2e0a174ef3d59304ed5019ba60000984892603c6/spec/fixtures/files/ping-1.0.0.gem -------------------------------------------------------------------------------- /spec/fixtures/gems/ping/lib/ping.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require_relative 'ping/version' 4 | 5 | module Ping 6 | def self.ping = 'pong' 7 | end 8 | -------------------------------------------------------------------------------- /spec/fixtures/gems/ping/lib/ping/version.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Ping 4 | VERSION = '1.0.0' 5 | end 6 | -------------------------------------------------------------------------------- /spec/fixtures/packages/hello/README.md: -------------------------------------------------------------------------------- 1 | # Hello 2 | -------------------------------------------------------------------------------- /spec/fixtures/packages/hello/src/index.js: -------------------------------------------------------------------------------- 1 | // hello greets provided subject 2 | export const hello = (subject = 'world') => `Hello, ${subject}!` 3 | -------------------------------------------------------------------------------- /spec/mailers/previews/recovery_mailer_preview.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class RecoveryMailerPreview < ActionMailer::Preview 4 | def recover_accounts_for_email 5 | RecoveryMailer.recover_accounts_for_email email: User.first.email 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /spec/mailers/previews/user_mailer_preview.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | class UserMailerPreview < ActionMailer::Preview 4 | 5 | def password_reset 6 | token, enc = user.generate_hashed_token(:password_reset_token, length: 24) 7 | 8 | user.password_reset_sent_at = Time.zone.now 9 | user.password_reset_token = enc 10 | 11 | UserMailer.password_reset user: user, token: token 12 | end 13 | 14 | private 15 | 16 | def user 17 | @user ||= User.first 18 | end 19 | end 20 | -------------------------------------------------------------------------------- /spec/models/entitlement_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'rails_helper' 4 | require 'spec_helper' 5 | 6 | describe Entitlement, type: :model do 7 | it_behaves_like :environmental 8 | it_behaves_like :accountable 9 | end 10 | -------------------------------------------------------------------------------- /spec/models/event_log_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'rails_helper' 4 | require 'spec_helper' 5 | 6 | describe EventLog, type: :model do 7 | it_behaves_like :environmental 8 | it_behaves_like :accountable 9 | end 10 | -------------------------------------------------------------------------------- /spec/models/group_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'rails_helper' 4 | require 'spec_helper' 5 | 6 | describe Group, type: :model do 7 | it_behaves_like :environmental 8 | it_behaves_like :accountable 9 | end 10 | -------------------------------------------------------------------------------- /spec/models/release_download_link_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'rails_helper' 4 | require 'spec_helper' 5 | 6 | describe ReleaseDownloadLink, type: :model do 7 | let(:account) { create(:account) } 8 | 9 | it_behaves_like :environmental 10 | it_behaves_like :encryptable 11 | end 12 | -------------------------------------------------------------------------------- /spec/models/release_upgrade_link_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'rails_helper' 4 | require 'spec_helper' 5 | 6 | describe ReleaseUpgradeLink, type: :model do 7 | let(:account) { create(:account) } 8 | 9 | it_behaves_like :environmental 10 | it_behaves_like :encryptable 11 | end 12 | -------------------------------------------------------------------------------- /spec/models/release_upload_link_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'rails_helper' 4 | require 'spec_helper' 5 | 6 | describe ReleaseUploadLink, type: :model do 7 | let(:account) { create(:account) } 8 | 9 | it_behaves_like :environmental 10 | it_behaves_like :encryptable 11 | end 12 | -------------------------------------------------------------------------------- /spec/models/request_log_spec.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'rails_helper' 4 | require 'spec_helper' 5 | 6 | describe RequestLog, type: :model do 7 | it_behaves_like :environmental 8 | it_behaves_like :accountable 9 | end 10 | -------------------------------------------------------------------------------- /spec/support/clear_cache.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | RSpec.configure do |config| 4 | config.before(:each) { Rails.cache.clear } 5 | config.after(:all) { Rails.cache.clear } 6 | end 7 | -------------------------------------------------------------------------------- /spec/support/factory_bot.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | RSpec.configure do |config| 4 | config.include FactoryBot::Syntax::Methods 5 | end 6 | -------------------------------------------------------------------------------- /spec/support/helpers/account_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | # NOTE(ezekg) This is used as a sentinel value during tests to determine 4 | # whether or not a factory's account should run through 5 | # the default flow vs an explicit nil value given during 6 | # factory initialization. 7 | NIL_ACCOUNT = Account.new(id: nil, slug: 'FOR_TEST_EYES_ONLY').freeze 8 | -------------------------------------------------------------------------------- /spec/support/helpers/time_helper.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module TimeHelper 4 | def with_time(t, &) 5 | travel_to(t) { yield t } 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /spec/support/matchers/exclude_matcher.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | RSpec::Matchers.define_negated_matcher :exclude, :include 4 | -------------------------------------------------------------------------------- /spec/support/matchers/not_change_matcher.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | RSpec::Matchers.define_negated_matcher :not_change, :change 4 | -------------------------------------------------------------------------------- /spec/support/matchers/not_raise_error_matcher.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | RSpec::Matchers.define_negated_matcher :not_raise_error, :raise_error 4 | -------------------------------------------------------------------------------- /tmp/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keygen-sh/keygen-api/2e0a174ef3d59304ed5019ba60000984892603c6/tmp/.keep --------------------------------------------------------------------------------