protected function addValidators(Database $database)
    {

        $platform = $this->getGeneratorConfig()->getConfiguredPlatform();

        foreach ($database->getTables() as $table) {

            $set = new PropelSchemaReverse_ValidatorSet();

            foreach ($table->getColumns() as $col) {

                if ($col->isNotNull() && $this->isValidatorRequired(self::VALIDATORS_REQUIRED)) {
                    $validator = $set->getValidator($col);
                    $validator->addRule($this->getValidatorRule($col, 'required'));
                }

                if (in_array($col->getType(), array(PropelTypes::CHAR, PropelTypes::VARCHAR, PropelTypes::LONGVARCHAR)) && $col->getSize() && $this->isValidatorRequired(self::VALIDATORS_MAXLENGTH)) {
                    $validator = $set->getValidator($col);
                    $validator->addRule($this->getValidatorRule($col, 'maxLength', $col->getSize()));
                }

                if ($col->isNumericType() && $this->isValidatorRequired(self::VALIDATORS_MAXVALUE)) {
                    $this->log("WARNING: maxValue validator added for column " . $col->getName() . ". You will have to adjust the size value manually.", Project::MSG_WARN);
                    $validator = $set->getValidator($col);
                    $validator->addRule($this->getValidatorRule($col, 'maxValue', 'REPLACEME'));
                }

                if ($col->isPhpPrimitiveType() && $this->isValidatorRequired(self::VALIDATORS_TYPE)) {
                    $validator = $set->getValidator($col);
                    $validator->addRule($this->getValidatorRule($col, 'type', $col->getPhpType()));
                }
            }

            foreach ($table->getUnices() as $unique) {
                $colnames = $unique->getColumns();
                if (count($colnames) == 1) { // currently 'unique' validator only works w/ single columns.
                    $col = $table->getColumn($colnames[0]);
                    $validator = $set->getValidator($col);
                    $validator->addRule($this->getValidatorRule($col, 'unique'));
                }
            }

            foreach ($set->getValidators() as $validator) {
                $table->addValidator($validator);
            }
        } // foreach table

    }