Not a bug

SQL generation for selected objects excludes references unless table is also selected

Publisher Service 3 weeks ago updated by Rafał Strzaliński (Senior Engineer) 1 week ago 2

Lets say I am adding new tables that have relationships to existing tables. When I select new tables and new relationships and use "selected only" option in SQL generation it doesn't generate foreign keys between new tables and existing tables (even though that relationship is specifically selected). The only workaround is to select existing tables as well and then remove DDL for existing tables from the script, which is cumbersome. 

Not a bug

SQL script generation tool you've trying to use is "table" oriented. It will generate script that contains table and than other related object (references, indexes). General rule is: generated script must be runable against the real empty database. If you select a reference it will generate reference and corresponding tables. 

If you want to create a script that applies changes between model versions. Please right click on the model name on documents page  and pick "Model migration" option.