Hi there,
not sure if this goes here or under the Book discussion sub-forum. I am following the Agile Web App book, and decided to make use of the new migration features instead of relying on external SQL tools.
Creating the initial Project table was easy (once I figured out how to specify a size for a field). Further into the book, we need to create the Users, etc tables with foreign keys, constraints, etc. I have no issue creating the tables, but have no idea how to create the constraints, references, etc.
The Database Migration guide page is a good introduction. if a little thin on the full migrations capabilities and syntax. Is there a guide or page which fills in the gaps?
For those who haven’t read the book I need to turn this:
-- The Relationships
ALTER TABLE 'tbl_issue' ADD CONSTRAINT 'FK_issue_project' FOREIGN KEY
('project_id') REFERENCES 'tbl_project' ('id') ON DELETE CASCADE ON
UPDATE RESTRICT;
ALTER TABLE 'tbl_issue' ADD CONSTRAINT 'FK_issue_owner' FOREIGN KEY
('owner_id') REFERENCES 'tbl_user' ('id') ON DELETE CASCADE ON UPDATE
RESTRICT;
ALTER TABLE 'tbl_issue' ADD CONSTRAINT 'FK_issue_requester' FOREIGN
KEY ('requester_id') REFERENCES 'tbl_user' ('id') ON DELETE CASCADE ON
UPDATE RESTRICT;
ALTER TABLE 'tbl_project_user_assignment' ADD CONSTRAINT 'FK_project_
user' FOREIGN KEY ('project_id') REFERENCES 'tbl_project' ('id') ON
DELETE CASCADE ON UPDATE RESTRICT;
ALTER TABLE 'tbl_project_user_assignment' ADD CONSTRAINT 'FK_user_
project' FOREIGN KEY ('user_id') REFERENCES 'tbl_user' ('id') ON
DELETE CASCADE ON UPDATE RESTRICT;
into migration code. I am going to hack and experiment, but just need a little help getting started.
Thanks in advance.