is there any simple way to define another database for a specific DataObject? I know that I can use DB::connect() to create a connection to the other database and this is what I will be doing if I don't find a feature in SilverStripe itself that would do this for me. But then I have to create all the database queries myself - which is not too much of work in this case - but it's certainly more work than what it would be to use the ORM. And I also need to write a table creation query manually.
Thanks for your support! :)
Background: I'm going to implement a feature that allows registered users to upload their own attachments and I don't want them to appear in the assets folder due to security reasons (other members are NOT allowed to be able to see attachments uploaded by others), so storing them in the database makes sense. Also this way I don't have to worry about duplicate filenames in the system. Setting up another database for this is just for keeping the main database light weighted - easier to transfer data between production and development. The databases can reside on the same server and even use the same MySQL user to avoid the hassle with different passwords.
Damned, this forum made me to lose the long answer that I just wrote :(. This has happened to me many times in the past and now it stroke again! Write a message so long that your session expires, click the Post button and then: BOOM! The only thing you can see is an error message telling that you are not logged in anymore. Tell goodbye to your long string of typed letters and watch them fade away. :(
Thanks for your suggestion, martimiz. Now that my answer is buried deep in the graveyard of cyberspace , I will just say shortly that I did develop this feature using secureassets but then I just wanted to switch to use a database for this. It makes certain things more simple, such as data encryption (which I even managed to do with secureassets + encrypt-at-rest + own code, but there were other reasons too to start using a database for this). All the reasons are in the post I just wrote and which can be found at... nowhere! :D
And sorry, no pun intended when I complain about the behaviour of this forum. It's a great forum with just this one inconvenience! :)