Two blogs partially sharing database - can it work?
Posted: Wed Jul 23, 2008 10:51 pm
I am to manage two personal blogs (English and Polish). I installed separate copies of serendipity (using some symlinks though to avoid copying bundled liraries plugins and such) sideways, but configured both blogs to use the same Postgres database on the same account but with different prefix.
So far so good, haven't tested much but it seems everything is all right. I have tables like en_access, en_authorgroups, en_authors, ... and tables like pl_access, pl_authorgroups, pl_authors, ...
Now the crazy idea: maybe I could sync some of those tables somehow? For example to have authors, groups, plugins, images in sync?
Possibilities:
a) create some triggers to pass updates between tables
(seems uneasy)
b) drop some of those tables replacing them with views (for example drop en_authors and create view en_authors as select * from pl_authors).
(it would mean that some operations would fail on the 'en' blog as views can't be updated)
c) create fully-blown table aliases using postgres rule system (with some effort it should be possible using postgres specific rule system)
(this looks most promising)
d) hack around postgresql schemas and search path (to use the same prefix in both bases but partially different schemas, like common tables in public, blog specific in dedicated schemas)
(also promising but require hacking SET SEARCH_PATH somewhere into serendipity)
Leaving apart the method: if we consider such table sharing possible, which tables would it make sense to share and which should stay blog specific? The purpose is to have separate blogs with separate content, but share authorization/passwords/access rules/active plugins and such.
What do you think about the idea as such?
PS I am not sure whether I am to try sth like that, just wanted to hear comments....
So far so good, haven't tested much but it seems everything is all right. I have tables like en_access, en_authorgroups, en_authors, ... and tables like pl_access, pl_authorgroups, pl_authors, ...
Now the crazy idea: maybe I could sync some of those tables somehow? For example to have authors, groups, plugins, images in sync?
Possibilities:
a) create some triggers to pass updates between tables
(seems uneasy)
b) drop some of those tables replacing them with views (for example drop en_authors and create view en_authors as select * from pl_authors).
(it would mean that some operations would fail on the 'en' blog as views can't be updated)
c) create fully-blown table aliases using postgres rule system (with some effort it should be possible using postgres specific rule system)
(this looks most promising)
d) hack around postgresql schemas and search path (to use the same prefix in both bases but partially different schemas, like common tables in public, blog specific in dedicated schemas)
(also promising but require hacking SET SEARCH_PATH somewhere into serendipity)
Leaving apart the method: if we consider such table sharing possible, which tables would it make sense to share and which should stay blog specific? The purpose is to have separate blogs with separate content, but share authorization/passwords/access rules/active plugins and such.
What do you think about the idea as such?
PS I am not sure whether I am to try sth like that, just wanted to hear comments....