Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2010
    Posts
    2

    Question Unanswered: Inserting a File into a table

    I am fairly new to database design so correct me if the entire way I am wanting to do this is flawed.
    I am working on a very specific cms for meeting managment. The main table consists looks like this:


    Code:
    CREATE TABLE `meetings` (
    `ID` int(6) unsigned NOT NULL auto_increment COMMENT 'The unique ID of the meeting',
    `date` date NOT NULL COMMENT 'The date of the meeting',
    `agenda` text NOT NULL COMMENT 'The meeting agenda',
    PRIMARY KEY (`ID`)
    );
    I am also needing to upload minutes for each meeting but I cannot figure out which way would be best.

    Code:
    CREATE TABLE `meetings` (
    `ID` int(6) unsigned NOT NULL auto_increment COMMENT 'The unique ID of the meeting',
    `date` date NOT NULL COMMENT 'The date of the meeting',
    `agenda` text NOT NULL COMMENT 'The meeting agenda',
    `open_minutes` MEDIUMBLOB NULL COMMENT 'The open meeting minutes'
    PRIMARY KEY (`ID`)
    );
    or use the first table and have a second table

    Code:
    CREATE TABLE `open_minutes` (
    `ID` int(6) unsigned NOT NULL auto_increment COMMENT 'The unique ID',
    `date` date NOT NULL COMMENT 'The date of the meeting',
    `open_minutes` MEDIUMBLOB NULL COMMENT 'The open meeting minutes',
    PRIMARY KEY (`ID`)
    FOREIGN KEY (`date`) REFERENCE meetings(date)
    );

  2. #2
    Join Date
    Feb 2010
    Posts
    2
    I've been doing some more research and I'm not sure if this is at all what I want to do now. Is it safer/faster/better to upload the file to the server and just store the location in the database?
    In the end I am wanting to have certain files be protected from users that are not authenticated and that is more important than any other requirement.
    Thanks!

  3. #3
    Join Date
    Mar 2004
    Posts
    480
    Do you need to search the minutes themselves? If not then store them in your protected data directory and only the path to them in the database itself.

    you can use a VIEW to show off all non-secure documents for those that should see them and still have full access for those users who need to see all documents. You might want a column to indicate secure/non-secure items and base the VIEW on that column.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •