We reverse engineer the table schema in postgres. Previously, the linker table was used for the partner and advertiser tables of the partner_advertiser table, since we were accepting many, many relationships between the partner and the advertiser. The change is made in such a way that the advertiser will have only one partner , so the partner will have a one-can relationship with the advertiser .
How can I make changes without losing previous information? Linker table data should be used to populate the display of the new schema. Here is my source code:
BEGIN FOR r IN SELECT partnerid, advertiserid from partner_advertiser LOOP NEXT r; UPDATE advertiser SET partnerid = r.partnerid WHERE id = r.advertiserid END LOOP; END
By the way, I myself did not do pg / plsql. Therefore, if there are any basic steps that I must take, please give me heads-up.
ivanceras
source share