one table is shared between several websites
Posted
by
sami
on Stack Overflow
See other posts from Stack Overflow
or by sami
Published on 2010-12-25T19:48:12Z
Indexed on
2010/12/25
19:54 UTC
Read the original article
Hit count: 284
I have a static table that's shared by several websites. By static, I mean that the data is read but never updated by the websites. Currently, all websites are served from the same server but that may change.
I want to minimize the need for creating/maintaining this table for each of the websites, so I thought about turning it to an xml file that's stored in a shared library that all websites have access to. The problem is I use an ORM and use forign key constraints to ensure integrity of the ids used from that table, so by removing that table out of the MySQL database into an XML file, will this affect the integrity of the ids coming from that table?
My table looks like this
<table name="entry">
<column name="id" type="INTEGER" primaryKey="true" autoIncrement="true" />
<column name="title" type="VARCHAR" size="500" required="true" />
</table>
and I use it as a foreign key in other tables
<table name="refer">
<column name="id" type="INTEGER" primaryKey="true" autoIncrement="true" />
<column name="linkto" type="INTEGER"/>
<foreign-key foreignTable="entry">
<reference local="linkto" foreign="id" />
</foreign-key>
</table>
So I'm wondering if I remove that table out of the database, is there a way to retain that referential integrity?
And of course are these any other efficient ways to do the same thing? I just don't want to have to repeat that table for several websites.
© Stack Overflow or respective owner