I am setting up a Staging/PreProd environment by taking nightly backups of our Prod environment and applying them to our new PreProd environment. This part is working well. Unfortunately, we have a bunch of Replication set up in our environment. I have set up procs to remove the PreProd Replication right before the nightly Restores, and then re-create it after the Restores are complete. This works ok, but it takes a long time (3 - 4 hours) as some of the tables are quite large. I'd like to compress these large tables, but I don't want to double the work. The first step of applying the snapshot is to drop and recreate the destination table. The second step is to insert all the data. I could compress right after that, but then I'm essentially building the table twice, the first time uncompressed and then the second time with compression.
I have tested the @pre_snapshot_script parameter, but this gets applied before the step that drops and re-creates the table (the .pre and .sch files in the Snapshot folder). This will not work.
Are there any ways I can programmatically ensure the subscriber table is compressed BEFORE the snapshot data is applied to it?