@@ -87,39 +87,36 @@ impl<G: GenericClient> PgDatabase<G> {
87
87
// PostgreSQL 15+ supports FOR ALL TABLES IN SCHEMA syntax
88
88
let create_publication_query = match schema {
89
89
Some ( schema_name) => format ! (
90
- "create publication {} for tables in schema {}" ,
91
- publication_name, schema_name
90
+ "create publication {publication_name} for tables in schema {schema_name}"
92
91
) ,
93
- None => format ! ( "create publication {} for all tables" , publication_name ) ,
92
+ None => format ! ( "create publication {publication_name } for all tables" ) ,
94
93
} ;
95
94
96
95
client. execute ( & create_publication_query, & [ ] ) . await ?;
97
96
} else {
98
97
// PostgreSQL 14 and earlier: create publication and add tables individually
99
98
match schema {
100
99
Some ( schema_name) => {
101
- let create_pub_query = format ! ( "create publication {}" , publication_name ) ;
100
+ let create_pub_query = format ! ( "create publication {publication_name}" ) ;
102
101
client. execute ( & create_pub_query, & [ ] ) . await ?;
103
102
104
103
let tables_query = format ! (
105
- "select schemaname, tablename from pg_tables where schemaname = '{}'" ,
106
- schema_name
104
+ "select schemaname, tablename from pg_tables where schemaname = '{schema_name}'"
107
105
) ;
108
106
let rows = client. query ( & tables_query, & [ ] ) . await ?;
109
107
110
108
for row in rows {
111
109
let schema: String = row. get ( 0 ) ;
112
110
let table: String = row. get ( 1 ) ;
113
111
let add_table_query = format ! (
114
- "alter publication {} add table {}.{}" ,
115
- publication_name, schema, table
112
+ "alter publication {publication_name} add table {schema}.{table}"
116
113
) ;
117
114
client. execute ( & add_table_query, & [ ] ) . await ?;
118
115
}
119
116
}
120
117
None => {
121
118
let create_publication_query =
122
- format ! ( "create publication {} for all tables" , publication_name ) ;
119
+ format ! ( "create publication {publication_name } for all tables" ) ;
123
120
client. execute ( & create_publication_query, & [ ] ) . await ?;
124
121
}
125
122
}
0 commit comments