from migrations.fixtures.functions.base_function import BaseFunction class CampaignDspIdFunction(BaseFunction): @staticmethod def create_or_replace(): return """ CREATE OR REPLACE FUNCTION campaign_dsp_id(text, character varying) RETURNS text LANGUAGE sql AS $function$ SELECT CASE WHEN $1 = 'PRS' THEN 'dec' ELSE $1 END || '_' || $2; $function$ """ @staticmethod def drop(): return """ DROP FUNCTION IF EXISTS campaign_dsp_id(text, character varying); """