if it's always going to be the same data, then you should go with a
single table, and designate media_type column...
on the other hand i see that you have a column hasThumb (or
has_thumb)... that obviously cannot apply to audio.

On Nov 7, 12:06 pm, Marcus Silva <[EMAIL PROTECTED]> wrote:
> Hi folks,
>
> I am trying to create system which will let users upload media to the
> server,  the question that I ask is weather using a single table to
> store the uploaded files is better than using separate tables to store
> each file type in terms of coding.
>
> Seems to me that if I use the multiple table I will be creating
> exactly the same data, but in a different table.
>
> Example:  audios,videos,images etc....
>
> My table structure:
>
> CREATE TABLE `uploaded_files` (
>   `id` int(11) unsigned NOT NULL auto_increment,
>   `foreign_id` int(10) unsigned NOT NULL,
>   `model` varchar(255) NOT NULL COMMENT 'Associated model name',
>   `media` varchar(55) NOT NULL,
>   `filename` varchar(255) default NULL,
>   `ext` varchar(10) default NULL,
>   `mime` varchar(55) default NULL,
>   `filesize` int(11) NOT NULL,
>   `webpath` varchar(255) NOT NULL COMMENT 'Web path to show file',
>   `full_path` text NOT NULL COMMENT 'Full path to file_src',
>   `hasThumb` tinyint(1) unsigned NOT NULL,
>   `thumbs` text,
>   `width` int(11) default NULL,
>   `height` int(11) default NULL,
>   `description` varchar(155) default NULL,
>   `created` datetime default NULL,
>   `updated` datetime default NULL,
>   PRIMARY KEY  (`id`)
> ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
>
> Basically, I am looking for an easy solution that will reduce the
> amount of code I write....
>
> Hope some of you guys can help.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to