Web forum is in read-only mode. Login as active registered customer for write access
  Forum Search   New Posts New Posts

Export to Aurelius create/update tables

 Post Reply Post Reply
Author
Araujo Carla View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 May 2014
Posts: 232
Post Options Post Options   Quote Araujo Carla Quote  Post ReplyReply Direct Link To This Post Topic: Export to Aurelius create/update tables
    Posted: 20 Jun 2014 at 7:28am
Hi,
  When exporte to Aurelius, there some new tables(create table), and there are some updated tables(alter table) in the database sheama. If i use BuildDatabase exception is raised ('...Table already exist.'). If i use UpdateDataBase the new tables are not created. How can i create tables and update tables?
 Thanks, Jofan
Back to Top
Wagner R. Landgraf View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 2566
Post Options Post Options   Quote Wagner R. Landgraf Quote  Post ReplyReply Direct Link To This Post Posted: 20 Jun 2014 at 1:12pm
BuildDatabase indeed will create all tables so if any table exists, an error will be raised.
But UpdateDatabase should work (at least, it should create new tables). Some Alter Table statements are not supported, you can check if UpdateDatabase returned any issues, checking errors and warnings generated by it, according to this topic: http://www.tmssoftware.com/business/aurelius/doc/web/index.html?schema_validation.htm
Back to Top
Araujo Carla View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 May 2014
Posts: 232
Post Options Post Options   Quote Araujo Carla Quote  Post ReplyReply Direct Link To This Post Posted: 20 Jun 2014 at 1:24pm
I Wagner, if you try export a database schema with DataModeler, and updatedatabase with aurelius, does't work, try please...
Many thanks.
Back to Top
Wagner R. Landgraf View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 2566
Post Options Post Options   Quote Wagner R. Landgraf Quote  Post ReplyReply Direct Link To This Post Posted: 20 Jun 2014 at 1:28pm
Can you provide your data modeler project with current aurelius export settings so we can test it here?
Back to Top
Araujo Carla View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 May 2014
Posts: 232
Post Options Post Options   Quote Araujo Carla Quote  Post ReplyReply Direct Link To This Post Posted: 16 Jul 2014 at 5:33am
I solve my problem, registing every Table (Class) like this:

class procedure TDBSchemaRegister.RegisterEntityClasses;
var Setup: TMappingSetup;
begin
  Setup := TMappingSetup.Create;
  try
    Setup.MappedClasses.RegisterClass(TUserX);
    TMappingExplorer.ReplaceDefaultInstance(TMappingExplorer.Create(Setup));
  finally
    Setup.Free;
  end;
end;

It's not the best way, i know, every time add a new table and export to aurelius, i have to add code :(
thanks

Back to Top
Wagner R. Landgraf View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 2566
Post Options Post Options   Quote Wagner R. Landgraf Quote  Post ReplyReply Direct Link To This Post Posted: 16 Jul 2014 at 8:25am
This is because you didn't use the classes in your application, thus the linker removes the classes from it. If you have a real application, the classes will be used from code, and you wouldn't need to register them.
Back to Top
Araujo Carla View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 May 2014
Posts: 232
Post Options Post Options   Quote Araujo Carla Quote  Post ReplyReply Direct Link To This Post Posted: 16 Jul 2014 at 8:46am
Back to Top
Araujo Carla View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 May 2014
Posts: 232
Post Options Post Options   Quote Araujo Carla Quote  Post ReplyReply Direct Link To This Post Posted: 16 Jul 2014 at 8:50am
sorry, i don't understand, how can i do that? as i said before "... If i use UpdateDataBase the new tables are not created...."
Back to Top
Wagner R. Landgraf View Drop Down
TMS Support
TMS Support
Avatar

Joined: 18 May 2010
Posts: 2566
Post Options Post Options   Quote Wagner R. Landgraf Quote  Post ReplyReply Direct Link To This Post Posted: 16 Jul 2014 at 9:16am
Suppose you have a class TCustomer declared in a unit exported by Data Modeler. If you don't use that class anywhere in your application, Delphi linker will remove it from the application. There is no way Aurelius could create a table related to the class, because the class simply doesn't exist in the .exe. You have to either remove optimization, or use the class in your application. A simple code like this will solve:

TCustomer.Create.Free;
Back to Top
Araujo Carla View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 May 2014
Posts: 232
Post Options Post Options   Quote Araujo Carla Quote  Post ReplyReply Direct Link To This Post Posted: 16 Jul 2014 at 11:36am
Ok, make sense. For me is solved.
But would be nice data modeler register the class ;).
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down