Solaris 11 sendmail relay config

cd /etc/mail/cf/cf

vi sendmail.mc (add SMARTHOST)

define(‘SMART_HOST’.’the smart host fqdn’)

/usr/ccs/bin/m4 ../m4/cf.m4 sendmail.mc > sendmail.cf

mv /etc/mail/sendmail.cf /etc/mail/sendmail.cf_ORIG

cp /etc/mail/cf/cf/sendmail.cf /etc/mail/sendmail.cf

svcadm restart smtp:sendmail

Mysql trigger

If you want to trigger an action to another table you can create a trigger:

CREATE TRIGGER `update_menus` AFTER INSERT ON `usuarios` FOR EACH ROW insert into sys_user_roles set sys_roles_id=(select sys_roles_id from sys_roles where roles_name=NEW.tipo),user_id=NEW.user_id

CREATE TRIGGER `update_totals_after_delete` AFTER DELETE ON `pedidos_detalle` 
FOR EACH ROW 
update pedidos set subtotal = (select sum(importe) from pedidos_detalle where folio=OLD.folio) 
where folio=OLD.folio

CREATE TRIGGER `update_totals_after_insert` AFTER INSERT ON `pedidos_detalle` 
FOR EACH ROW 
update pedidos set subtotal = (select sum(importe) from pedidos_detalle where folio=NEW.folio) 
where folio=NEW.folio

mysql generated columns (same table)

This is to add a column in a table with calculated values from the same table.

ALTER TABLE pedidos add column impuesto float generated always as (subtotal*.16) VIRTUAL;

ALTER TABLE pedidos add column total float generated always as (subtotal*1.16) VIRTUAL;

ALTER TABLE pedidos add column flete float generated always as (case when total < 6000 then 1000 else 0 end) virtual