forked from fordfrog/apgdiff
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial Support to PARTITION BY on Create Table
- Loading branch information
jalisson
committed
Jun 11, 2020
1 parent
a5a412b
commit 67e09cd
Showing
6 changed files
with
162 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/test/resources/cz/startnet/utils/pgdiff/add_table_partition_by_diff.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
CREATE TABLE IF NOT EXISTS "procedureresult$Operation" ( | ||
id bigint NOT NULL, | ||
name character varying(255), | ||
result_id bigint | ||
) PARTITION BY RANGE(result_id); | ||
|
||
ALTER TABLE "procedureresult$Operation" OWNER TO fordfrog; | ||
|
||
ALTER TABLE IF EXISTS "procedureresult$Operation" | ||
ADD CONSTRAINT IF NOT EXISTS $1 FOREIGN KEY (result_id) REFERENCES testtable(field1) ON UPDATE RESTRICT ON DELETE RESTRICT; |
71 changes: 71 additions & 0 deletions
71
src/test/resources/cz/startnet/utils/pgdiff/add_table_partition_by_new.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
-- | ||
-- PostgreSQL database dump | ||
-- | ||
|
||
SET client_encoding = 'UTF8'; | ||
SET check_function_bodies = false; | ||
SET client_min_messages = warning; | ||
|
||
-- | ||
-- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: postgres | ||
-- | ||
|
||
COMMENT ON SCHEMA public IS 'Standard public schema'; | ||
|
||
|
||
SET search_path = public, pg_catalog; | ||
|
||
SET default_tablespace = ''; | ||
|
||
SET default_with_oids = false; | ||
|
||
-- | ||
-- Name: testtable; Type: TABLE; Schema: public; Owner: fordfrog; Tablespace: | ||
-- | ||
|
||
CREATE TABLE testtable ( | ||
field1 integer, | ||
field2 integer, | ||
field3 character varying(150) DEFAULT 'none'::character varying, | ||
field4 double precision | ||
); | ||
|
||
|
||
ALTER TABLE public.testtable OWNER TO fordfrog; | ||
|
||
-- | ||
-- Name: procedureresult$operation; Type: TABLE; Schema: public; Owner: fordfrog; Tablespace: | ||
-- | ||
|
||
CREATE TABLE "procedureresult$Operation" ( | ||
id bigint NOT NULL, | ||
name character varying(255), | ||
result_id bigint | ||
) PARTITION BY RANGE(result_id); | ||
|
||
ALTER TABLE public."procedureresult$Operation" OWNER TO fordfrog; | ||
|
||
ALTER TABLE ONLY "procedureresult$Operation" | ||
ADD CONSTRAINT "$1" FOREIGN KEY (result_id) REFERENCES testtable(field1) ON UPDATE RESTRICT ON DELETE RESTRICT; | ||
|
||
-- | ||
-- Name: testindex; Type: INDEX; Schema: public; Owner: fordfrog; Tablespace: | ||
-- | ||
|
||
CREATE INDEX testindex ON testtable USING btree (field3); | ||
|
||
|
||
-- | ||
-- Name: public; Type: ACL; Schema: -; Owner: postgres | ||
-- | ||
|
||
REVOKE ALL ON SCHEMA public FROM PUBLIC; | ||
REVOKE ALL ON SCHEMA public FROM postgres; | ||
GRANT ALL ON SCHEMA public TO postgres; | ||
GRANT ALL ON SCHEMA public TO PUBLIC; | ||
|
||
|
||
-- | ||
-- PostgreSQL database dump complete | ||
-- | ||
|
57 changes: 57 additions & 0 deletions
57
src/test/resources/cz/startnet/utils/pgdiff/add_table_partition_by_original.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
|
||
-- | ||
-- PostgreSQL database dump | ||
-- | ||
|
||
SET client_encoding = 'UTF8'; | ||
SET check_function_bodies = false; | ||
SET client_min_messages = warning; | ||
|
||
-- | ||
-- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: postgres | ||
-- | ||
|
||
COMMENT ON SCHEMA public IS 'Standard public schema'; | ||
|
||
|
||
SET search_path = public, pg_catalog; | ||
|
||
SET default_tablespace = ''; | ||
|
||
SET default_with_oids = false; | ||
|
||
-- | ||
-- Name: testtable; Type: TABLE; Schema: public; Owner: fordfrog; Tablespace: | ||
-- | ||
|
||
CREATE TABLE testtable ( | ||
field1 integer, | ||
field2 integer, | ||
field3 character varying(150) DEFAULT 'none'::character varying, | ||
field4 double precision | ||
); | ||
|
||
|
||
ALTER TABLE public.testtable OWNER TO fordfrog; | ||
|
||
-- | ||
-- Name: testindex; Type: INDEX; Schema: public; Owner: fordfrog; Tablespace: | ||
-- | ||
|
||
CREATE INDEX testindex ON testtable USING btree (field3); | ||
|
||
|
||
-- | ||
-- Name: public; Type: ACL; Schema: -; Owner: postgres | ||
-- | ||
|
||
REVOKE ALL ON SCHEMA public FROM PUBLIC; | ||
REVOKE ALL ON SCHEMA public FROM postgres; | ||
GRANT ALL ON SCHEMA public TO postgres; | ||
GRANT ALL ON SCHEMA public TO PUBLIC; | ||
|
||
|
||
-- | ||
-- PostgreSQL database dump complete | ||
-- | ||
|