Simulating ENUM in PostgreSQL using CHECK expression

PostgreSQL is a very powerful database. One of the things that seems missing when moving from MySQL is the ability to simply create an enumeration. ENUM is nice when you have a programmatically-semantic set of values for a field.

In PostgreSQL, you have several choices. But one simple one is to create a Check expression, like follows. Skip the IS NULL part if you don’t want the field nullable.

ALTER TABLE 
   "public"."CallCenter_Transfer"
ADD CONSTRAINT 
   "CallCenter_Transfer_TransferStatus"
   CHECK (
      "TransferStatus" IS NULL 
       OR 
      "TransferStatus" = ANY(ARRAY['TransferComplete', 'TransferFailedNoAnswer', 'TransferFailedProspectLost'])
      )

Home School Software, Anyone?

2010-2011 was the first year that we were required by PA law to report our schooling activities to the Altoona Area School district.  (simply because our oldest turned 8)

Naturally, the topic of Log and portfolio came up needing solved.

Having been home educated as a child, I recall the massive effort it took to remain organized enough to be able to assemble a really good portfolio at the end of the year.  Also, the log book needed to be throughly kept to provide record of education activities.

Here is a brief list of items that need improved:

  1. Portfolios typically are assembled at the end of the year, which requires a lot of effort.
  2. There is only one copy of a portfolio.
  3. They are a bit kludgy, having a mix of all sorts of media (photos, papers, art, etc…)
  4. They are not searchable
  5. They are not sortable
  6. They are not printable
  7. They are not email-able
  8. They are not backup-able
  9. They typically show only the “best” work, by virtue of what they are (depends on the assembler)
  10. They are separate from the log of the actual activities
  11. Etc…

Well, after a lot of here and there, I decided we needed a database.  So my wife and I designed a database that would handle a number of aspects:

  1. Multiple Students
  2. Subjects as required by law
  3. Projects that are a part of schooling
  4. Activities and Events
  5. Dates
  6. Summaries
  7. Descriptions
  8. Scanned documents
  9. Photographs
  10. PDF files

The ultimate goal is to be able to send off for a printed book with the above content, and turn that into the school district.

I thought that a web interface would be appropriate.  So here is where I am at after a couple days of tinkering around…

 

 

 

 

 

 

If anyone expresses interest in seeing more of this, post a comment.

Thanks!