Skip to content

Commit

Permalink
add reviewed and recommendations fields to entry_requests
Browse files Browse the repository at this point in the history
  • Loading branch information
SepsiLaszlo committed Dec 18, 2024
1 parent a1f6f45 commit 8069df5
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 14 deletions.
13 changes: 8 additions & 5 deletions app/models/entry_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,19 @@
#
# Table name: entry_requests
#
# id :bigint not null, primary key
# entry_type :string(255)
# justification :text
# evaluation_id :bigint not null
# user_id :bigint
# id :bigint not null, primary key
# entry_type :string(255)
# justification :text
# recommendations :jsonb
# reviewed :boolean default(FALSE), not null
# evaluation_id :bigint not null
# user_id :bigint
#
# Indexes
#
# bel_tipus_idx (entry_type)
# index_entry_requests_on_evaluation_id_and_user_id (evaluation_id,user_id) UNIQUE
# index_entry_requests_on_reviewed (reviewed)
#
# Foreign Keys
#
Expand Down
40 changes: 31 additions & 9 deletions db/structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,40 @@ SET client_min_messages = warning;
SET row_security = off;

--
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: -
-- Name: public; Type: SCHEMA; Schema: -; Owner: -
--

CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
-- *not* creating schema, since initdb creates it


--
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: -
-- Name: random_string(integer); Type: FUNCTION; Schema: public; Owner: -
--

COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
CREATE FUNCTION public.random_string(length integer) RETURNS text
LANGUAGE plpgsql
AS $$
DECLARE
effective_length NUMERIC:= COALESCE(length, 1);
result TEXT := '';
chars TEXT := 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
BEGIN
FOR i IN 1..effective_length LOOP
result := result || substr(chars, floor(random() * length(chars) + 1)::INT, 1);
END LOOP;
RETURN result;
END;
$$;


SET default_tablespace = '';

-- SET default_table_access_method = heap;
SET default_with_oids = false;
SET default_table_access_method = heap;

--
-- Name: ar_internal_metadata; Type: TABLE; Schema: public; Owner: -
--


CREATE TABLE public.ar_internal_metadata (
key character varying NOT NULL,
value character varying,
Expand Down Expand Up @@ -61,7 +73,9 @@ CREATE TABLE public.entry_requests (
entry_type character varying(255),
justification text,
evaluation_id bigint NOT NULL,
user_id bigint
user_id bigint,
reviewed boolean DEFAULT false NOT NULL,
recommendations jsonb
);


Expand Down Expand Up @@ -1249,6 +1263,13 @@ CREATE INDEX idx_groups_grp_type ON public.groups USING btree (grp_type);
CREATE UNIQUE INDEX index_entry_requests_on_evaluation_id_and_user_id ON public.entry_requests USING btree (evaluation_id, user_id);


--
-- Name: index_entry_requests_on_reviewed; Type: INDEX; Schema: public; Owner: -
--

CREATE INDEX index_entry_requests_on_reviewed ON public.entry_requests USING btree (reviewed);


--
-- Name: index_evaluations_on_group_id_and_semester_and_idx_in_semester; Type: INDEX; Schema: public; Owner: -
--
Expand Down Expand Up @@ -1763,6 +1784,7 @@ INSERT INTO "schema_migrations" (version) VALUES
('20221209072919'),
('20221209100356'),
('20240419155504'),
('20240707094123');
('20240707094123'),
('20241218093607');


0 comments on commit 8069df5

Please sign in to comment.