Home:ALL Converter>Create re-runnable Postgresql DDL scripts

Create re-runnable Postgresql DDL scripts

Ask Time:2017-11-11T20:07:09         Author:YogeshR

Json Formatter

I want to create re-runnable DDL script for PostgreSQL database. I have done this for SQL server using SSMS. SSMS can generate DDL statements for a database with "if not exists" condition.

How can we do this for PostgreSQL? I want to generate DDL statements for one of my PostgreSQL database and want to run it on another database so that I can create all the tables on target database also. However, DDL Script should have "IF Not EXISTS" for each table so that I don't get any error if the script is run multiple times.

Is there any tool which can automatically create Such DDL Statements for a database for Postgresql?

Author:YogeshR,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/47237708/create-re-runnable-postgresql-ddl-scripts
yy