CREATE TABLE tblapad_emailtemplates (
    emailtemplateid BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT NOT NULL,
    type mediumtext NOT NULL,
    slug varchar(100) NOT NULL,
    language varchar(40) DEFAULT NULL,
    name mediumtext NOT NULL,
    subject mediumtext NOT NULL,
    message text NOT NULL,
    fromname mediumtext NOT NULL,
    fromemail varchar(100) DEFAULT NULL,
    plaintext TINYINT(1) UNSIGNED NOT NULL DEFAULT '0',
    active TINYINT(1) NOT NULL DEFAULT '0',
    `order` BIGINT UNSIGNED NOT NULL,
    is_tenant_email_config_allowed TINYINT(1) NOT NULL DEFAULT '0',
    is_tenant TINYINT(1) NOT NULL DEFAULT '0'
);

INSERT INTO tblapad_emailtemplates (`type`, `slug`, `language`, `name`, `subject`, `message`, `fromname`, `fromemail`, `plaintext`, `active`, `order`) SELECT `type`, `slug`, `language`, `name`, `subject`, `message`, `fromname`, `fromemail`, `plaintext`, `active`, `order` FROM tblemailtemplates_static WHERE slug IN ('staff-password-reseted', 'staff-forgot-password', 'plan-expiry-mail', 'lead-from-cp-club', 'send-claim-otp') AND language = 'english';

DELETE FROM tblemailtemplates WHERE slug IN ('staff-password-reseted', 'staff-forgot-password', 'plan-expiry-mail', 'lead-from-cp-club', 'send-claim-otp');

DELETE FROM tblemailtemplates_static WHERE slug IN ('staff-password-reseted', 'staff-forgot-password', 'plan-expiry-mail', 'lead-from-cp-club', 'send-claim-otp');