I am creating a web application with the ability to download some static data and need some advice.
In the beginning I would like to use the internal disk, however, if the data grows, I plan to use Amazon S3 as a file storage, I believe that I will need several containers for storing files - maybe I will use some other CDN providers.
In addition, I have the following database structure:
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;
However, I am not a user if my approach is fair in this matter.
As far as I know, I need to create subdomains for each individual storage container (cdn1.example.com, cdn2.example.com ... cdn15.example.com). How could you create tables for this?
My other thought was to completely delete the storage_servers and storage_servers_files and just ... create a server field in the files table and then save the subdomain name. The configuration should then be stored in the configuration file.
Isn't that too hard?
source share