mirror of
https://github.com/djrobstep/migra.git
synced 2024-09-11 13:56:05 +03:00
Add support for materialized views
This commit is contained in:
parent
205bb3bced
commit
28bc5e8ef5
@ -180,10 +180,12 @@ class Changes(object):
|
||||
elif name == "views_and_functions":
|
||||
av = self.i_from.views.items()
|
||||
bv = self.i_target.views.items()
|
||||
am = self.i_from.materialized_views.items()
|
||||
bm = self.i_target.materialized_views.items()
|
||||
af = self.i_from.functions.items()
|
||||
bf = self.i_target.functions.items()
|
||||
avf = list(av) + list(af)
|
||||
bvf = list(bv) + list(bf)
|
||||
avf = list(av) + list(am) + list(af)
|
||||
bvf = list(bv) + list(bm) + list(bf)
|
||||
avf = od(sorted(avf))
|
||||
bvf = od(sorted(bvf))
|
||||
return partial(
|
||||
|
@ -44,6 +44,8 @@ create index on products(price);
|
||||
|
||||
create view vvv as select * from products;
|
||||
|
||||
create materialized view matvvv as select * from products;
|
||||
|
||||
grant select, insert on table products to postgres;
|
||||
|
||||
create or replace function public.changed(i integer, t text[])
|
||||
|
@ -68,6 +68,8 @@ LANGUAGE PLPGSQL STABLE returns null on null input security invoker;
|
||||
|
||||
create view vvv as select 2;
|
||||
|
||||
create materialized view matvvv as select 2;
|
||||
|
||||
CREATE TABLE bug (
|
||||
id serial,
|
||||
description text,
|
||||
|
@ -38,6 +38,8 @@ drop index if exists "public"."products_x_key";
|
||||
|
||||
drop function if exists "public"."changed"(i integer, t text[]) cascade;
|
||||
|
||||
drop materialized view if exists "public"."matvvv" cascade;
|
||||
|
||||
drop view if exists "public"."vvv" cascade;
|
||||
|
||||
drop table "public"."aunwanted";
|
||||
@ -130,6 +132,9 @@ $$
|
||||
$$
|
||||
language PLPGSQL VOLATILE RETURNS NULL ON NULL INPUT SECURITY DEFINER;
|
||||
|
||||
create materialized view "public"."matvvv" as SELECT 2;
|
||||
|
||||
|
||||
create view "public"."vvv" as SELECT 2;
|
||||
|
||||
|
||||
|
@ -38,6 +38,8 @@ drop index if exists "public"."products_x_key";
|
||||
|
||||
drop function if exists "public"."changed"(i integer, t text[]) cascade;
|
||||
|
||||
drop materialized view if exists "public"."matvvv" cascade;
|
||||
|
||||
drop view if exists "public"."vvv" cascade;
|
||||
|
||||
drop table "public"."aunwanted";
|
||||
@ -126,6 +128,9 @@ $$
|
||||
$$
|
||||
language PLPGSQL VOLATILE RETURNS NULL ON NULL INPUT SECURITY DEFINER;
|
||||
|
||||
create materialized view "public"."matvvv" as SELECT 2;
|
||||
|
||||
|
||||
create view "public"."vvv" as SELECT 2;
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user