Jump to content

space allocation for database


joebudden

Recommended Posts

You can add a column to the user table and track the amount of data that has already been uploaded and base your upload limits on that value!

If you already have data in the table you can get the size of that table or group of rows, by running TABLE STATUS and adding up the rows for each user, but remember file size is different than database space used, so you will have to figure how you will enforce your upload limit, based on real file size or database storage size.

One other note, it would be better to store the files on the file system and just use the database to store the path to the file and the rest of that files information (IE: size, type, date_upload, times_downloaded, ...)


printf
Link to comment
Share on other sites

any tips on how this can be achieved ???

here is my sql

[code]
DROP TABLE IF EXISTS artefact; 
CREATE TABLE artefact
(
  artefactId        INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
  dbEmployeeId          VARCHAR(10) NOT NULL,    -- such as 'e1' (foreign key of the owner of this artefact)
  filename    VARCHAR(255) NOT NULL,  -- such as 'asterisk.wav'. This could be the name of the file in the file store.
  type    VARCHAR(50),            -- MIME type such as audio/wav
  size   INTEGER,                -- in bytes such as 44136
  description VARCHAR(4000),          -- free text comments, use how you wish
  content  MEDIUMBLOB,            -- the actual media artefact (if the file is held in the filestore, this will be empty)
  UNIQUE employee_file_name (dbEmployeeId, filename), -- owner cannot have two files with the same name
  INDEX file_name_index (dbEmployeeId, filename),    -- speeds up retrieval of an owners files by filename
  INDEX file_type_index (dbEmployeeId, type),    -- speeds up retrieval of an owners files by filetype
  CONSTRAINT artefact_employee_FK
  FOREIGN KEY (dbEmployeeId)
    REFERENCES employee(dbEmployeeId) -- an artefact must reference the employee that 'owns' it
) ;
[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.