1

Server 'a' has a postgres database 'sourcedb' with a table 'products'. I am creating a delivery system in laravel on a different server 'b' with its own database 'destinationdb' using mysql (MariaDb).
Once a day I need to update the products table on server 'b' with the latest product table from server 'a'. My idea is to just replace the products table on server 'b' with the products table on server 'a'.
I have researched many stackoverflow and other contributions to this question but not found a workable solution. I have tried

DB::statement("create table destinationdb.products like sourcedb.products")
DB::statement("insert destinationdb.products select * from sourcedb.products") 

Since I am new to laravel I am struggling with the syntax especially with 'sourcedb' and 'destinationdb'.

2
  • Mate, you can not expect that we (as community) will code this for you. You need to make at least "draft", do some coding and come here ask specific detailed question. BTW: In case your databases are on same machine you can create shell script and cron it. If you have troubles with syntax seek "cheatsheets" - like this one summerblue.github.io/laravel5-cheatsheet/# Commented Oct 8, 2016 at 20:03
  • @Kyslik - I understand. Any help is appreciated. Code fragments or any explanations are very welcome. My databases are on different machines. Thanks for the cheatsheet! (I deleted my wish for a complete code sample. I understand this is not right to ask for.) Commented Oct 8, 2016 at 22:19

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.