Note that there are some explanatory texts on larger screens.

plurals
  1. PODatabase Design & File Storage Servers
    primarykey
    data
    text
    <p>I'm building a web application with possibility to upload some static data and need some advices.</p> <p>On the begining, I'd like to use internal disk however if data will grow I plan to use Amazon S3 as file storage, I presume that I'll need multiple file storage containers - maybe I'll use some other CDN providers.</p> <p>Also, I have following database structure:</p> <pre><code>CREATE TABLE IF NOT EXISTS `storage_servers` ( `id` INT NOT NULL AUTO_INCREMENT , `name` VARCHAR(45) NOT NULL , `ip` INT(20) NOT NULL , `access_url` LONGTEXT NULL DEFAULT NULL , // storing server access URL `username` LONGTEXT NULL DEFAULT NULL , //storing server username `password` LONGTEXT NULL DEFAULT NULL , // storing server password `token` LONGTEXT NULL DEFAULT NULL , // storing server access token, if any PRIMARY KEY (`id`) ) ENGINE = InnoDB;' CREATE TABLE IF NOT EXISTS .`storage_servers_files` ( `server_id` INT NOT NULL , `file_id` BIGINT(25) NOT NULL , INDEX `fk_servers_files_1` (`file_id` ASC) , INDEX `fk_servers_files_2` (`server_id` ASC) , CONSTRAINT `fk_servers_files_1` FOREIGN KEY (`file_id` ) REFERENCES `files` (`id` ) ON DELETE CASCADE ON UPDATE NO ACTION, CONSTRAINT `fk_servers_files_2` FOREIGN KEY (`server_id` ) REFERENCES `storage_servers` (`id` ) ON DELETE CASCADE ON UPDATE NO ACTION) ENGINE = InnoDB; </code></pre> <p>However I'm not user if my approach is fair in this matter.</p> <p>As far I know, I'd need to create subdomains for every separate storage container (cdn1.example.com, cdn2.example.com ... cdn15.example.com). How would you design tables for that?</p> <p>My other thought was to remove <code>storage_servers</code> and <code>storage_servers_files</code> tables completely and just... create a field <code>server</code> in <code>files</code> table and then store subdomain name. Configuration then should be stored in the configuration file.</p> <p>Isn't it overengineered a bit?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload