add datbase comments
This commit is contained in:
parent
590891a940
commit
3b680daef0
1 changed files with 181 additions and 1 deletions
182
db_schema.sql
182
db_schema.sql
|
@ -16,6 +16,15 @@ SET xmloption = content;
|
|||
SET client_min_messages = warning;
|
||||
SET row_security = off;
|
||||
|
||||
--
|
||||
-- Name: audit; Type: SCHEMA; Schema: -; Owner: postgres
|
||||
--
|
||||
|
||||
CREATE SCHEMA audit;
|
||||
|
||||
|
||||
ALTER SCHEMA audit OWNER TO postgres;
|
||||
|
||||
--
|
||||
-- Name: event_type; Type: TYPE; Schema: public; Owner: postgres
|
||||
--
|
||||
|
@ -121,6 +130,13 @@ CREATE TABLE public.acl_rules (
|
|||
|
||||
ALTER TABLE public.acl_rules OWNER TO postgres;
|
||||
|
||||
--
|
||||
-- Name: TABLE acl_rules; Type: COMMENT; Schema: public; Owner: postgres
|
||||
--
|
||||
|
||||
COMMENT ON TABLE public.acl_rules IS 'This describes what an authorized user is allowed to render, see and search when they are using the website. You can only delete and create new ACL rules, but never change them. This behavior will be hidden by the system from the user perspective. This is so that we can audit access later.';
|
||||
|
||||
|
||||
--
|
||||
-- Name: acl_rules_acl_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
|
||||
--
|
||||
|
@ -161,12 +177,113 @@ CREATE TABLE public.event (
|
|||
reason text,
|
||||
topic_change text,
|
||||
removed_id bigint,
|
||||
removes_id bigint
|
||||
removes_id bigint,
|
||||
log_id bigint NOT NULL
|
||||
);
|
||||
|
||||
|
||||
ALTER TABLE public.event OWNER TO postgres;
|
||||
|
||||
--
|
||||
-- Name: TABLE event; Type: COMMENT; Schema: public; Owner: postgres
|
||||
--
|
||||
|
||||
COMMENT ON TABLE public.event IS 'Event table is a descriptor of an operator event in a location. It''s purpose is to be used to help power the eventual search and identify points of interest.
|
||||
|
||||
+b, +q, and other events in the channel done by an op are all supposed to be identified and recorded here.';
|
||||
|
||||
|
||||
--
|
||||
-- Name: COLUMN event.server_id; Type: COMMENT; Schema: public; Owner: postgres
|
||||
--
|
||||
|
||||
COMMENT ON COLUMN public.event.server_id IS 'With the changes I''ve made this is probably redundant and not needed. location_id should already point this in the right place';
|
||||
|
||||
|
||||
--
|
||||
-- Name: COLUMN event.location_id; Type: COMMENT; Schema: public; Owner: postgres
|
||||
--
|
||||
|
||||
COMMENT ON COLUMN public.event.location_id IS 'An id that descibes where this event happened. Almost certainly a channel on the irc server.';
|
||||
|
||||
|
||||
--
|
||||
-- Name: COLUMN event.happened_at; Type: COMMENT; Schema: public; Owner: postgres
|
||||
--
|
||||
|
||||
COMMENT ON COLUMN public.event.happened_at IS 'Recorded timestamp of this event.';
|
||||
|
||||
|
||||
--
|
||||
-- Name: COLUMN event.affected_ids; Type: COMMENT; Schema: public; Owner: postgres
|
||||
--
|
||||
|
||||
COMMENT ON COLUMN public.event.affected_ids IS 'Identities that were online and in the location that the action took place and are beleived to have been affected by the event. This is used to help power search.';
|
||||
|
||||
|
||||
--
|
||||
-- Name: COLUMN event.deleted; Type: COMMENT; Schema: public; Owner: postgres
|
||||
--
|
||||
|
||||
COMMENT ON COLUMN public.event.deleted IS 'This event has been deleted from the database, it will not be shown in search. This should get paired with a deleted_by and deleted_reason when actually implementing this.';
|
||||
|
||||
|
||||
--
|
||||
-- Name: COLUMN event.operator_id; Type: COMMENT; Schema: public; Owner: postgres
|
||||
--
|
||||
|
||||
COMMENT ON COLUMN public.event.operator_id IS 'The identity of the person who actually performed the action.';
|
||||
|
||||
|
||||
--
|
||||
-- Name: COLUMN event.operation_type; Type: COMMENT; Schema: public; Owner: postgres
|
||||
--
|
||||
|
||||
COMMENT ON COLUMN public.event.operation_type IS 'Description of what they did. Changing channel topic, banning a user, unbanning a user, etc.';
|
||||
|
||||
|
||||
--
|
||||
-- Name: COLUMN event.removed_at; Type: COMMENT; Schema: public; Owner: postgres
|
||||
--
|
||||
|
||||
COMMENT ON COLUMN public.event.removed_at IS 'Timestamp of when the event was reversed by an operator. See the removed_id and removes_id to find the event that removed this event';
|
||||
|
||||
|
||||
--
|
||||
-- Name: COLUMN event.expires_on; Type: COMMENT; Schema: public; Owner: postgres
|
||||
--
|
||||
|
||||
COMMENT ON COLUMN public.event.expires_on IS 'What time the bot believes the ban should be removed at. This gets used to eventually enforce temporary bans.';
|
||||
|
||||
|
||||
--
|
||||
-- Name: COLUMN event.redirected_to; Type: COMMENT; Schema: public; Owner: postgres
|
||||
--
|
||||
|
||||
COMMENT ON COLUMN public.event.redirected_to IS 'If there''s a forwarding ban setup, where that ban was set to go.';
|
||||
|
||||
|
||||
--
|
||||
-- Name: COLUMN event.reason; Type: COMMENT; Schema: public; Owner: postgres
|
||||
--
|
||||
|
||||
COMMENT ON COLUMN public.event.reason IS 'The reason we believe this happened for. The bot should parse this from the kick reason, or in the case of a ban, the text of the operator immediately before and after the action. May not be fully accurate, the context of the event should be inspected to fully determine this.';
|
||||
|
||||
|
||||
--
|
||||
-- Name: COLUMN event.topic_change; Type: COMMENT; Schema: public; Owner: postgres
|
||||
--
|
||||
|
||||
COMMENT ON COLUMN public.event.topic_change IS 'The new topic that was set.';
|
||||
|
||||
|
||||
--
|
||||
-- Name: COLUMN event.log_id; Type: COMMENT; Schema: public; Owner: postgres
|
||||
--
|
||||
|
||||
COMMENT ON COLUMN public.event.log_id IS 'The log of the actual event when it happened. Used to find the rest of the context when searching and rendering.';
|
||||
|
||||
|
||||
--
|
||||
-- Name: event_event_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
|
||||
--
|
||||
|
@ -207,6 +324,13 @@ CREATE TABLE public.event_renderings (
|
|||
|
||||
ALTER TABLE public.event_renderings OWNER TO postgres;
|
||||
|
||||
--
|
||||
-- Name: TABLE event_renderings; Type: COMMENT; Schema: public; Owner: postgres
|
||||
--
|
||||
|
||||
COMMENT ON TABLE public.event_renderings IS 'This is a write only rendered version of an operator event. It''s made to be served on the webpage and they are only created by access of an authorized user. Once rendered they are never removed or altered.';
|
||||
|
||||
|
||||
--
|
||||
-- Name: event_renderings_render_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
|
||||
--
|
||||
|
@ -248,6 +372,13 @@ CREATE TABLE public.identities (
|
|||
|
||||
ALTER TABLE public.identities OWNER TO postgres;
|
||||
|
||||
--
|
||||
-- Name: TABLE identities; Type: COMMENT; Schema: public; Owner: postgres
|
||||
--
|
||||
|
||||
COMMENT ON TABLE public.identities IS 'This is used for tracking who is who. This way user changing their nickname is able to be accurately identified and correctly recorded for operator events.';
|
||||
|
||||
|
||||
--
|
||||
-- Name: identities_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
|
||||
--
|
||||
|
@ -283,6 +414,13 @@ CREATE TABLE public.location (
|
|||
|
||||
ALTER TABLE public.location OWNER TO postgres;
|
||||
|
||||
--
|
||||
-- Name: TABLE location; Type: COMMENT; Schema: public; Owner: postgres
|
||||
--
|
||||
|
||||
COMMENT ON TABLE public.location IS 'Description of channels and other locations that are logged in this database.';
|
||||
|
||||
|
||||
--
|
||||
-- Name: location_location_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
|
||||
--
|
||||
|
@ -323,6 +461,41 @@ CREATE TABLE public.logs (
|
|||
|
||||
ALTER TABLE public.logs OWNER TO postgres;
|
||||
|
||||
--
|
||||
-- Name: TABLE logs; Type: COMMENT; Schema: public; Owner: postgres
|
||||
--
|
||||
|
||||
COMMENT ON TABLE public.logs IS 'This is a write only log of all IRC lines sent to the bot. locations and actors are parsed out and used for rendering events in the future.';
|
||||
|
||||
|
||||
--
|
||||
-- Name: COLUMN logs.type; Type: COMMENT; Schema: public; Owner: postgres
|
||||
--
|
||||
|
||||
COMMENT ON COLUMN public.logs.type IS 'What type of irc line we parsed this as.';
|
||||
|
||||
|
||||
--
|
||||
-- Name: COLUMN logs.raw; Type: COMMENT; Schema: public; Owner: postgres
|
||||
--
|
||||
|
||||
COMMENT ON COLUMN public.logs.raw IS 'These are the raw bytes that were sent to us by the irc server. They are encoded in whatever encoding the location is set to, or are encoded according to the IRC protocol';
|
||||
|
||||
|
||||
--
|
||||
-- Name: COLUMN logs.message; Type: COMMENT; Schema: public; Owner: postgres
|
||||
--
|
||||
|
||||
COMMENT ON COLUMN public.logs.message IS 'This is the text of the "message" that was sent. i.e. the content of the PRIVMSG, NOTICE, CTCP, etc. that was recorded. This is used to help search later as such it is the only part that is actually mutable in this table.';
|
||||
|
||||
|
||||
--
|
||||
-- Name: COLUMN logs.identity_id; Type: COMMENT; Schema: public; Owner: postgres
|
||||
--
|
||||
|
||||
COMMENT ON COLUMN public.logs.identity_id IS 'This is the id of the user who originated the message';
|
||||
|
||||
|
||||
--
|
||||
-- Name: servers; Type: TABLE; Schema: public; Owner: postgres
|
||||
--
|
||||
|
@ -338,6 +511,13 @@ CREATE TABLE public.servers (
|
|||
|
||||
ALTER TABLE public.servers OWNER TO postgres;
|
||||
|
||||
--
|
||||
-- Name: TABLE servers; Type: COMMENT; Schema: public; Owner: postgres
|
||||
--
|
||||
|
||||
COMMENT ON TABLE public.servers IS 'Description of all servers that are recorded in this database.';
|
||||
|
||||
|
||||
--
|
||||
-- Name: servers_server_id_seq; Type: SEQUENCE; Schema: public; Owner: postgres
|
||||
--
|
||||
|
|
Loading…
Add table
Reference in a new issue