25 lines
820 B
Ruby
25 lines
820 B
Ruby
class CreateAdCampaigns < ActiveRecord::Migration[4.2]
|
|
|
|
def self.up
|
|
execute( <<-SQL
|
|
CREATE TABLE public.ad_campaigns (
|
|
id character varying(64) DEFAULT public.uuid_generate_v4() NOT NULL,
|
|
campaign character varying(256),
|
|
medium character varying(128),
|
|
spend integer default 0,
|
|
end_date date,
|
|
cac NUMERIC (8,2),
|
|
referred integer,
|
|
created_at timestamp without time zone DEFAULT now() NOT NULL,
|
|
expired_at timestamp without time zone);
|
|
SQL
|
|
)
|
|
execute("CREATE INDEX index_ad_campaigns_campaign_medium ON public.ad_campaigns USING btree (campaign, medium);")
|
|
end
|
|
|
|
def self.down
|
|
execute("DROP INDEX index_ad_campaigns_campaign_medium")
|
|
execute("DROP TABLE public.ad_campaigns")
|
|
end
|
|
end
|