# Promote stage schema after testing

**URL:** <https://discourse.getdbt.com/t/promote-stage-schema-after-testing/1194>\
**Category:** Archive\
**Created:** [May 24, 2020, 1:38pm UTC](https://discourse.getdbt.com/t/promote-stage-schema-after-testing/1194 "2020-05-24T13:38:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![alon\_r](https://avatars.discourse-cdn.com/v4/letter/a/ecae2f/32.png) [@alon\_r](https://discourse.getdbt.com/u/alon_r)\
**Post date:** [May 24, 2020, 1:38pm UTC](https://discourse.getdbt.com/t/promote-stage-schema-after-testing/1194/1 "2020-05-24T13:38:52Z")

</div>

Hey, we using dbt and we have the following steps:  
Schemas:

- project
- project\_base
- project\_stage
- project\_stage\_base

1. dbt seed for loading CSV \> **project\_stage\_base** schema
2. dbt run for creating base tables in **project\_stage\_base** schema
3. dbt test for testing sources.
4. dbt run for creating all the models at **project\_stage** schema
5. dbt test for testing the models at **project\_stage** schema
6. dbt run\_operation to move all base tables from **project\_stage\_base** to **project\_base**
7. dbt run to generate all models at **project** schema

The idea is to run all steps in the ‘stage’ schema, test it, and if test passed to deploy it to the main project schema.  
For base schema, all the models are tables and its easy to move them (copy) but for the main schema most of the models are views.  
The view models contain references and variables and its not easy to move them with SQL operation.  
It’s important not to ‘brake’ the main schema if tests not passed.  
Is there any pattern on how to ‘deploy’ the new models using dbt?

Thanks in advance!
