Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
PhMedia Schema
<?php
$this->createTable(
"p3_media", array(
// media data
"id" => "pk",
"type" => "ENUM('file', 'directory') NOT NULL",
"nameId" => "varchar(32) NOT NULL",
"defaultTitle" => "varchar(128) NOT NULL",
"defaultDescription" => "text",
"path" => "varchar(255)",
"hash" => "varchar(64)",
"originalName" => "varchar(128)",
"mimeType" => "varchar(128)",
"size" => "int(11)",
"info" => "text"
"keywords" => "text",
"customData_json" => "text",
// CTimeStampBehavior
"createdAt" => "timestamp",
"modifiedAt" => "timestamp",
// ColorBehavior
"color" => "int(11)",
// access behavior
"accessOwner" => "varchar(64)",
"accessLanguage" => "varchar(8)",
"accessRead" => "varchar(256)",
"accessUpdate" => "varchar(256)",
"accessAppend" => "varchar(256)",
"accessDelete" => "varchar(256)",
"treeParent_id" => "int(11)",
"treePosition" => "int(11)",
// AuditBehavior
"modifiedBy" => "varchar(64)",
"createdBy" => "varchar(64)",
// ???
"status" => "int(11)",
// interval behavior --> Implement for Media Files?
"begin" => "datetime",
"end" => "datetime",
// copy behavior --> Implement for Media Files?
"guid" => "varchar(64)",
"ancestor_guid" => "varchar(64)",
"PRIMARY KEY (id)"
), $options);
if ((Yii::app()->db->schema instanceof CSqliteSchema) == false):
$this->addForeignKey('fk_p3_media_id', 'p3_media_meta', 'id', 'p3_media', 'id', null, null); // update 'null' for ON DELTE and ON UPDATE
$this->addForeignKey('fk_p3_media_meta_treeParent_id', 'p3_media_meta', 'treeParent_id', 'p3_media_meta', 'id', null, null); // update 'null' for ON DELTE and ON UPDATE
endif;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment