mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
REFACTOR: Restoring of backups and migration of uploads to S3
This commit is contained in:
BIN
spec/fixtures/backups/backup_since_v1.6.tar.gz
vendored
Normal file
BIN
spec/fixtures/backups/backup_since_v1.6.tar.gz
vendored
Normal file
Binary file not shown.
BIN
spec/fixtures/backups/backup_till_v1.5.tar.gz
vendored
Normal file
BIN
spec/fixtures/backups/backup_till_v1.5.tar.gz
vendored
Normal file
Binary file not shown.
BIN
spec/fixtures/backups/sql_only_backup.sql.gz
vendored
Normal file
BIN
spec/fixtures/backups/sql_only_backup.sql.gz
vendored
Normal file
Binary file not shown.
17
spec/fixtures/db/post_migrate/drop_column/20990309014014_drop_post_columns.rb
vendored
Normal file
17
spec/fixtures/db/post_migrate/drop_column/20990309014014_drop_post_columns.rb
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class DropPostColumns < ActiveRecord::Migration[5.2]
|
||||
DROPPED_COLUMNS ||= {
|
||||
posts: %i{via_email raw_email}
|
||||
}
|
||||
|
||||
def up
|
||||
remove_column :posts, :via_email
|
||||
remove_column :posts, :raw_email
|
||||
raise ActiveRecord::Rollback
|
||||
end
|
||||
|
||||
def down
|
||||
raise "not tested"
|
||||
end
|
||||
end
|
||||
@@ -1,6 +1,8 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class DropEmailLogsTable < ActiveRecord::Migration[5.2]
|
||||
DROPPED_TABLES ||= %i{email_logs}
|
||||
|
||||
def up
|
||||
drop_table :email_logs
|
||||
raise ActiveRecord::Rollback
|
||||
|
||||
10
spec/fixtures/db/restore/error.sql
vendored
Normal file
10
spec/fixtures/db/restore/error.sql
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
--
|
||||
-- PostgreSQL database dump
|
||||
--
|
||||
|
||||
-- Dumped from database version 10.11 (Debian 10.11-1.pgdg100+1)
|
||||
-- Dumped by pg_dump version 10.11 (Debian 10.11-1.pgdg100+1)
|
||||
|
||||
-- Started on 2019-12-28 00:24:29 UTC
|
||||
|
||||
SET foo = 0;
|
||||
31
spec/fixtures/db/restore/postgresql_10.11.sql
vendored
Normal file
31
spec/fixtures/db/restore/postgresql_10.11.sql
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
--
|
||||
-- PostgreSQL database dump
|
||||
--
|
||||
|
||||
-- Dumped from database version 10.11 (Debian 10.11-1.pgdg100+1)
|
||||
-- Dumped by pg_dump version 10.11 (Debian 10.11-1.pgdg100+1)
|
||||
|
||||
-- Started on 2019-12-28 00:24:29 UTC
|
||||
|
||||
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;
|
||||
|
||||
SET default_tablespace = '';
|
||||
|
||||
SET default_with_oids = false;
|
||||
|
||||
--
|
||||
-- TOC entry 198 (class 1259 OID 16573)
|
||||
-- Name: foo; Type: TABLE; Schema: public; Owner: -
|
||||
|
||||
CREATE TABLE public.foo (
|
||||
id integer NOT NULL
|
||||
);
|
||||
49
spec/fixtures/db/restore/postgresql_11.6.sql
vendored
Normal file
49
spec/fixtures/db/restore/postgresql_11.6.sql
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
--
|
||||
-- PostgreSQL database dump
|
||||
--
|
||||
|
||||
-- Dumped from database version 11.6 (Debian 11.6-1.pgdg90+1)
|
||||
-- Dumped by pg_dump version 11.6 (Debian 11.6-1.pgdg90+1)
|
||||
|
||||
-- Started on 2019-12-28 00:38:51 UTC
|
||||
|
||||
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;
|
||||
|
||||
--
|
||||
-- TOC entry 5 (class 2615 OID 2200)
|
||||
-- Name: public; Type: SCHEMA; Schema: -; Owner: -
|
||||
--
|
||||
|
||||
CREATE SCHEMA public;
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 4782 (class 0 OID 0)
|
||||
-- Dependencies: 5
|
||||
-- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: -
|
||||
--
|
||||
|
||||
COMMENT ON SCHEMA public IS 'standard public schema';
|
||||
|
||||
|
||||
SET default_tablespace = '';
|
||||
|
||||
SET default_with_oids = false;
|
||||
|
||||
--
|
||||
-- TOC entry 198 (class 1259 OID 16585)
|
||||
-- Name: foo; Type: TABLE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE TABLE public.foo (
|
||||
id integer NOT NULL
|
||||
);
|
||||
49
spec/fixtures/db/restore/postgresql_12.1.sql
vendored
Normal file
49
spec/fixtures/db/restore/postgresql_12.1.sql
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
--
|
||||
-- PostgreSQL database dump
|
||||
--
|
||||
|
||||
-- Dumped from database version 12.1 (Debian 12.1-1.pgdg100+1)
|
||||
-- Dumped by pg_dump version 12.1 (Debian 12.1-1.pgdg100+1)
|
||||
|
||||
-- Started on 2019-12-28 00:35:48 UTC
|
||||
|
||||
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;
|
||||
|
||||
--
|
||||
-- TOC entry 5 (class 2615 OID 2200)
|
||||
-- Name: public; Type: SCHEMA; Schema: -; Owner: -
|
||||
--
|
||||
|
||||
CREATE SCHEMA public;
|
||||
|
||||
|
||||
--
|
||||
-- TOC entry 4825 (class 0 OID 0)
|
||||
-- Dependencies: 5
|
||||
-- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: -
|
||||
--
|
||||
|
||||
COMMENT ON SCHEMA public IS 'standard public schema';
|
||||
|
||||
|
||||
SET default_tablespace = '';
|
||||
|
||||
SET default_table_access_method = heap;
|
||||
|
||||
--
|
||||
-- TOC entry 204 (class 1259 OID 16587)
|
||||
-- Name: foo; Type: TABLE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE TABLE public.foo (
|
||||
id integer NOT NULL
|
||||
);
|
||||
29
spec/fixtures/db/restore/postgresql_9.3.11.sql
vendored
Normal file
29
spec/fixtures/db/restore/postgresql_9.3.11.sql
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
--
|
||||
-- PostgreSQL database dump
|
||||
--
|
||||
|
||||
-- Dumped from database version 9.3.11
|
||||
-- Dumped by pg_dump version 9.3.11
|
||||
-- Started on 2019-12-27 20:54:40 UTC
|
||||
|
||||
SET statement_timeout = 0;
|
||||
SET lock_timeout = 0;
|
||||
SET client_encoding = 'UTF8';
|
||||
SET standard_conforming_strings = on;
|
||||
SET check_function_bodies = false;
|
||||
SET client_min_messages = warning;
|
||||
|
||||
DROP SCHEMA IF EXISTS restore CASCADE; CREATE SCHEMA restore; SET search_path = restore, public, pg_catalog;
|
||||
|
||||
SET default_tablespace = '';
|
||||
|
||||
SET default_with_oids = false;
|
||||
|
||||
--
|
||||
-- TOC entry 274 (class 1259 OID 18691)
|
||||
-- Name: foo; Type: TABLE; Schema: public; Owner: -; Tablespace:
|
||||
--
|
||||
|
||||
CREATE TABLE foo (
|
||||
id integer NOT NULL
|
||||
);
|
||||
31
spec/fixtures/db/restore/postgresql_9.5.10.sql
vendored
Normal file
31
spec/fixtures/db/restore/postgresql_9.5.10.sql
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
--
|
||||
-- PostgreSQL database dump
|
||||
--
|
||||
|
||||
-- Dumped from database version 9.5.10
|
||||
-- Dumped by pg_dump version 9.5.19
|
||||
|
||||
-- Started on 2019-12-27 16:08:01 UTC
|
||||
|
||||
SET statement_timeout = 0;
|
||||
SET lock_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;
|
||||
|
||||
SET default_tablespace = '';
|
||||
|
||||
SET default_with_oids = false;
|
||||
|
||||
--
|
||||
-- TOC entry 285 (class 1259 OID 18706)
|
||||
-- Name: foo; Type: TABLE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE TABLE public.foo (
|
||||
id integer NOT NULL
|
||||
);
|
||||
31
spec/fixtures/db/restore/postgresql_9.5.5.sql
vendored
Normal file
31
spec/fixtures/db/restore/postgresql_9.5.5.sql
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
--
|
||||
-- PostgreSQL database dump
|
||||
--
|
||||
|
||||
-- Dumped from database version 9.5.5
|
||||
-- Dumped by pg_dump version 9.5.5
|
||||
|
||||
-- Started on 2019-11-07 16:41:33 UTC
|
||||
|
||||
SET statement_timeout = 0;
|
||||
SET lock_timeout = 0;
|
||||
SET client_encoding = 'UTF8';
|
||||
SET standard_conforming_strings = on;
|
||||
SET check_function_bodies = false;
|
||||
SET client_min_messages = warning;
|
||||
SET row_security = off;
|
||||
|
||||
SET search_path = public, pg_catalog;
|
||||
|
||||
SET default_tablespace = '';
|
||||
|
||||
SET default_with_oids = false;
|
||||
|
||||
--
|
||||
-- TOC entry 284 (class 1259 OID 18697)
|
||||
-- Name: foo; Type: TABLE; Schema: public; Owner: -
|
||||
--
|
||||
|
||||
CREATE TABLE foo (
|
||||
id integer NOT NULL
|
||||
);
|
||||
Reference in New Issue
Block a user