CS 549, Spring 2007
Assignment #3
(due on 16, Monday)

You may work on this assignment as a group. If anything does not work as described here, notify the instructor immediately. Do one of the following tasks.

  1. Create script drop_all_fkey_constraints_mysql.php, which drops all the foreign-key constraints in a MySQL database.

    1. You may start with script generate_fkey_constraints.php.

    2. Add
        function get_constraint_names() {
          global $db;
          // code similar to the body of function referenced_tables($table_name)
          // defined in file db_mysql.inc in ms_apps_cs440/framework_v3
          
          // return an array of constraint names
        }
      
        // execute a "drop foreign key" statement for each constraint name
        // with $db->query($sql)
      
  2. Create script drop_all_fkey_constraints_pgsql.php for a PostgreSQL database. Refer to db_pgsql.inc.

  3. Create correct foreign-key constraints for a PostgreSQL database and produce schema diagrams by using Microsoft Visio.

  4. Generate a WebGen interface for your database according to the procedure described in CS 440 Assignment #5. You may also refer to Assignments #3 and #4.

  5. Create a script that migrates the schema of a MySQL database to a PostgreSQL database. The user will first copy the dirctory containing the required library with command
      cp ~minourax/public_html/symfony/sf_zencart_pg .
    
    The migration script performs the following operations.

    1. Prepare databases.yml and propel.ini in directory config for the MySQL database. Unix utility program sed can be used for this purpose.

    2. Connect to the MySQL database and build config/shcema.yml with command
        symfony propel-build-schema
      
    3. Replace databases.yml and propel.ini with the ones for the PostgreSQL database.

    4. Generated data/sql/schma.sql for PostgreSQL with command
        symfony propel-build-sql
      
    5. File data/sql/generated-schema.sql can be executed on the PostgreSQL database.

    6. In order to migrate data, the model need be created.
      ./symfony cc
      rm lib/*
      rm lib/model/om/*
      rm lib/model/map/*
      
      cp config/databases.yml.mysql config/databases.yml
      cp config/propel.ini.mysql config/propel.ini
      ./symfony propel-build-schema
      
      mv config/schema.yml config/schema.yml.bak
      sed -e '/0001-01-01/d' < config/schema.yml.bak >config/schema.yml
      
      # The above steps are to avoid the following error
      
      # Unable to parse default value as date/time value:
      #  '0001-01-011 00:00:00'
      # Remove from schema.yml lines line containing
      #     default: 0001-01-0
      # There are three types of these lines.
      
       ./symfony propel-build-model
       ./symfony propel-build-sql
      
       ./symfony propel-dump-data frontend zencart_dump.yml
      
      # Now, work with for the PostgreSQL database
       ./symfony cc
       cp config/databases.yml.pgsql config/databases.yml
       cp config/propel.ini.pgsql config/propel.ini
       ./symfony propel-build-model
      
       ./symfony propel-load-data frontend zencart_dump.yml
      
  6. Study the mechanism for user registration and login implemented by Mantis or Zen Cart. Separate the database tables and the scripts for this purpose from the rest of the application, and make them work. Make a class presentation.

  7. Make the Trac application installed on Nagara usable.

    1. The information on the installation is available in /var/trac/README.TM:
      cd /var/trac
      
      mkdir /var/svn
      # create SVN project directory ms_apps
      svnadmin create /var/svn/ms_apps
      
      # create PostgreSQL database named trac_ms_apps
      # create user trac_ms_apps password 'xxxxx';
      # create database user trac_ms_apps;
      # grant all on database trac_ms_apps to trac_ms_apps;
      
      # creat ea new Trac environment at /var/trac/ms_apps
      trac-admin ms_apps initenv
      
      # Project Name [My Project]> ms_apps
      # Database connection string [sqlite:db/trac.db]>
      #  postgres://trac_ms_apps:CSxyz540@localhost/trac_ms_apps
      # Path to repository [/var/svn/test]> /var/svn/ms_apps
      # Templates directory [/usr/share/trac/templates]>
      
      # configure the environment by editing the file:
      #  /var/trac/ms_apps/conf/trac.ini
      
      # run the Trac standalone web server `tracd`:
      
      tracd --port 8000 /var/trac/ms_apps
      
    2. Visit http://localhost:8000/ms_apps, and add the data on the student projects.

    3. Allow tracd to be started, stopped, and restarted with command /etc/init.d/tracd ....

    4. The latest documentation can be found on the Trac project website http://projects.edgewall.com/trac/