@@ -1200,6 +1200,15 @@ def _do_reset_datasets(
1200
1200
# Check if the dataset is spatial, and if so, if the WC has any necessary spatial extension installed.
1201
1201
self ._check_for_unsupported_ds_types (sess , target_datasets )
1202
1202
1203
+ import os
1204
+
1205
+ if os .environ .get ("NO_DROP_AND_RECREATE" , None ):
1206
+ # Don't drop and recreate any tables - try and treat them as updates instead.
1207
+ drop_and_recreate = ds_inserts & ds_deletes
1208
+ ds_updates = ds_updates | drop_and_recreate
1209
+ ds_inserts = ds_inserts - drop_and_recreate
1210
+ ds_deletes = ds_deletes - drop_and_recreate
1211
+
1203
1212
# Delete old tables
1204
1213
if ds_deletes :
1205
1214
self .drop_tables (target_commit , * [base_datasets [d ] for d in ds_deletes ])
@@ -1246,14 +1255,22 @@ def _update_table(
1246
1255
"""
1247
1256
feature_filter = ds_filter .get ("feature" , ds_filter .child_type ())
1248
1257
1249
- self ._apply_meta_diff (
1250
- sess , base_ds , ~ self .diff_dataset_to_working_copy_meta (base_ds )
1251
- )
1258
+ import os
1259
+
1260
+ if os .environ .get ("NO_APPLY_SCHEMA_CHANGES" , None ):
1261
+ pass
1262
+ else :
1263
+ self ._apply_meta_diff (
1264
+ sess , base_ds , ~ self .diff_dataset_to_working_copy_meta (base_ds )
1265
+ )
1252
1266
# WC now has base_ds structure and so we can write base_ds features to WC.
1253
1267
self ._reset_dirty_rows (sess , base_ds , feature_filter )
1254
1268
1255
1269
if target_ds != base_ds :
1256
- self ._apply_meta_diff (sess , target_ds , base_ds .diff_meta (target_ds ))
1270
+ if os .environ .get ("NO_APPLY_SCHEMA_CHANGES" , None ):
1271
+ pass
1272
+ else :
1273
+ self ._apply_meta_diff (sess , target_ds , base_ds .diff_meta (target_ds ))
1257
1274
# WC now has target_ds structure and so we can write target_ds features to WC.
1258
1275
self ._apply_feature_diff (
1259
1276
sess , base_ds , target_ds , feature_filter , track_changes_as_dirty
0 commit comments