 -- Name: teams_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
 --
 
-ALTER SEQUENCE teams_id_seq OWNED BY teams.id;
+ALTER SEQUENCE public.teams_id_seq OWNED BY public.teams.id;
 
 
 --
 -- Name: teams_users_roles; Type: TABLE; Schema: public; Owner: -
 --
 
-CREATE TABLE teams_users_roles (
+CREATE TABLE public.teams_users_roles (
     id integer NOT NULL,
     team_id integer,
     user_id integer,
-    role user_role NOT NULL
+    role public.user_role NOT NULL
 );
 
 

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

CREATE INDEX cases_document_tsvector_index ON cases USING gin (document_tsvector);


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

CREATE INDEX index_assignments_on_case_id ON assignments USING btree (case_id);


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

CREATE INDEX index_assignments_on_state ON assignments USING btree (state);


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

CREATE INDEX index_assignments_on_team_id ON assignments USING btree (team_id);


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

CREATE INDEX index_assignments_on_user_id ON assignments USING btree (user_id);


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

CREATE INDEX index_case_attachments_on_case_id ON case_attachments USING btree (case_id);


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

CREATE UNIQUE INDEX index_case_attachments_on_key ON case_attachments USING btree (key);


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

CREATE UNIQUE INDEX index_case_number_counters_on_date ON case_number_counters USING btree (date);


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

CREATE UNIQUE INDEX index_case_transitions_parent_most_recent ON case_transitions USING btree (case_id, most_recent) WHERE most_recent;


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

CREATE UNIQUE INDEX index_case_transitions_parent_sort ON case_transitions USING btree (case_id, sort_key);


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

CREATE INDEX index_cases_exemptions_on_case_id ON cases_exemptions USING btree (case_id);


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

CREATE INDEX index_cases_exemptions_on_exemption_id ON cases_exemptions USING btree (exemption_id);


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

CREATE INDEX index_cases_on_deleted ON cases USING btree (deleted);


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

CREATE UNIQUE INDEX index_cases_on_number ON cases USING btree (number);


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

CREATE INDEX index_cases_on_requester_type ON cases USING btree (requester_type);


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

CREATE INDEX index_cases_users_transitions_trackers_on_case_id ON cases_users_transitions_trackers USING btree (case_id);


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

CREATE INDEX index_cases_users_transitions_trackers_on_user_id ON cases_users_transitions_trackers USING btree (user_id);


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

CREATE INDEX index_linked_cases_on_case_id ON linked_cases USING btree (case_id);


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

CREATE UNIQUE INDEX index_linked_cases_on_case_id_and_linked_case_id_and_type ON linked_cases USING btree (case_id, linked_case_id, type);


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

CREATE UNIQUE INDEX index_report_types_on_abbr ON report_types USING btree (abbr);


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

CREATE INDEX index_reports_on_report_type_id ON reports USING btree (report_type_id);


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

CREATE UNIQUE INDEX index_sessions_on_session_id ON sessions USING btree (session_id);


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

CREATE INDEX index_sessions_on_updated_at ON sessions USING btree (updated_at);


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

CREATE UNIQUE INDEX index_team_correspondence_type_roles_on_type_id_and_team_id ON team_correspondence_type_roles USING btree (correspondence_type_id, team_id);


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

CREATE INDEX index_team_properties_on_team_id ON team_properties USING btree (team_id);


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

CREATE UNIQUE INDEX index_team_properties_on_team_id_and_key_and_value ON team_properties USING btree (team_id, key, value);


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

CREATE UNIQUE INDEX index_team_table_team_id_role_user_id ON teams_users_roles USING btree (team_id, role, user_id);


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

CREATE UNIQUE INDEX index_teams_on_code ON teams USING btree (code);


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

CREATE INDEX index_teams_on_email ON teams USING btree (email);


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

CREATE INDEX index_teams_on_name ON teams USING btree (name);


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

CREATE INDEX index_teams_on_parent_id ON teams USING btree (parent_id);


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

CREATE INDEX index_teams_on_type ON teams USING btree (type);


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

CREATE UNIQUE INDEX index_teams_on_type_and_name ON teams USING btree (type, name);


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

CREATE INDEX index_teams_users_roles_on_team_id ON teams_users_roles USING btree (team_id);


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

CREATE INDEX index_teams_users_roles_on_user_id ON teams_users_roles USING btree (user_id);


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

CREATE UNIQUE INDEX index_users_on_email ON users USING btree (email);


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

CREATE UNIQUE INDEX index_users_on_reset_password_token ON users USING btree (reset_password_token);


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

CREATE UNIQUE INDEX index_users_on_unlock_token ON users USING btree (unlock_token);


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

CREATE INDEX index_versions_on_item_type_and_item_id ON versions USING btree (item_type, item_id);


--

COMMENT ON EXTENSION citext IS 'data type for case-insensitive character strings';


--
-- Name: attachment_type; Type: TYPE; Schema: public; Owner: -
--

CREATE TYPE public.attachment_type AS ENUM (
    'response',
    'request'
);
