@@ -11,6 +11,7 @@ use std::process::{Command, Stdio};
11
11
pub ( crate ) fn install_extension (
12
12
pg_config : & PgConfig ,
13
13
is_release : bool ,
14
+ no_schema : bool ,
14
15
base_directory : Option < PathBuf > ,
15
16
additional_features : Vec < & str > ,
16
17
) -> Result < ( ) , std:: io:: Error > {
@@ -47,13 +48,17 @@ pub(crate) fn install_extension(
47
48
copy_file ( shlibpath, dest, "shared library" ) ;
48
49
}
49
50
50
- copy_sql_files (
51
- pg_config,
52
- is_release,
53
- additional_features,
54
- & extdir,
55
- & base_directory,
56
- ) ?;
51
+ if !no_schema || !get_target_sql_file ( & extdir, & base_directory) . exists ( ) {
52
+ copy_sql_files (
53
+ pg_config,
54
+ is_release,
55
+ additional_features,
56
+ & extdir,
57
+ & base_directory,
58
+ ) ?;
59
+ } else {
60
+ println ! ( "{} schema generation" , " Skipping" . bold( ) . yellow( ) ) ;
61
+ }
57
62
58
63
println ! ( "{} installing {}" , " Finished" . bold( ) . green( ) , extname) ;
59
64
Ok ( ( ) )
@@ -124,19 +129,26 @@ pub(crate) fn build_extension(major_version: u16, is_release: bool, additional_f
124
129
}
125
130
}
126
131
132
+ fn get_target_sql_file ( extdir : & PathBuf , base_directory : & PathBuf ) -> PathBuf {
133
+ let mut dest = base_directory. clone ( ) ;
134
+ dest. push ( extdir) ;
135
+
136
+ let ( _, extname) = crate :: commands:: get:: find_control_file ( ) ;
137
+ let version = get_version ( ) ;
138
+ dest. push ( format ! ( "{}--{}.sql" , extname, version) ) ;
139
+
140
+ dest
141
+ }
142
+
127
143
fn copy_sql_files (
128
144
pg_config : & PgConfig ,
129
145
is_release : bool ,
130
146
additional_features : Vec < & str > ,
131
147
extdir : & PathBuf ,
132
148
base_directory : & PathBuf ,
133
149
) -> Result < ( ) , std:: io:: Error > {
134
- let mut dest = base_directory. clone ( ) ;
135
- dest. push ( extdir) ;
136
-
150
+ let dest = get_target_sql_file ( extdir, base_directory) ;
137
151
let ( _, extname) = crate :: commands:: get:: find_control_file ( ) ;
138
- let version = get_version ( ) ;
139
- dest. push ( format ! ( "{}--{}.sql" , extname, version) ) ;
140
152
141
153
crate :: schema:: generate_schema (
142
154
pg_config,
0 commit comments