Answer
Deploying a new entity's generated code (its API/APV/APY files) assumes the underlying database table already exists — it doesn't create the table for you. Code generation also produces a .cre script (found under that entity's Generated Files) that creates the table and its constraints; for a proper customization, copy that script's content into your own .cdb file and deploy it, and only for quick throwaway testing would you deploy the raw .cre file directly before deploying the entity again.