Switching from SQL Server to postgreSQL

Posts   
 
    
clint
User
Posts: 145
Joined: 15-Nov-2005
# Posted on: 16-Jul-2021 23:30:16   

Using LLBLGen Designer 5.6.1.

We currently have a LLBLGen project that generates a "generic" project of entity classes and a database-specific project for Microsoft SQL Server.

We want to replace our Microsoft SQL Server database with a postgreSQL database instead.

Are we able to keep our generated "generic" project, but generate a new database-specific project for postgreSQL?

What's the easiest way to accomplish this?

Thanks.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 17-Jul-2021 10:01:58   

clint wrote:

Using LLBLGen Designer 5.6.1.

We currently have a LLBLGen project that generates a "generic" project of entity classes and a database-specific project for Microsoft SQL Server.

We want to replace our Microsoft SQL Server database with a postgreSQL database instead.

Are we able to keep our generated "generic" project, but generate a new database-specific project for postgreSQL?

What's the easiest way to accomplish this? Thanks.

Load your project: If your postgresql database already exists: Right click 'relational model data' in the project explorer and select 'Add relational model data from a database' and select the postgresql driver and obtain the meta-data as you would otherwise from sqlserver. If the tables/field names match, it'll automatically map the entities to the tables from postgresql. If not you might need to adjust some rules for database first development in the project settings.

If your postgresql database doesn't exists: Right click 'relational model data' in the project explorer and select 'Add relational model data storage for a database' and select the postgresql driver. then open 'Sync' and uncheck the sync with database for the sql server model data and click Perform tasks. The designer will now create tables from the entities in teh postgresql container. You can then export a DDL SQL script to create the database in the postgresql server.

Generating code for Adapter this way will move your dbspecific project to a folder specifically for the database, so you get 2 of them, one for sqlserver and one for postgresql. You can then use both in your project and use a simple method to switch between the DataAccessAdapter classes of the two databases, as they both implement IDataAccessAdapter

It's up to you how you want to migrate your code from sql server to postgresql. You'll likely run into missing types or other issues you need to correct manually but overall it should be fairly straight forward.

Frans Bouma | Lead developer LLBLGen Pro