Exclude objects from ReadyRoll project

meischjmeischj Posts: 3 New member
I'm building a micro-services architecture for a new project and each service have its own schema. We have a separate Visual Studio project to allow each service to be deployed independently.
I'm looking for a way to exclude all schema but one in the ReadyRoll project. I saw that we can exclude objects with ExcludeObjectsFromImport but I don't want to list all the others schemas because new services/schemas can be created at any time.

I tried to play with ReGex but it didn't find any solution yet.
Here is what I tried (I want to exclude all tables/views but not the tables/view in the "test" schema):
<ExcludeObjectsFromImport>
Table=\[^(?!(test)$).*$\]\.\[(.*?)\];
View=\[^(?!(test)$).*$\]\.\[(.*?)\];
</ExcludeObjectsFromImport>


Can you help me with that ?
Thanks
Tagged:

Comments

  • StanHStanH Posts: 2 New member
    edited July 12, 2017 8:40AM
    Hi,
    I took a look at that for you and I suggest using either:

    <ExcludeObjectsFromImport>
    Table=^(?!(\[test\])).*\[.*?\];
    View=^(?!(\[test\])).*\[.*?\];
    </ExcludeObjectsFromImport>

    or

    <ExcludeObjectsFromImport>
    Table=^(?!(\[\w*test\w*\])).*\[.*?\];
    View=^(?!(\[\w*test\w*\])).*\[.*?\];
    </ExcludeObjectsFromImport>

    The first one will exclude everything apart from [test] schema, the second one will exclude everyhing apart from schemas that contain word test in them.

    There is one thing to note: these rules will not be applied to your previous imports.

    My suggested steps would be:
    • Create new project
    • Unload the project and add exclusion rules in .sqlproj
    • Reload the project
    • Connect to database
    • Import database

    This should then import only your [test] schema. Let me know if you need any further help.

    Regards,
    Stan Hamara
    Software Engineer, ReadyRoll
    Redgate Software
  • meischjmeischj Posts: 3 New member
    It works, thank you.
Sign In or Register to comment.