Search code examples
mysqlsqldatabasemigrationdatabase-migration

mysql transfer old database to new database


i developed a new application but i didn't know that my client need old data when development completed he said now i need old data.

**In Old database have 5 tables**
1. Design
2. Design_comments
3. Design_personalConversation
4. Design_logs
5. Design_files (Deisgner + client Upload)

And in my new application the sturcture i sperated Payment and orderstatus and i am using

1. Design
2. Design OrderStatus
3. Design PaymentStatus
4. Design_Comments
5. Design_personalConversation
6. Design_Logs
7. Design_files (Deisgner + client Upload)
  1. In my old database tables there are some entries(PK) which are deleted.
  2. In my new database tables should i have to transfer same old database with missing entries with for loop first ftech and transfer this will.
  3. i have added Design order no to all my new tables so i can fetch data easily like i want.
  4. i have added Design order no to all my new tables so i can fetch data easily like i want.

Now my main point is that:

there are alot of Design_Comments and Design_files are deleted

Eg: 5,7,11,12 Design_1 Order Contains comments_id 6,8.10,13 and comment_id also interlink with Design_files

Like Design 1 with comment 82,82 so these ids in Design_files because my comments contains some files which upload by client or design

What should i do ?

  1. Should i transfer data table wise like 1 complete table transder to new table
  2. shoud i transfer data like design1 with data which are hosting in others table like so design1 with Design_Comments, Design_personalConversationm,Design_Logs and Design_files so 1 order transfer to new tables with only data which are interlink.

Transfer old data with same old Primary key to new tables or is there any way to full fill missing IDs should i ignore missing entries


Solution

  • its easy, create a migrate.php script transfer data table wise first get data from old table and then break data and transfer data to new table to new structure wise. you have to write more code for more tables.