mirror of
https://github.com/kou029w/quot.git
synced 2025-01-19 00:18:09 +00:00
120 lines
2.5 KiB
PL/PgSQL
120 lines
2.5 KiB
PL/PgSQL
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 xmloption = content;
|
|
SET client_min_messages = warning;
|
|
SET row_security = off;
|
|
|
|
--
|
|
-- Name: update_timestamp(); Type: FUNCTION; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE FUNCTION public.update_timestamp() RETURNS trigger
|
|
LANGUAGE plpgsql
|
|
AS $$
|
|
BEGIN
|
|
NEW.updated = CURRENT_TIMESTAMP;
|
|
RETURN NEW;
|
|
END
|
|
$$;
|
|
|
|
|
|
SET default_tablespace = '';
|
|
|
|
SET default_table_access_method = heap;
|
|
|
|
--
|
|
-- Name: pages; Type: TABLE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE TABLE public.pages (
|
|
id integer NOT NULL,
|
|
title text NOT NULL,
|
|
text text NOT NULL,
|
|
created timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
updated timestamp with time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
|
|
);
|
|
|
|
|
|
--
|
|
-- Name: pages_id_seq; Type: SEQUENCE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE SEQUENCE public.pages_id_seq
|
|
AS integer
|
|
START WITH 1
|
|
INCREMENT BY 1
|
|
NO MINVALUE
|
|
NO MAXVALUE
|
|
CACHE 1;
|
|
|
|
|
|
--
|
|
-- Name: pages_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER SEQUENCE public.pages_id_seq OWNED BY public.pages.id;
|
|
|
|
|
|
--
|
|
-- Name: schema_migrations; Type: TABLE; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE TABLE public.schema_migrations (
|
|
version character varying(255) NOT NULL
|
|
);
|
|
|
|
|
|
--
|
|
-- Name: pages id; Type: DEFAULT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.pages ALTER COLUMN id SET DEFAULT nextval('public.pages_id_seq'::regclass);
|
|
|
|
|
|
--
|
|
-- Name: pages pages_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.pages
|
|
ADD CONSTRAINT pages_pkey PRIMARY KEY (id);
|
|
|
|
|
|
--
|
|
-- Name: pages pages_title_key; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.pages
|
|
ADD CONSTRAINT pages_title_key UNIQUE (title);
|
|
|
|
|
|
--
|
|
-- Name: schema_migrations schema_migrations_pkey; Type: CONSTRAINT; Schema: public; Owner: -
|
|
--
|
|
|
|
ALTER TABLE ONLY public.schema_migrations
|
|
ADD CONSTRAINT schema_migrations_pkey PRIMARY KEY (version);
|
|
|
|
|
|
--
|
|
-- Name: pages pages_updated; Type: TRIGGER; Schema: public; Owner: -
|
|
--
|
|
|
|
CREATE TRIGGER pages_updated BEFORE UPDATE ON public.pages FOR EACH ROW EXECUTE FUNCTION public.update_timestamp();
|
|
|
|
|
|
--
|
|
-- PostgreSQL database dump complete
|
|
--
|
|
|
|
|
|
--
|
|
-- Dbmate schema migrations
|
|
--
|
|
|
|
INSERT INTO public.schema_migrations (version) VALUES
|
|
('0');
|