File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -199,9 +199,6 @@ def handler(event, context):
199199 print ("Registering PostGIS ..." )
200200 register_extensions (cursor = cur )
201201
202- print ("Enabling context extension ..." )
203- enable_context (cursor = cur )
204-
205202 dsn = "postgresql://{user}:{password}@{host}:{port}/{dbname}" .format (
206203 dbname = user_params .get ("dbname" , "postgres" ),
207204 user = user_params ["username" ],
@@ -212,9 +209,16 @@ def handler(event, context):
212209
213210 asyncio .run (run_migration (dsn ))
214211
212+ # Enable context extension after migrating database
213+ with psycopg .connect (con_str , autocommit = True ) as conn :
214+ with conn .cursor () as cur :
215+ print ("Enabling context extension ..." )
216+ enable_context (cursor = cur )
217+
215218 except Exception as e :
216219 print (f"Unable to bootstrap database with exception={ e } " )
217220 return send (event , context , "FAILED" , {"message" : str (e )})
218221
222+
219223 print ("Complete." )
220224 return send (event , context , "SUCCESS" , {})
You can’t perform that action at this time.
0 commit comments