Skip to content

Postgres clone schema utility without need of going outside of database. Makes developers life easy by running single function to clone schema with all objects. It is very handy on Postgres RDS. Utility is sponsored by http://elephas.io/

License

Notifications You must be signed in to change notification settings

gabrimonfa/pg-clone-schema

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 

Repository files navigation

pg-clone-schema

Handles following objects:

  • Tables - structure (indexes and keys) and optionally, data
  • Views
  • Materialized Views - Structure and data
  • Sequences
  • Functions/Procedures
  • Types (composite and enum)
  • Collations and Domains
  • Triggers
  • Permissions/GRANTs


Arguments:

  • source schema
  • target schema
  • clone with data
  • only generate DDL

You can call function like this to copy schema with data:

select clone_schema('development', 'development_clone', true, false);


Alternatively, if you want to copy only schema without data:

select clone_schema('development', 'development_clone', false, false);


If you just want to generate the DDL, call it like this:

select clone_schema('development', 'development_clone', false, true);

In this case, standard output with "INFO" lines are the generated DDL.


Sponsor: http://elephas.io/

About

Postgres clone schema utility without need of going outside of database. Makes developers life easy by running single function to clone schema with all objects. It is very handy on Postgres RDS. Utility is sponsored by http://elephas.io/

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PLpgSQL 100.0%