From 454d0b5c1e9e0bccff6792d989e37ef8ecbc151d Mon Sep 17 00:00:00 2001 From: f Date: Fri, 14 Jun 2024 16:25:03 -0300 Subject: [PATCH] fix: los roles pueden ser opcionales --- app/models/deploy.rb | 2 +- db/migrate/20240614191548_deploy_rol_id_can_be_null.rb | 8 ++++++++ db/structure.sql | 3 ++- 3 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 db/migrate/20240614191548_deploy_rol_id_can_be_null.rb diff --git a/app/models/deploy.rb b/app/models/deploy.rb index 77646034..b9d6c9d3 100644 --- a/app/models/deploy.rb +++ b/app/models/deploy.rb @@ -10,7 +10,7 @@ require 'open3' # :attributes`. class Deploy < ApplicationRecord belongs_to :site - belongs_to :rol + belongs_to :rol, optional: true has_many :build_stats, dependent: :destroy diff --git a/db/migrate/20240614191548_deploy_rol_id_can_be_null.rb b/db/migrate/20240614191548_deploy_rol_id_can_be_null.rb new file mode 100644 index 00000000..425861aa --- /dev/null +++ b/db/migrate/20240614191548_deploy_rol_id_can_be_null.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +# El rol_id no es necesario para todos los deploys +class DeployRolIdCanBeNull < ActiveRecord::Migration[6.1] + def change + change_column :deploys, :rol_id, :integer, null: true + end +end diff --git a/db/structure.sql b/db/structure.sql index 21cf04d0..8f9f5d5e 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -2719,6 +2719,7 @@ INSERT INTO "schema_migrations" (version) VALUES ('20240316203721'), ('20240318183846'), ('20240319124212'), -('20240319144735'); +('20240319144735'), +('20240614191548');