You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

435 lines
9.8KB

  1. SET statement_timeout = 0;
  2. SET lock_timeout = 0;
  3. SET idle_in_transaction_session_timeout = 0;
  4. SET client_encoding = 'UTF8';
  5. SET standard_conforming_strings = on;
  6. SELECT pg_catalog.set_config('search_path', '', false);
  7. SET check_function_bodies = false;
  8. SET xmloption = content;
  9. SET client_min_messages = warning;
  10. SET row_security = off;
  11. --
  12. -- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: -
  13. --
  14. CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
  15. --
  16. -- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: -
  17. --
  18. COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
  19. --
  20. -- Name: bot_stats_id_seq; Type: SEQUENCE; Schema: public; Owner: -
  21. --
  22. CREATE SEQUENCE public.bot_stats_id_seq
  23. START WITH 1
  24. INCREMENT BY 1
  25. NO MINVALUE
  26. NO MAXVALUE
  27. CACHE 1;
  28. SET default_tablespace = '';
  29. SET default_with_oids = false;
  30. --
  31. -- Name: bot_stats; Type: TABLE; Schema: public; Owner: -
  32. --
  33. CREATE TABLE public.bot_stats (
  34. id integer DEFAULT nextval('public.bot_stats_id_seq'::regclass) NOT NULL,
  35. messages integer DEFAULT 0 NOT NULL,
  36. joined_members integer DEFAULT 0 NOT NULL,
  37. removed_members integer DEFAULT 0 NOT NULL,
  38. joined_servers integer DEFAULT 0 NOT NULL,
  39. removed_servers integer DEFAULT 0 NOT NULL,
  40. presence_update integer DEFAULT 0 NOT NULL,
  41. created_at date NOT NULL
  42. );
  43. --
  44. -- Name: config_id_seq; Type: SEQUENCE; Schema: public; Owner: -
  45. --
  46. CREATE SEQUENCE public.config_id_seq
  47. START WITH 1
  48. INCREMENT BY 1
  49. NO MINVALUE
  50. MAXVALUE 2147483647
  51. CACHE 1;
  52. --
  53. -- Name: config; Type: TABLE; Schema: public; Owner: -
  54. --
  55. CREATE TABLE public.config (
  56. id integer DEFAULT nextval('public.config_id_seq'::regclass) NOT NULL,
  57. server_id bigint NOT NULL,
  58. rules text,
  59. collect_stats boolean DEFAULT false NOT NULL,
  60. remove_invites boolean DEFAULT false,
  61. mention_inviters boolean DEFAULT true,
  62. allow_channels text,
  63. auto_welcome_msg text,
  64. auto_leave_msg text,
  65. auto_channel bigint,
  66. auto_role bigint,
  67. log_events boolean DEFAULT false NOT NULL,
  68. log_events_type integer DEFAULT '-1'::integer NOT NULL,
  69. members_count_channel_id bigint
  70. );
  71. --
  72. -- Name: hashtaged_messages_id_seq; Type: SEQUENCE; Schema: public; Owner: -
  73. --
  74. CREATE SEQUENCE public.hashtaged_messages_id_seq
  75. START WITH 1
  76. INCREMENT BY 1
  77. NO MINVALUE
  78. NO MAXVALUE
  79. CACHE 1;
  80. --
  81. -- Name: hashtags_id_seq; Type: SEQUENCE; Schema: public; Owner: -
  82. --
  83. CREATE SEQUENCE public.hashtags_id_seq
  84. START WITH 1
  85. INCREMENT BY 1
  86. NO MINVALUE
  87. NO MAXVALUE
  88. CACHE 1;
  89. --
  90. -- Name: logging; Type: TABLE; Schema: public; Owner: -
  91. --
  92. CREATE TABLE public.logging (
  93. id bigint NOT NULL,
  94. event_type character varying NOT NULL,
  95. discord_message_id bigint,
  96. discord_user_id bigint,
  97. discord_channel_id bigint,
  98. discord_server_id bigint,
  99. discord_username character varying,
  100. discord_channel_name character varying,
  101. discord_server_name character varying,
  102. is_user_bot boolean DEFAULT false,
  103. is_channel_nsfw boolean DEFAULT false,
  104. msg text,
  105. created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP
  106. );
  107. --
  108. -- Name: logging_id_seq; Type: SEQUENCE; Schema: public; Owner: -
  109. --
  110. CREATE SEQUENCE public.logging_id_seq
  111. START WITH 1
  112. INCREMENT BY 1
  113. NO MINVALUE
  114. NO MAXVALUE
  115. CACHE 1;
  116. --
  117. -- Name: logging_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
  118. --
  119. ALTER SEQUENCE public.logging_id_seq OWNED BY public.logging.id;
  120. --
  121. -- Name: message_types; Type: TABLE; Schema: public; Owner: -
  122. --
  123. CREATE UNLOGGED TABLE public.message_types (
  124. message_type integer NOT NULL,
  125. translation character varying
  126. );
  127. --
  128. -- Name: migrations; Type: TABLE; Schema: public; Owner: -
  129. --
  130. CREATE TABLE public.migrations (
  131. id integer NOT NULL,
  132. name character varying(255) NOT NULL,
  133. run_on timestamp without time zone NOT NULL
  134. );
  135. --
  136. -- Name: migrations_id_seq; Type: SEQUENCE; Schema: public; Owner: -
  137. --
  138. CREATE SEQUENCE public.migrations_id_seq
  139. AS integer
  140. START WITH 1
  141. INCREMENT BY 1
  142. NO MINVALUE
  143. NO MAXVALUE
  144. CACHE 1;
  145. --
  146. -- Name: migrations_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
  147. --
  148. ALTER SEQUENCE public.migrations_id_seq OWNED BY public.migrations.id;
  149. --
  150. -- Name: scheduled_messages; Type: TABLE; Schema: public; Owner: -
  151. --
  152. CREATE TABLE public.scheduled_messages (
  153. id integer NOT NULL,
  154. guild_id bigint NOT NULL,
  155. send_in_channel_id bigint NOT NULL,
  156. cron_spec character varying NOT NULL,
  157. message_to_send text NOT NULL,
  158. enabled_ boolean DEFAULT true,
  159. next_trigger timestamp without time zone DEFAULT CURRENT_TIMESTAMP
  160. );
  161. --
  162. -- Name: scheduled_messages_id_seq; Type: SEQUENCE; Schema: public; Owner: -
  163. --
  164. CREATE SEQUENCE public.scheduled_messages_id_seq
  165. AS integer
  166. START WITH 1
  167. INCREMENT BY 1
  168. NO MINVALUE
  169. NO MAXVALUE
  170. CACHE 1;
  171. --
  172. -- Name: scheduled_messages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
  173. --
  174. ALTER SEQUENCE public.scheduled_messages_id_seq OWNED BY public.scheduled_messages.id;
  175. --
  176. -- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
  177. --
  178. CREATE TABLE public.schema_migrations (
  179. version character varying(255) NOT NULL
  180. );
  181. --
  182. -- Name: server_stats_id_seq; Type: SEQUENCE; Schema: public; Owner: -
  183. --
  184. CREATE SEQUENCE public.server_stats_id_seq
  185. START WITH 1
  186. INCREMENT BY 1
  187. NO MINVALUE
  188. NO MAXVALUE
  189. CACHE 1;
  190. --
  191. -- Name: server_stats; Type: TABLE; Schema: public; Owner: -
  192. --
  193. CREATE TABLE public.server_stats (
  194. id integer DEFAULT nextval('public.server_stats_id_seq'::regclass) NOT NULL,
  195. server_id bigint NOT NULL,
  196. messages_sent integer DEFAULT 0 NOT NULL,
  197. joined_members integer DEFAULT 0 NOT NULL,
  198. left_members integer DEFAULT 0 NOT NULL,
  199. members_count integer DEFAULT 0 NOT NULL,
  200. stats_date date NOT NULL
  201. );
  202. --
  203. -- Name: temporary_roles; Type: TABLE; Schema: public; Owner: -
  204. --
  205. CREATE TABLE public.temporary_roles (
  206. id integer NOT NULL,
  207. granted_role_id bigint NOT NULL,
  208. granted_to_member_id bigint NOT NULL,
  209. granted_on_server_id bigint NOT NULL,
  210. assigned_until timestamp without time zone NOT NULL
  211. );
  212. --
  213. -- Name: temporary_roles_id_seq; Type: SEQUENCE; Schema: public; Owner: -
  214. --
  215. CREATE SEQUENCE public.temporary_roles_id_seq
  216. AS integer
  217. START WITH 1
  218. INCREMENT BY 1
  219. NO MINVALUE
  220. NO MAXVALUE
  221. CACHE 1;
  222. --
  223. -- Name: temporary_roles_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
  224. --
  225. ALTER SEQUENCE public.temporary_roles_id_seq OWNED BY public.temporary_roles.id;
  226. --
  227. -- Name: logging id; Type: DEFAULT; Schema: public; Owner: -
  228. --
  229. ALTER TABLE ONLY public.logging ALTER COLUMN id SET DEFAULT nextval('public.logging_id_seq'::regclass);
  230. --
  231. -- Name: migrations id; Type: DEFAULT; Schema: public; Owner: -
  232. --
  233. ALTER TABLE ONLY public.migrations ALTER COLUMN id SET DEFAULT nextval('public.migrations_id_seq'::regclass);
  234. --
  235. -- Name: scheduled_messages id; Type: DEFAULT; Schema: public; Owner: -
  236. --
  237. ALTER TABLE ONLY public.scheduled_messages ALTER COLUMN id SET DEFAULT nextval('public.scheduled_messages_id_seq'::regclass);
  238. --
  239. -- Name: temporary_roles id; Type: DEFAULT; Schema: public; Owner: -
  240. --
  241. ALTER TABLE ONLY public.temporary_roles ALTER COLUMN id SET DEFAULT nextval('public.temporary_roles_id_seq'::regclass);
  242. --
  243. -- Name: bot_stats bot_stats_pkey; Type: CONSTRAINT; Schema: public; Owner: -
  244. --
  245. ALTER TABLE ONLY public.bot_stats
  246. ADD CONSTRAINT bot_stats_pkey PRIMARY KEY (id);
  247. --
  248. -- Name: config config_id; Type: CONSTRAINT; Schema: public; Owner: -
  249. --
  250. ALTER TABLE ONLY public.config
  251. ADD CONSTRAINT config_id PRIMARY KEY (id);
  252. --
  253. -- Name: config config_server_id; Type: CONSTRAINT; Schema: public; Owner: -
  254. --
  255. ALTER TABLE ONLY public.config
  256. ADD CONSTRAINT config_server_id UNIQUE (server_id);
  257. --
  258. -- Name: migrations migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
  259. --
  260. ALTER TABLE ONLY public.migrations
  261. ADD CONSTRAINT migrations_pkey PRIMARY KEY (id);
  262. --
  263. -- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
  264. --
  265. ALTER TABLE ONLY public.schema_migrations
  266. ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version);
  267. --
  268. -- Name: bot_stats uniq_stats_date; Type: CONSTRAINT; Schema: public; Owner: -
  269. --
  270. ALTER TABLE ONLY public.bot_stats
  271. ADD CONSTRAINT uniq_stats_date UNIQUE (created_at);
  272. --
  273. -- Name: server_stats uniq_stats_server_id_stats_date; Type: CONSTRAINT; Schema: public; Owner: -
  274. --
  275. ALTER TABLE ONLY public.server_stats
  276. ADD CONSTRAINT uniq_stats_server_id_stats_date UNIQUE (server_id, stats_date);
  277. --
  278. -- Name: logging_discord_message_id_idx; Type: INDEX; Schema: public; Owner: -
  279. --
  280. CREATE INDEX logging_discord_message_id_idx ON public.logging USING btree (discord_message_id);
  281. --
  282. -- Name: scheduled_messages_enabled__idx; Type: INDEX; Schema: public; Owner: -
  283. --
  284. CREATE INDEX scheduled_messages_enabled__idx ON public.scheduled_messages USING btree (enabled_);
  285. --
  286. -- Name: scheduled_messages_guild_id_idx; Type: INDEX; Schema: public; Owner: -
  287. --
  288. CREATE INDEX scheduled_messages_guild_id_idx ON public.scheduled_messages USING btree (guild_id);
  289. --
  290. -- Name: scheduled_messages_next_trigger_idx; Type: INDEX; Schema: public; Owner: -
  291. --
  292. CREATE INDEX scheduled_messages_next_trigger_idx ON public.scheduled_messages USING btree (next_trigger);
  293. --
  294. -- Name: temporary_roles_granted_role_id_granted_to_member_id_grante_idx; Type: INDEX; Schema: public; Owner: -
  295. --
  296. CREATE INDEX temporary_roles_granted_role_id_granted_to_member_id_grante_idx ON public.temporary_roles USING btree (granted_role_id, granted_to_member_id, granted_on_server_id, assigned_until);
  297. --
  298. -- PostgreSQL database dump complete
  299. --
  300. --
  301. -- Dbmate schema migrations
  302. --
  303. INSERT INTO public.schema_migrations (version) VALUES
  304. ('20190514185144'),
  305. ('20190514185729'),
  306. ('20190530163611'),
  307. ('20190531190905'),
  308. ('20190620195223');