class AddJamTrackImportTency < ActiveRecord::Migration
  def self.up
    execute("ALTER TABLE public.jam_tracks ADD COLUMN original_artist_slug VARCHAR;")
    execute("CREATE INDEX jam_tracks_original_artist_slug_index ON public.jam_tracks USING btree (original_artist_slug);");
    execute("ALTER TABLE public.jam_tracks ADD COLUMN name_slug VARCHAR;")
    execute("CREATE INDEX jam_tracks_name_slug_index ON public.jam_tracks USING btree (name_slug);");
    execute("ALTER TABLE public.jam_tracks ADD COLUMN origin_s3_path VARCHAR UNIQUE;")
    execute("ALTER TABLE public.jam_tracks ADD COLUMN origin_s3_bucket VARCHAR;")
    execute("ALTER TABLE public.jam_tracks ADD COLUMN s3_audio_dir VARCHAR;")

    #ALTER TABLE public.jam_tracks ADD COLUMN original_artist_slug VARCHAR;
    #CREATE INDEX jam_tracks_original_artist_slug_index ON public.jam_tracks USING btree (original_artist_slug);
    #ALTER TABLE public.jam_tracks ADD COLUMN name_slug VARCHAR;
    #CREATE INDEX jam_tracks_name_slug_index ON public.jam_tracks USING btree (name_slug);
    #ALTER TABLE public.jam_tracks ADD COLUMN origin_s3_path VARCHAR UNIQUE;
    #ALTER TABLE public.jam_tracks ADD COLUMN origin_s3_bucket VARCHAR;
    #ALTER TABLE public.jam_tracks ADD COLUMN s3_audio_dir VARCHAR;

    # just for prod/staging only
    #GRANT UPDATE on jam_tracks to lambda;
    #GRANT INSERT on jam_tracks to lambda;
    #GRANT UPDATE on jam_track_tracks to lambda;
    #GRANT INSERT on jam_track_tracks to lambda;
    #GRANT UPDATE on jam_track_files to lambda;
    #GRANT INSERT on jam_track_files to lambda;
    #GRANT UPDATE on genres_jam_tracks to lambda;
    #GRANT INSERT on genres_jam_tracks to lambda;

  end

  def self.down
    execute("ALTER TABLE public.jam_tracks DROP COLUMN original_artist_slug;")
    execute("DROP INDEX jam_tracks_original_artist_slug_index;")
    execute("ALTER TABLE public.jam_tracks DROP COLUMN name_slug;")
    execute("DROP INDEX jam_tracks_name_slug_index;")
    execute("ALTER TABLE public.jam_tracks DROP COLUMN origin_s3_path;")
    execute("ALTER TABLE public.jam_tracks DROP COLUMN origin_s3_bucket;")
    execute("ALTER TABLE public.jam_tracks DROP COLUMN s3_audio_dir;")
  end
end
