Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Add PostgreSQL support #177

Open
thinkverse opened this issue Aug 17, 2021 · 2 comments
Open

[Feature] Add PostgreSQL support #177

thinkverse opened this issue Aug 17, 2021 · 2 comments

Comments

@thinkverse
Copy link
Collaborator

thinkverse commented Aug 17, 2021

Feature request is taken from an old column in the TODO projects.

@jlpoolen
Copy link

This may be helpful in an effort to support PostgreSQL. This is the extent of my contribution, I'm switching to another paste server that support command line interfaces -- I find I'm constantly wanting to send log files to a paste server. I was intrigued with the idea of migrating from MySQL to PostgreSQL and then dumping the schema in a PostgreSQL-friendly syntax. Enjoy.

Here's a dump from PostgreSQL which had its schema imported with pgloader:

jlpoole@taurus /usr/local/src/pgloader/build/bin $ pg_dump -s paste1
--
-- PostgreSQL database dump
--

-- Dumped from database version 13.3
-- Dumped by pg_dump version 13.3

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: paste; Type: SCHEMA; Schema: -; Owner: jlpoole
--

CREATE SCHEMA paste;


ALTER SCHEMA paste OWNER TO jlpoole;

SET default_tablespace = '';

SET default_table_access_method = heap;

--
-- Name: admin; Type: TABLE; Schema: paste; Owner: jlpoole
--

CREATE TABLE paste.admin (
    id integer NOT NULL,
    "user" character varying(250),
    pass character varying(250)
);


ALTER TABLE paste.admin OWNER TO jlpoole;

--
-- Name: admin_history; Type: TABLE; Schema: paste; Owner: jlpoole
--

CREATE TABLE paste.admin_history (
    id integer NOT NULL,
    last_date character varying(255),
    ip character varying(255)
);


ALTER TABLE paste.admin_history OWNER TO jlpoole;

--
-- Name: ads; Type: TABLE; Schema: paste; Owner: jlpoole
--

CREATE TABLE paste.ads (
    id integer NOT NULL,
    text_ads text,
    ads_1 text,
    ads_2 text
);


ALTER TABLE paste.ads OWNER TO jlpoole;

--
-- Name: ban_user; Type: TABLE; Schema: paste; Owner: jlpoole
--

CREATE TABLE paste.ban_user (
    id integer NOT NULL,
    ip character varying(255),
    last_date character varying(255)
);


ALTER TABLE paste.ban_user OWNER TO jlpoole;

--
-- Name: captcha; Type: TABLE; Schema: paste; Owner: jlpoole
--

CREATE TABLE paste.captcha (
    id integer NOT NULL,
    cap_e character varying(255),
    mode character varying(255),
    mul character varying(255),
    allowed text,
    color text,
    recaptcha_sitekey text,
    recaptcha_secretkey text
);


ALTER TABLE paste.captcha OWNER TO jlpoole;

--
-- Name: interface; Type: TABLE; Schema: paste; Owner: jlpoole
--

CREATE TABLE paste.interface (
    id integer NOT NULL,
    theme text,
    lang text
);


ALTER TABLE paste.interface OWNER TO jlpoole;

--
-- Name: mail; Type: TABLE; Schema: paste; Owner: jlpoole
--

CREATE TABLE paste.mail (
    id integer NOT NULL,
    verification text,
    smtp_host text,
    smtp_username text,
    smtp_password text,
    smtp_port text,
    protocol text,
    auth text,
    socket text
);


ALTER TABLE paste.mail OWNER TO jlpoole;

--
-- Name: page_view; Type: TABLE; Schema: paste; Owner: jlpoole
--

CREATE TABLE paste.page_view (
    id integer NOT NULL,
    date character varying(255),
    tpage character varying(255),
    tvisit character varying(255)
);


ALTER TABLE paste.page_view OWNER TO jlpoole;

--
-- Name: pages; Type: TABLE; Schema: paste; Owner: jlpoole
--

CREATE TABLE paste.pages (
    id integer NOT NULL,
    last_date character varying(255),
    page_name character varying(255),
    page_title text,
    page_content text
);


ALTER TABLE paste.pages OWNER TO jlpoole;

--
-- Name: pastes; Type: TABLE; Schema: paste; Owner: jlpoole
--

CREATE TABLE paste.pastes (
    id integer NOT NULL,
    title text,
    content text,
    encrypt text,
    password text,
    now_time text,
    s_date text,
    views text,
    ip text,
    date text,
    member text,
    expiry text,
    visible text,
    code text
);


ALTER TABLE paste.pastes OWNER TO jlpoole;

--
-- Name: site_info; Type: TABLE; Schema: paste; Owner: jlpoole
--

CREATE TABLE paste.site_info (
    id integer NOT NULL,
    title character varying(255),
    des text,
    keyword text,
    site_name character varying(255),
    email character varying(255),
    twit character varying(4000),
    face character varying(4000),
    gplus character varying(4000),
    ga character varying(255),
    additional_scripts text,
    baseurl text
);


ALTER TABLE paste.site_info OWNER TO jlpoole;

