If you create an ER diagram and want to add all the tables from the diagram to the module automatically, you can do it with a query below.
insert into dbo.tables_modules(table_id, module_id)
select erd_tab.table_id, erd_tab.module_id
from dbo.erd_nodes erd_tab
inner join dbo.modules m
on erd_tab.module_id = m.module_id
inner join dbo.databases d
on m.database_id = d.database_id
left outer join dbo.tables_modules mod_tab
on erd_tab.table_id = mod_tab.table_id
and erd_tab.module_id = mod_tab.module_id
where mod_tab.table_id is null
-- remove clause below if you want to apply
-- this rule for all modules
and m.title = 'Module title'
-- remove clause below if you want to apply
-- this rule for all documentations in a repository
and d.title = 'Documentation title'
Parameters
- documentation title - If you want to perform execute rule for specific documentation within repository provide its title in place of 'Documentation title'. If you want to execute it for entire repository remove this line,
- module title - If you want to perform execute rule for specific module within documentation provide its title in place of 'Module title'. If you don't want to limit query for specific module remove this line.