Hi
I have been loading into my test system various sets of data and adjusting my model to fit my requirements.
I am now getting to a point where I want to migrate my model to my live system however I do not want any data except the lookup values and domains and maybe the users and group settings
How can I do this - would be great if there was a stored procedure that would do this.
Thanks
Previously Karl wrote:
Hi
I have been loading into my test system various sets of data and adjusting my model to fit my requirements.
I am now getting to a point where I want to migrate my model to my live system however I do not want any data except the lookup values and domains and maybe the users and group settings
How can I do this - would be great if there was a stored procedure that would do this.
Thanks
Sorted - I think - We created a Master Class 'CI' which inherits from 'Class' and all our classes inherit from this Master Class. So to remove all the data I just ran Truncate Cascade on 'CI' which truncated all the child tables at the same time.
Running the command “truncate” on the class “CI” you will properly clean both the inherited data tables and the inherited history tables.
But you must also clean the relationship tables “Map_” and the corresponding historical relationship tables.
Unfortunately you can not run the command “truncate” on the table “Map” because you do not have to truncate the relationship between system classes (for example between users and roles).
You can execute a query like this:
select relname::varchar from pg_class
LEFT JOIN pg_description pg_description1 ON pg_description1.objoid = pg_class.oid AND pg_description1.objsubid = 0
where strpos(pg_description1.description, 'TYPE: domain'::text) > 0 and pg_class.relname not in ('Map', 'Map_ActivityEmail', 'Map_UserRole')
union
select relname::varchar || '_history' from pg_class
LEFT JOIN pg_description pg_description1 ON pg_description1.objoid = pg_class.oid AND pg_description1.objsubid = 0
where strpos(pg_description1.description, 'TYPE: domain'::text) > 0 and pg_class.relname not in ('Map', 'Map_ActivityEmail', 'Map_UserRole')
order by 1
and then concatenate in a unique truncate query the resulting tablenames and the "CI" table.
Fabio