5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-20 08:16:21 +00:00

feat: asociar rol con deploy nos permite acceder al token

This commit is contained in:
f 2024-02-16 14:53:05 -03:00
parent 6841945b39
commit cdf0685c67
No known key found for this signature in database
4 changed files with 25 additions and 2 deletions

View file

@ -10,6 +10,8 @@ require 'open3'
# :attributes`.
class Deploy < ApplicationRecord
belongs_to :site
belongs_to :rol
has_many :build_stats, dependent: :destroy
DEPENDENCIES = []

View file

@ -11,6 +11,7 @@ class Rol < ApplicationRecord
belongs_to :usuarie
belongs_to :site
has_many :deploys
validates_inclusion_of :rol, in: ROLES

View file

@ -0,0 +1,18 @@
# frozen_string_literal: true
# Establece una relación entre roles y deploys
class AddRolToDeploys < ActiveRecord::Migration[6.1]
def up
add_column :deploys, :rol_id, :integer, index: true
Deploy.find_each do |deploy|
rol_id = deploy.site.roles.find_by(rol: 'usuarie', temporal: false).id
deploy.update_column(:rol_id, rol_id) if rol_id
end
end
def down
remove_column :deploys, :rol_id
end
end

View file

@ -759,7 +759,8 @@ CREATE TABLE public.deploys (
updated_at timestamp without time zone NOT NULL,
site_id integer,
type character varying,
"values" text
"values" text,
rol_id integer
);
@ -2318,6 +2319,7 @@ INSERT INTO "schema_migrations" (version) VALUES
('20230731195050'),
('20230829204127'),
('20230921155401'),
('20230927153926');
('20230927153926'),
('20240216170202');