CakeDC/tags — Issue #28: Non UUID Primary Key Schema
Author: joncutrer
Created: 2012-02-19 17:59:08+00:00
State: open

I have used the plugin in the past with a CakePHP 1.3 project. I wanted to use the new 2.0 branch on a (CakePHP 2.1) project but I did not want to use the included schema with UUID Primary Keys.

I've created an alternative Schema file with Integer based primary keys that can be used in place of the included schema. I have done limited testing using Int keys and wanted to ask if this might work with the plugin.

```php

array('type' => 'integer', 'null' => false, 'default' => NULL, 'length' => 10, 'key' => 'primary'),
'foreign_key' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'length' => 10),
'tag_id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'length' => 10),
'model' => array('type' => 'string', 'null' => false, 'default' => NULL, 'key' => 'index'),
'language' => array('type' => 'string', 'null' => true, 'default' => NULL, 'length' => 6, 'key' => 'index'),
'times_tagged' => array('type' => 'integer', 'null' => false, 'default' => '1'),
'created' => array('type' => 'datetime', 'null' => true, 'default' => NULL),
'modified' => array('type' => 'datetime', 'null' => true, 'default' => NULL),
'indexes' => array(
'PRIMARY' => array('column' => 'id', 'unique' => 1),
'UNIQUE_TAGGING' => array('column' => array('model', 'foreign_key', 'tag_id', 'language'), 'unique' => 1),
'INDEX_TAGGED' => array('column' => 'model', 'unique' => 0),
'INDEX_LANGUAGE' => array('column' => 'language', 'unique' => 0)
)
);

/**
* Schema for tags table
*
* @var array
* @access public
*/
public $tags = array(
'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'length' => 10, 'key' => 'primary'),
'identifier' => array('type' => 'string', 'null' => true, 'default' => NULL, 'length' => 30, 'key' => 'index'),
'name' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 30),
'keyname' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 30),
'weight' => array('type' => 'integer', 'null' => false, 'default' => 0, 'length' => 2),
'created' => array('type' => 'datetime', 'null' => true, 'default' => NULL),
'modified' => array('type' => 'datetime', 'null' => true, 'default' => NULL),
'indexes' => array(
'PRIMARY' => array('column' => 'id', 'unique' => 1),
'UNIQUE_TAG' => array('column' => array('identifier', 'keyname'), 'unique' => 1)
)
);

}
?>