Author: jablko
Date: Tue Oct 26 10:58:08 2010
New Revision: 8510
Log:
Slug and object should both be unique
Modified:
trunk/config/schema.yml
trunk/data/sql/lib.model.schema.sql
trunk/lib/model/map/SlugTableMap.php
Modified: trunk/config/schema.yml
==============================================================================
--- trunk/config/schema.yml Tue Oct 26 10:12:14 2010 (r8509)
+++ trunk/config/schema.yml Tue Oct 26 10:58:08 2010 (r8510)
@@ -334,8 +334,8 @@
value: longvarchar
slug:
- object_id:
- slug: { index: unique, required: true; type: varchar(255) }
+ object_id: { type: integer, index: unique, required: true, foreignTable:
object, foreignReference: id }
+ slug: { index: unique, required: true }
static_page:
id: { type: integer, required: true, primaryKey: true, foreignTable:
object, foreignReference: id, onDelete: cascade, inheritanceKey: true }
Modified: trunk/data/sql/lib.model.schema.sql
==============================================================================
--- trunk/data/sql/lib.model.schema.sql Tue Oct 26 10:12:14 2010 (r8509)
+++ trunk/data/sql/lib.model.schema.sql Tue Oct 26 10:58:08 2010 (r8510)
@@ -1181,13 +1181,13 @@
CREATE TABLE `slug`
(
- `object_id` INTEGER,
- `slug` VARCHAR(255),
+ `object_id` INTEGER NOT NULL,
+ `slug` VARCHAR(255) NOT NULL,
`id` INTEGER NOT NULL AUTO_INCREMENT,
`serial_number` INTEGER default 0 NOT NULL,
PRIMARY KEY (`id`),
- UNIQUE KEY `slug_U_1` (`slug`),
- INDEX `slug_FI_1` (`object_id`),
+ UNIQUE KEY `slug_U_1` (`object_id`),
+ UNIQUE KEY `slug_U_2` (`slug`),
CONSTRAINT `slug_FK_1`
FOREIGN KEY (`object_id`)
REFERENCES `object` (`id`)
Modified: trunk/lib/model/map/SlugTableMap.php
==============================================================================
--- trunk/lib/model/map/SlugTableMap.php Tue Oct 26 10:12:14 2010
(r8509)
+++ trunk/lib/model/map/SlugTableMap.php Tue Oct 26 10:58:08 2010
(r8510)
@@ -36,8 +36,8 @@
$this->setPackage('lib.model');
$this->setUseIdGenerator(true);
// columns
- $this->addForeignKey('OBJECT_ID', 'objectId', 'INTEGER',
'object', 'ID', false, null, null);
- $this->addColumn('SLUG', 'slug', 'VARCHAR', false, 255, null);
+ $this->addForeignKey('OBJECT_ID', 'objectId', 'INTEGER',
'object', 'ID', true, null, null);
+ $this->addColumn('SLUG', 'slug', 'VARCHAR', true, 255, null);
$this->addPrimaryKey('ID', 'id', 'INTEGER', true, null, null);
$this->addColumn('SERIAL_NUMBER', 'serialNumber', 'INTEGER',
true, null, 0);
// validators
--
You received this message because you are subscribed to the Google Groups
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/qubit-commits?hl=en.