Re: Programmatically duplicating a schema

2018-03-13 Thread Adrian Klaver
On 03/12/2018 11:05 PM, matt.f...@internode.on.net wrote: Thanks Adrian, Really appreciate the suggestions. The objective when trying to solve this for the Apartment library itself is to keep it generic (works for any/all database objects - tables, views, stored procedures, 3rd party extensio

Re: Programmatically duplicating a schema

2018-03-13 Thread David G. Johnston
On Mon, Mar 12, 2018 at 11:05 PM, wrote: > The reason we'd want to infer the create statements via pg_dump is, so we > don't need to keep database migration files in sync with a 'create new > schema' SQL script. It adds risk that they get out of sync, causing > inconsistencies in new schemas cre

Re: Programmatically duplicating a schema

2018-03-13 Thread Melvin Davidson
* > What is a reliable way to programmatically & generically populate an empty schema with all the objects in the public schema as a template? The simplest way is just to load the attached clone_schema function. It was originally created by Emanuel '3manuek', which I enhanced. Itnow copies all sequ

Re: Programmatically duplicating a schema

2018-03-13 Thread Alban Hertroys
> On 13 Mar 2018, at 4:23, matt.f...@internode.on.net wrote: > > Hi all, > > What is a reliable way to programmatically & generically populate an empty > schema with all the objects in the public schema as a template? > > We are using the multi tenancy ruby gem Apartment ( > https://github.co

Re: Programmatically duplicating a schema

2018-03-12 Thread matt . figg
Thanks Adrian,   Really appreciate the suggestions.   The objective when trying to solve this for the Apartment library itself is to keep it generic (works for any/all database objects - tables, views, stored procedures, 3rd party extension objects, e

Re: Programmatically duplicating a schema

2018-03-12 Thread Adrian Klaver
On 03/12/2018 08:23 PM, matt.f...@internode.on.net wrote: Hi all, What is a reliable way to programmatically & generically populate an empty schema with all the objects in the public schema as a template? We are using the multi tenancy ruby gem Apartment ( https://github.com/influitive/apart