code: private function loadConstraints(Table $table)
      {
  
          foreach ($this->getConstraints() as $constraint) {
              switch ($constraint['constraint_type']) {
                  case 'FOREIGN KEY':
                      // TODO Find a better way to define foreign key
                      $foreignKey = new ForeignKey(new Table($constraint['table_name']), new Table($constraint['column_name']));
                      $foreignKey->setColumns($constraint['references_table']);
                      $foreignKey->setReferencedColumns($constraint['references_field']);
  
                      $table->addConstraint($foreignKey);
                      break;
                  case 'PRIMARY KEY':
                      $table->addConstraint(new PrimaryKey($constraint['column_name'], $table));
                      break;
                  case 'UNIQUE':
                      $table->addConstraint(new Unique($constraint['column_name'], new Table($constraint['table_name'])));
                      break;
              }
          }
      }
docs: Load contsraints to table.
  
  @param Table $table A table.
  
  @return void