It's sad that the membership thing prevents us from helping the community.
Even though I am a member, I will not use the member applications because they are closed source, I cannot see what they are doing, there is no community vulnerability vetting and if you have trouble, no one but FusionPBX will be able to support you, therefore I think it is nuts to use member applications in a production environment.
I did make a start on a domain backup script some time ago, you can see what I had pulled together here:
https://www.pbxforums.com/threads/single-domain-migration-from-server-a-to-b.3733/#post-13159
I did ask Mark for comments but did not get any feedback. I will re-visit this when I have time, it is not "rocket science" as they say! It may be that rather than using "copy (select * from..." we should create an export schema and then just create the fusion tables there with a series of "create table v_xxx as select * from..." statements.
We know most records relating to a domain have a column called domain_uuid, so we can find all the tables that contain a column with this name using the following query:
Code:
select t.table_schema,
t.table_name
from information_schema.tables t
inner join information_schema.columns c on c.table_name = t.table_name
and c.table_schema = t.table_schema
where c.column_name = 'domain_uuid'
and t.table_schema not in ('information_schema', 'pg_catalog')
and t.table_type = 'BASE TABLE'
order by t.table_schema;
Searching with a like statement (c.column_name like '%domain_uuid%') reveals one more table - v_sip_profile_domains, where the column is called sip_profile_domain_uuid.
So we find the UUID of the domain we are interested in with:
Code:
select domain_uuid from v_domains where domain_name = 'my.comain.com'
Lets assume the domain_uuid returned is '62dce067-5d27-459f-b8e0-f0fdfce45cc6'.
Then create an export schema:
Then run some create table statements (only one shown - you get the idea):
Code:
create table myexport.v_domains as (select * from public.v_domains WHERE domain_uuid = '62dce067-5d27-459f-b8e0-f0fdfce45cc6');
This should give you a set of FusionPBX tables in the myexport schema that contain data only for the domain you are interested in. You could then export or import these using the SQL tool(s) of your choice.
PS: you will also need to copy the file system files like recordings and voicemail etc.:
Code:
... /var/lib/freeswitch/recordings/my.comain.com/* to somewhere...
... /var/lib/freeswitch/storage/fax/my.comain.com/* to somewhere...
... /var/lib/freeswitch/storage/voicemail/default/my.comain.com/* to somewhere...
Hope that helps a little.