--
-- Name: site_permissions; Type: TABLE; Schema: paste; Owner: jlpoole
--

CREATE TABLE paste.site_permissions (
    id integer NOT NULL,
    disableguest character varying(255),
    siteprivate character varying(255)
);


ALTER TABLE paste.site_permissions OWNER TO jlpoole;

--
-- Name: sitemap_options; Type: TABLE; Schema: paste; Owner: jlpoole
--

CREATE TABLE paste.sitemap_options (
    id integer NOT NULL,
    priority character varying(255),
    changefreq character varying(255)
);


ALTER TABLE paste.sitemap_options OWNER TO jlpoole;

--
-- Name: users; Type: TABLE; Schema: paste; Owner: jlpoole
--

CREATE TABLE paste.users (
    id integer NOT NULL,
    oauth_uid text,
    username text,
    email_id text,
    full_name text,
    platform text,
    password text,
    verified text,
    picture text,
    date text,
    ip text
);


ALTER TABLE paste.users OWNER TO jlpoole;

--
-- Name: admin idx_16621_primary; Type: CONSTRAINT; Schema: paste; Owner: jlpoole
--

ALTER TABLE ONLY paste.admin
    ADD CONSTRAINT idx_16621_primary PRIMARY KEY (id);


--
-- Name: admin_history idx_16627_primary; Type: CONSTRAINT; Schema: paste; Owner: jlpoole
--

ALTER TABLE ONLY paste.admin_history
    ADD CONSTRAINT idx_16627_primary PRIMARY KEY (id);


--
-- Name: ads idx_16633_primary; Type: CONSTRAINT; Schema: paste; Owner: jlpoole
--

ALTER TABLE ONLY paste.ads
    ADD CONSTRAINT idx_16633_primary PRIMARY KEY (id);


--
-- Name: ban_user idx_16639_primary; Type: CONSTRAINT; Schema: paste; Owner: jlpoole
--

ALTER TABLE ONLY paste.ban_user
    ADD CONSTRAINT idx_16639_primary PRIMARY KEY (id);


--
-- Name: captcha idx_16645_primary; Type: CONSTRAINT; Schema: paste; Owner: jlpoole
--

ALTER TABLE ONLY paste.captcha
    ADD CONSTRAINT idx_16645_primary PRIMARY KEY (id);


--
-- Name: interface idx_16651_primary; Type: CONSTRAINT; Schema: paste; Owner: jlpoole
--

ALTER TABLE ONLY paste.interface
    ADD CONSTRAINT idx_16651_primary PRIMARY KEY (id);


--
-- Name: mail idx_16657_primary; Type: CONSTRAINT; Schema: paste; Owner: jlpoole
--

ALTER TABLE ONLY paste.mail
    ADD CONSTRAINT idx_16657_primary PRIMARY KEY (id);


--
-- Name: page_view idx_16663_primary; Type: CONSTRAINT; Schema: paste; Owner: jlpoole
--

ALTER TABLE ONLY paste.page_view
    ADD CONSTRAINT idx_16663_primary PRIMARY KEY (id);


--
-- Name: pages idx_16669_primary; Type: CONSTRAINT; Schema: paste; Owner: jlpoole
--

ALTER TABLE ONLY paste.pages
    ADD CONSTRAINT idx_16669_primary PRIMARY KEY (id);


--
-- Name: pastes idx_16675_primary; Type: CONSTRAINT; Schema: paste; Owner: jlpoole
--

ALTER TABLE ONLY paste.pastes
    ADD CONSTRAINT idx_16675_primary PRIMARY KEY (id);


--
-- Name: site_info idx_16681_primary; Type: CONSTRAINT; Schema: paste; Owner: jlpoole
--

ALTER TABLE ONLY paste.site_info
    ADD CONSTRAINT idx_16681_primary PRIMARY KEY (id);


--
-- Name: site_permissions idx_16687_primary; Type: CONSTRAINT; Schema: paste; Owner: jlpoole
--

ALTER TABLE ONLY paste.site_permissions
    ADD CONSTRAINT idx_16687_primary PRIMARY KEY (id);


--
-- Name: sitemap_options idx_16693_primary; Type: CONSTRAINT; Schema: paste; Owner: jlpoole
--

ALTER TABLE ONLY paste.sitemap_options
    ADD CONSTRAINT idx_16693_primary PRIMARY KEY (id);


--
-- Name: users idx_16699_primary; Type: CONSTRAINT; Schema: paste; Owner: jlpoole
--

ALTER TABLE ONLY paste.users
    ADD CONSTRAINT idx_16699_primary PRIMARY KEY (id);


--
-- PostgreSQL database dump complete
--

jlpoole@taurus /usr/local/src/pgloader/build/bin $ 

@jlpoolen
Copy link

and the command lines I used:

 jlpoole@taurus /usr/local/src/pgloader/build/bin $ ./pgloader mysql://pastey:keepit@localhost/paste postgresql:///paste1

and

 jlpoole@taurus /usr/local/src/pgloader/build/bin $ pg_dump -s paste1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants