frappe / press

Full service cloud hosting for the Frappe stack - powers Frappe Cloud
https://frappe.cloud
GNU Affero General Public License v3.0
259 stars 187 forks source link

feat: migrate secret key from customized to normal field #2116

Closed tanmoysrt closed 1 month ago

tanmoysrt commented 1 month ago

Steps for migration -

  1. As per docs, removing field shouldn't drop the column from db. Also, in dev environment it also doesn't. But for safety, take backup of secret_key field to secret_key_backup column to prevent any mishap.

    Use bench mariadb to run this SQL code.

    ALTER TABLE `tabSubscription` ADD secret_key_backup varchar(140);
    SET SQL_SAFE_UPDATES = 0;
    UPDATE `tabSubscription` SET secret_key_backup=secret_key;
    SET SQL_SAFE_UPDATES = 1;
  2. ~Remove Secret Key field from Subscription doctype using Customize~ While doing, framework assumed it as standard field and wasn't allowing to remove it (maybe because it has no custom_ prefix, So skipped).
  3. Run git pull and bench migrate and bench restart --web on prod
  4. If everything looks good, drop the backup column

    ALTER TABLE `tabSubscription` DROP COLUMN secret_key_backup;