Hi Ravi,
 
I checked and in this case, the solution proposed should work fine for
the reasons you mention.
 
In general when these kinds of updates are done there has been a pair of
LOOKUP_VALUE and LOOKUP_VALUE_LOCALE entries where the lookup id of the
row added in the LOOKUP_VALUE table is needed as a foreign key for the
entry in the LOOKUP_VALUE_LOCALE table (which is what the java based
upgrade code can handle).  In this case since there is no corresponding
LOOKUP_VALUE_LOCALE entry, AUTO_INCREMENT is all we need.
 
Cheers,
--Van

________________________________

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Ravi
Kutaphale
Sent: Friday, March 07, 2008 7:30 AM
To: Developer
Cc: Developer; [EMAIL PROTECTED]
Subject: Re: [Mifos-developer] Database upgrades using Java



Hi Van, 
In Robertos create table script, which is same as in mifos schema the
LOOKUP_ID column has an AUTO_INCREMENT attribute. 
This means that mysql will automatically increment the assigned column
value by 1 and the column value does not need to be included in the
insert statement. 
So insert statement can be 

insert into lookup_value (entity_id, lookup_name) values (100, 'name_1')


instead of 

insert into lookup_value (lookup_id, entity_id, lookup_name) values (1,
100, 'name_1') 

and for multiple inserts you can also write : 

insert into lookup_value (entity_id, lookup_name) values (100,
'name_1'), (101, 'name_2'), (200, 'new_name_1') 

Is there any reason why we explicitly specify the value for the primary
key ( lookup_id) ? 

Hope this helps. 
Thanks and regards 
*ravi 







Roberto Musso/Ireland/Contr/[EMAIL PROTECTED] 
Sent by: [EMAIL PROTECTED] 

07/03/2008 11:56 
Please respond to
Developer <[email protected]>


To
Developer <[email protected]> 
cc
"Developer" <[email protected]>,
[EMAIL PROTECTED] 
Subject
Re: [Mifos-developer] Database upgrades using Java

        




Hi Van,
indeed :
CREATE TABLE lookup_value (
 LOOKUP_ID INTEGER AUTO_INCREMENT NOT NULL,
 ENTITY_ID SMALLINT,
 LOOKUP_NAME VARCHAR(100),
 PRIMARY KEY(LOOKUP_ID),
 FOREIGN KEY(ENTITY_ID)
   REFERENCES LOOKUP_ENTITY(ENTITY_ID)
     ON DELETE NO ACTION
     ON UPDATE NO ACTION
)

So I am a litlle bit confused: why the insert does not use the feature?

Best


 

            "Van

            Mittal-Henkle"

            <[EMAIL PROTECTED]
To 
            ndation.org>              "Developer"

            Sent by:
<[EMAIL PROTECTED] 
            mifos-developer-b         net>

            [EMAIL PROTECTED]
cc 
            ceforge.net

 
Subject 
                                      [Mifos-developer] Database
upgrades 
            03/06/2008 02:00          using Java

            AM

 

 

            Please respond to

                Developer

            <mifos-developer@

            lists.sourceforge

                  .net>

 

 





Questions surrounding Java based database upgrades have come up a number
of times, so I have taken a stab at adding some initial documentation
about when to do a Java based upgrade rather than a SQL based upgrade
and what basic steps should be followed.

http://www.mifos.org/developers/technical-orientation/mifos-database-dev
elopment#how-to-properly-script

http://mifos.org/developers/wiki/HowToDoJavaBasedDatabaseUpgrades

Questions and suggestions for improvement are welcomed :-)

--Van

------------------------------------------------------------------------
-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/



------------------------------------------------------------------------
-
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

Reply via email to