cancel
Showing results for 
Search instead for 
Did you mean: 

Schema Upgrade from AMP

renspr
Champ in-the-making
Champ in-the-making
Hi,

I really need to add new table to the Alfresco database schema. The schema upgrade should be performed when the AMP is loaded. Following  http://wiki.alfresco.com/wiki/Schema_Upgrade_Scripts#Script_Loading I added the appropriate bean

<bean id="myUpdatePatch1" class="org.alfresco.repo.admin.patch.impl.SchemaUpgradeScriptPatch" parent="basePatch">
    <property name="id">
      <value>myUpdatePatch1</value>
    </property>
    <property name="description">
      <value>patch.schemaUpgradeScript.description</value>
    </property>
    <property name="fixesFromSchema">
      <value>0</value>
    </property>
    <property name="fixesToSchema">
      <value>116</value>
    </property>
    <property name="targetSchema">
      <value>117</value>
    </property>
    <property name="scriptUrl">
      <value>classpath:alfresco/module/myamp/dbscripts/create/2.9/${db.script.dialect}/patch1.sql</value>
    </property>
  </bean>

to module-context.xml.

I get the following problem:
16:05:14,300 User:System INFO  [admin.patch.PatchExecuter] Checking for patches to apply …
16:05:14,824 User:System INFO  [admin.patch.PatchExecuter]    Applying patch 'myUpdatePatch1' (patch.schemaUpgradeScript.description).
16:05:14,831 User:System ERROR [admin.patch.PatchExecuter] The schema upgrade script, 'classpath:alfresco/module/myamp/dbscripts/create/2.9/${db.script.dialect}/patch1.sql', has not been run against this database.

It looks like that the ${db.script.dialect} property is not correctly replaced with the current dialect. Has somebody successfully run the SchemaUpgradeScriptPatch from an AMP? Are there better solutions?

Best regards,

René
4 REPLIES 4

rdanner
Champ in-the-making
Champ in-the-making
Hi,

I really need to add new table to the Alfresco database schema. The schema upgrade should be performed when the AMP is loaded. Following  http://wiki.alfresco.com/wiki/Schema_Upgrade_Scripts#Script_Loading I added the appropriate bean

<bean id="myUpdatePatch1" class="org.alfresco.repo.admin.patch.impl.SchemaUpgradeScriptPatch" parent="basePatch">
    <property name="id">
      <value>myUpdatePatch1</value>
    </property>
    <property name="description">
      <value>patch.schemaUpgradeScript.description</value>
    </property>
    <property name="fixesFromSchema">
      <value>0</value>
    </property>
    <property name="fixesToSchema">
      <value>116</value>
    </property>
    <property name="targetSchema">
      <value>117</value>
    </property>
    <property name="scriptUrl">
      <value>classpath:alfresco/module/myamp/dbscripts/create/2.9/${db.script.dialect}/patch1.sql</value>
    </property>
  </bean>

to module-context.xml.

I get the following problem:
16:05:14,300 User:System INFO  [admin.patch.PatchExecuter] Checking for patches to apply …
16:05:14,824 User:System INFO  [admin.patch.PatchExecuter]    Applying patch 'myUpdatePatch1' (patch.schemaUpgradeScript.description).
16:05:14,831 User:System ERROR [admin.patch.PatchExecuter] The schema upgrade script, 'classpath:alfresco/module/myamp/dbscripts/create/2.9/${db.script.dialect}/patch1.sql', has not been run against this database.

It looks like that the ${db.script.dialect} property is not correctly replaced with the current dialect. Has somebody successfully run the SchemaUpgradeScriptPatch from an AMP? Are there better solutions?

Best regards,

René

Hi Rene!

Just wondering what you need to add a new table to Alfresco for?  I don't think it's impossible but you would want to have a really good reason to do it.  Can you tell us a little about it?

renspr
Champ in-the-making
Champ in-the-making
Hi.

Just wondering what you need to add a new table to Alfresco for? I don't think it's impossible but you would want to have a really good reason to do it. Can you tell us a little about it?

I'm working on a "Social Graph, Friend-Of-A-Friend" module similar to things you find in facebook.com or xing.com. At least this has to work with 20.000 users. To have full control how the database indexes and handles queries on that graph structure I think it is a good idea to have a distinct database table to store the graph. What do you think?

I can create the tables in code from the AMP using a component that will be executed once when the AMP ist loaded for the first time. But I think it's better to use the SchemaUpgradeScriptPatch. But this is not working for me until now. I think I have missed something.

Best regards,

René

rdanner
Champ in-the-making
Champ in-the-making
Hi.

Just wondering what you need to add a new table to Alfresco for? I don't think it's impossible but you would want to have a really good reason to do it. Can you tell us a little about it?

I'm working on a "Social Graph, Friend-Of-A-Friend" module similar to things you find in facebook.com or xing.com. At least this has to work with 20.000 users. To have full control how the database indexes and handles queries on that graph structure I think it is a good idea to have a distinct database table to store the graph. What do you think?

I can create the tables in code from the AMP using a component that will be executed once when the AMP ist loaded for the first time. But I think it's better to use the SchemaUpgradeScriptPatch. But this is not working for me until now. I think I have missed something
Best regards,

René

Hi Rene!

How does what you are building relate to alfresco?  It's FOF inside alfresco ?

renspr
Champ in-the-making
Champ in-the-making
Hi,

How does what you are building relate to alfresco? It's FOF inside alfresco ?

Yes. Every logged in user should be able to maintain his FOAF graph. Data structure and business logic (FOAF Service) is (should be) encapsulated within an AMP. We are building our own UI so there are no planed changes to the Alfresco Webclient.