Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- ## GET time to query data
- move_time=`date --date="18 months ago" "+%Y-%m-%d %T"`
- echo ${move_time}
- ## COPY data mail_message
- echo "Copy data mail_message"
- psql wms_local -c \
- "\copy (SELECT id,subject,date,body,parent_id,model,res_id,record_name,message_type,subtype_id,mail_activity_type_id,email_from,author_id,no_auto_thread,message_id,reply_to,mail_server_id,create_uid,create_date,write_uid,write_date$
- psql archived_wms -c "\copy mail_message(id,subject,date,body,parent_id,model,res_id,record_name,message_type,subtype_id,mail_activity_type_id,email_from,author_id,no_auto_thread,message_id,reply_to,mail_server_id,create_uid,create$
- echo "\nRemoving data mail_message"
- psql wms_local -c "DELETE FROM mail_message WHERE create_date <= '${move_time}'"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement