Keys/Constraints Missing from DDL?

Posts   
 
    
psandler
User
Posts: 540
Joined: 22-Feb-2005
# Posted on: 04-Jul-2010 22:56:19   

I'm sure I'm doing something wrong, but I'm having trouble getting out of the gate with Model First.

Created a few entities and added primary keys and unique contstraints. Validation shows no errors.

When I generate the DDL, I get no primary keys, and no unique constraints in the generated code. I see these empty areas of the DDL:

-- ----------------------------------------------------------------------------------------------------------------
-- Primary Key constraints for schema 'dbo'
-- ----------------------------------------------------------------------------------------------------------------
-- ----------------------------------------------------------------------------------------------------------------
-- Unique constraints for schema 'dbo'
-- ----------------------------------------------------------------------------------------------------------------

Am I missing an obvious setting?

psandler
User
Posts: 540
Joined: 22-Feb-2005
# Posted on: 04-Jul-2010 22:58:54   

Ah, of course I figured it out five seconds after I posted.

I need to generate an update script after generating the create script.flushed

psandler
User
Posts: 540
Joined: 22-Feb-2005
# Posted on: 04-Jul-2010 23:07:26   

Ok, now I'm really confused. After generating the update script, I can no longer generate another update script (no changes, so that makes sense).

But now I generate the create script and it works like I originally expected. Should I be able to generate the create script at any time, and get the full creation of my database? Or if there are pending changes, do I need to generate a create and then an update?

It might be that I'm just not understanding the cycle of working model first.

psandler
User
Posts: 540
Joined: 22-Feb-2005
# Posted on: 04-Jul-2010 23:24:39   

Ok, an update in case anyone out there runs into the same thing.

I wasn't clicking the right validation button--I needed to click "validate and adjust relational model," which I must have done between generating the create script and the update script.

The section of the manual I was following correctly says this, so it's not a case of RTFM, it's a case of UTFM (U = "understand"). simple_smile