【发布时间】:2020-07-03 20:05:20
【问题描述】:
conf 属性值:
flyway.defaultSchema= discussions
flyway.schemas= discussions
迁移如下:
+-----------+---------+------------------------------+--------+---------------------+---------+
| Category | Version | Description | Type | Installed On | State |
+-----------+---------+------------------------------+--------+---------------------+---------+
| | | << Flyway Schema Creation >> | SCHEMA | 2020-03-23 15:55:38 | Success |
| Versioned | 1 | INITIAL SETUP | SQL | 2020-03-23 15:55:38 | Success |
| Versioned | 2 | R INITIAL SETUP | SQL | | Pending |
| Versioned | 3 | R1 INITIAL SETUP | SQL | | Pending |
| Versioned | 4 | CREATE TABLE TEMPLATE | SQL | | Pending |
初始设置将创建表空间
create tablespace tablespace_dts location 'E:\Tablespace\tablespace_dts';
create tablespace tablespace_mtd location 'E:\Tablespace\tablespace_mtd';
create tablespace tablespace_ind location 'E:\Tablespace\tablespace_ind';
create tablespace tablespace_out location 'E:\Tablespace\tablespace_out';
create tablespace tablespace_temp location 'E:\Tablespace\tablespace_temp';
v2 将执行以下操作
begin
for c in select 1 where not exists (select 1 from pg_user where usename = 'app_user' ) loop
raise notice 'in app_user';
execute ' create user app_user with password ''adept''';
end loop;
for c in select 1 where exists (select 1 from pg_tablespace,pg_user where spcname = 'tablespace_dts' and usename = 'app_user') loop
raise notice 'in grant create on tablespace_dts to app_user';
execute 'grant create on tablespace tablespace_dts to app_user with grant option';
end loop;
for c in select 1 where exists (select 1 from pg_tablespace,pg_user where spcname = 'tablespace_mtd' and usename = 'app_user') loop
raise notice 'in grant create on tablespace_mtd to app_user';
execute 'grant create on tablespace tablespace_mtd to app_user with grant option';
end loop;
for c in select 1 where exists (select 1 from pg_tablespace,pg_user where spcname = 'tablespace_ind' and usename = 'app_user') loop
raise notice 'in grant create on tablespace_ind to app_user';
execute 'grant create on tablespace tablespace_ind to app_user with grant option';
end loop;
for c in select 1 where exists (select 1 from pg_tablespace,pg_user where spcname = 'tablespace_out' and usename = 'app_user') loop
raise notice 'in grant create on tablespace_out to app_user';
execute 'grant create on tablespace tablespace_out to app_user with grant option';
end loop;
for c in select 1 where exists (select 1 from pg_tablespace,pg_user where spcname = 'tablespace_temp' and usename = 'app_user') loop
raise notice 'in grant create on tablespace_temp to app_user';
execute 'grant create on tablespace tablespace_temp to app_user with grant option';
end loop;
请注意,这里授予作品
v3 将执行以下操作:
grant usage on schema discussions to app_user;
grant select on all tables in schema discussions to app_user;
grant update on all tables in schema discussions to app_user;
grant insert on all tables in schema discussions to app_user;
grant create on schema discussions to app_user with grant option;
v4 创建表让我们说 webhook_certificate
因此,当我尝试在架构讨论中从 app_user 查询表 webhook_certificate 时。 它说,权限被拒绝,尽管我在 v3 中授予了权限。
如果手动执行相同的 v3,它可以工作并允许访问 Discussions.webhook_certificate。 请注意:v3 被标记为成功,在 flyway 迁移期间没有失败。 那为什么赠款不起作用。
请帮忙。
【问题讨论】:
标签: postgresql flyway migrate