Adding a New Table To Schema

For demonstration purposes, let's add a new table called 'activity'.
  1. Create the new table SQL file in $HOME/sql/. Follow the naming conventions (\d\d-...sql). Foreign keys are named '{table_name}_id'. Be sure to test your new SQL and inform other developers as needed. Ensure that there are defaults, if needed. Which columns allow NULLs? Note that a type of 'text' may not be appropriate unless you expect a very large block of text.
  2. In $HOME/lib/RetreatcenterDB/ find an existing class that is similar to your new table and copy it.
        % cd $HOME/lib/RetreatcenterDB
        % cp Glossary.pm  Activity.pm 
      
  3. Open the new file and edit it to reflect the new table design. Be sure to edit the package name as well as update the column documentation at the end of the file since gen_doc will use it to create documentation. Be sure that the file name and the package name properly match (this is a common error).

    Add any DBIC relationships, as needed. Other classes can serve as examples of 'belongs_to', 'has_many', 'many_to_many', etc.

  4. Edit $HOME/RetreatcenterDB.pm to add the name of your new class to the 'classes' list.
  5. Run ./check_doc
      cd $HOME/lib/RetreatcenterDB
      ./check_doc
      
  6. If check_doc passes, next run ./gen_doc and remember to commit all your changes.
      ./gen_doc