Creation of Data Member in the DB

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
Ekki
Posts: 34
Joined: Sun 24 Nov 2013 18:50
Location: Ilmenau, Germany
Contact:

Creation of Data Member in the DB

Post by Ekki » Tue 13 Mar 2018 13:33

Hi all,

in case of a backward-compatiblity scenario I want to add a data member/table column in case it's not there yet. Is this possible via the PostgreSQL interface?

Thx for any feedback,

Ekki

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Creation of Data Member in the DB

Post by Shalex » Thu 15 Mar 2018 14:14

You are using the LinqConnect feature and want to update the database structure basing on the changes in the *.lqml model. Is this correct? In this case, right click *.lqml in Solution Explorer > Open With > Entity Developer, then right click the diagram > Update To Database and follow the wizard steps. Does this help?

Ekki
Posts: 34
Joined: Sun 24 Nov 2013 18:50
Location: Ilmenau, Germany
Contact:

Re: Creation of Data Member in the DB

Post by Ekki » Wed 21 Mar 2018 14:44

Thx but it's a little bit different.

I'm looking for a way that my application can do this automatically. If possible I want to avoid to migrate dozens of databases manually. Rather the application should check if a certain column is already there and if not, create it.

In case this is possible, pls guide me.

Thx,

Ekki

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Creation of Data Member in the DB

Post by Shalex » Thu 22 Mar 2018 15:49

The LinqConnect engine doesn't allow to update a database structure in runtime, only context.DeleteDatabase() and context.CreateDatabase().

You can use the following approach for updating multiple databases with the same structure: run the "Update To Database" wizard of Entity Developer to get the update SQL on the "View and execute script" step (the Script tab), then you can execute this SQL via plain ADO.NET code connecting to different databases.

Ekki
Posts: 34
Joined: Sun 24 Nov 2013 18:50
Location: Ilmenau, Germany
Contact:

Re: Creation of Data Member in the DB

Post by Ekki » Mon 26 Mar 2018 10:29

Thx. Closed.

Post Reply