Skip to content

Commit

Permalink
create all
Browse files Browse the repository at this point in the history
  • Loading branch information
qinmingyuan committed Oct 21, 2024
1 parent 6698975 commit 1862a89
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/controllers/com/panel/pg_publications_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ def create
PgPublication.connection.exec_query "CREATE PUBLICATION #{pg_publication_params[:pubname]} FOR TABLE #{allow_tables.join(', ')}"
end

def create_all
PgPublication.connection.exec_query 'CREATE PUBLICATION FOR ALL TABLES'
end

def update
allow_tables = @tables & pg_publication_params[:tables].compact_blank!
PgPublication.connection.exec_query "ALTER PUBLICATION #{@pg_publication.pubname} SET TABLE #{allow_tables.join(', ')}"
Expand Down
2 changes: 2 additions & 0 deletions config/locales/zh.controller.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@ zh:
pg_publications:
index:
title: 发布者
create_all:
title: 全量复制
pg_publication_tables:
index:
title: 开通表
Expand Down
3 changes: 3 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,9 @@
end
end
resources :pg_publications do
collection do
post :create_all
end
resources :pg_publication_tables, only: [:index, :new, :create]
end
resources :pg_subscriptions do
Expand Down

0 comments on commit 1862a89

Please sign in to comment.