Project requirements: the dream is hacked, and it will not be able to fix the dream vulnerabilities. I decided to change to a self-developed background! The problem is that all the data in the dream articles should be taken out and imported to the new background.
Because the structure of the existing data table in the background is completely different from that of the dream-Woven table. In addition, it is used to save the article. dede_addonarticle and dede_archives are two tables. Now we want to copy the data of useful fields in two tables to one field in a new table.
Step 1: synchronize their primary keys. The primary key of dede_addonarticle is aid, and the primary key of dede_archives is ID.
1. A table with a written structure and no data (new_table) is what we want to import data to this table
2. The primary key field in the blank table is ID. Because it is blank, you must first Insert the same primary key as dede_addonarticle and dede_arives.
This step is performed in the same database. If you want to perform cross-Database Operations, I have not studied it either. (import the tables of another database to this database for processing, after export, import the data to another database)
Use SQL statements
Insert into new_table (ID) select aid from dede_addonarticle (because the primary key of dede_addonarticle is aid)
In this way, the primary key can be synchronized.
Step 2: Synchronize other data
Update new_table set new_table.seo_title = (select dede_addonarticle.seo_title from dede_addonarticle where new_table.id = dede_addonarticle.aid)
This statement is used to synchronize other data. For example, the title label content in the head label is synchronized.
Note: to copy the title field of Table A to table B, the field name of Table B is not required. It can be any field name. In the preceding example, seo_title is the same name. Do not use the correct Sn.
Step 3: export the sorted data table and re-import it to the new database. In this way, the data is copied by field.
This practice is relatively simple. Of course, it is also a problem if you have never encountered it, So record it here. If you have a better method, please leave a message to me and thank you.