mtgbot/schema/main.sql
2019-01-03 15:58:32 +08:00

159 lines
4.1 KiB
SQL

--
-- PostgreSQL database dump
--
-- Dumped from database version 10.6 (Debian 10.6-1.pgdg90+1)
-- Dumped by pg_dump version 10.6 (Debian 10.6-1.pgdg90+1)
SET statement_timeout = 0;
SET lock_timeout = 0;
SET idle_in_transaction_session_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SELECT pg_catalog.set_config('search_path', '', false);
SET check_function_bodies = false;
SET client_min_messages = warning;
SET row_security = off;
ALTER TABLE IF EXISTS ONLY public.sets DROP CONSTRAINT IF EXISTS sets_pk;
ALTER TABLE IF EXISTS ONLY public.cards DROP CONSTRAINT IF EXISTS cards_pk;
DROP TABLE IF EXISTS public.version_ctrl;
DROP TABLE IF EXISTS public.sets;
DROP TABLE IF EXISTS public.cards;
DROP EXTENSION IF EXISTS "uuid-ossp";
DROP EXTENSION IF EXISTS plpgsql;
DROP SCHEMA IF EXISTS public;
--
-- Name: public; Type: SCHEMA; Schema: -; Owner: -
--
CREATE SCHEMA public;
--
-- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: -
--
COMMENT ON SCHEMA public IS 'standard public schema';
--
-- Name: plpgsql; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
--
-- Name: EXTENSION plpgsql; Type: COMMENT; Schema: -; Owner: -
--
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';
--
-- Name: uuid-ossp; Type: EXTENSION; Schema: -; Owner: -
--
CREATE EXTENSION IF NOT EXISTS "uuid-ossp" WITH SCHEMA public;
--
-- Name: EXTENSION "uuid-ossp"; Type: COMMENT; Schema: -; Owner: -
--
COMMENT ON EXTENSION "uuid-ossp" IS 'generate universally unique identifiers (UUIDs)';
SET default_tablespace = '';
SET default_with_oids = false;
--
-- Name: cards; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.cards (
id uuid DEFAULT public.uuid_generate_v4() NOT NULL,
name character varying(1024) DEFAULT ''::character varying NOT NULL,
cmc double precision DEFAULT 0 NOT NULL,
mana_cost character varying(64) DEFAULT ''::character varying NOT NULL,
text character varying(2048) DEFAULT ''::character varying NOT NULL,
layout character varying(32) DEFAULT ''::character varying NOT NULL,
image_url character varying(1024) DEFAULT ''::character varying NOT NULL,
loyalty character varying(32) DEFAULT ''::character varying NOT NULL,
type character varying(128) DEFAULT ''::character varying NOT NULL,
number character varying(32) DEFAULT ''::character varying NOT NULL,
power character varying(32) DEFAULT ''::character varying NOT NULL,
toughness character varying(32) DEFAULT ''::character varying NOT NULL,
set character varying(32) DEFAULT ''::character varying NOT NULL,
names text[] DEFAULT ARRAY[]::text[] NOT NULL,
colors text[] DEFAULT ARRAY[]::text[] NOT NULL,
color_identity text[] DEFAULT ARRAY[]::text[] NOT NULL,
types text[] DEFAULT ARRAY[]::text[] NOT NULL,
supertypes text[] DEFAULT ARRAY[]::text[] NOT NULL,
subtypes text[] DEFAULT ARRAY[]::text[] NOT NULL
);
--
-- Name: sets; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.sets (
code character varying(32) NOT NULL,
name character varying(128) NOT NULL,
release_date date
);
--
-- Name: version_ctrl; Type: TABLE; Schema: public; Owner: -
--
CREATE TABLE public.version_ctrl (
version integer DEFAULT 0 NOT NULL,
str character varying(4096) DEFAULT ''::character varying NOT NULL,
ctime timestamp with time zone DEFAULT now() NOT NULL
);
--
-- Data for Name: cards; Type: TABLE DATA; Schema: public; Owner: -
--
--
-- Data for Name: sets; Type: TABLE DATA; Schema: public; Owner: -
--
--
-- Data for Name: version_ctrl; Type: TABLE DATA; Schema: public; Owner: -
--
--
-- Name: cards cards_pk; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.cards
ADD CONSTRAINT cards_pk PRIMARY KEY (id);
--
-- Name: sets sets_pk; Type: CONSTRAINT; Schema: public; Owner: -
--
ALTER TABLE ONLY public.sets
ADD CONSTRAINT sets_pk PRIMARY KEY (code);
--
-- PostgreSQL database dump complete
--