ariga / atlas

Manage your database schema as code
https://atlasgo.io
Apache License 2.0
5.61k stars 248 forks source link

Allow --include or --only flag #2247

Open arroadie opened 9 months ago

arroadie commented 9 months ago

while the --exclude flag is very useful, it would be awesome to be able to do the inverse and use an --include or --only, that would allow the input of a word/regex and limit the tables that would be inspected by the process. Alternatively, it would be awesome to have the option to separate schemas for each table in separate files in a folder with the database name, which could be inspected in separate without having to dig through the whole database file. This would follow the model that terraform uses, where you can apply logic to your base recipe that will define what is the branching for the apply action.

dcaputo-harmoni commented 3 months ago

We would find the --include flag helpful as well, for the exact same reason - to use with the terraform provider. We dynamically provision tenant environments in terraform that share the same mysql server - with new schemas added for each tenant. We need the ability to only migrate the desired schema. And because it does not exist in the initial terraform pass, it can't be included in the mysql url, which potentially would have worked as an alternative approach. In the latter case, the plan step fails when it can't find the target schema.