title: how to escape backslash inside of quote with mysql
body: <p>I am using Laravel migrations to create/manage all of my database scripts and I have a migration for creating a trigger.</p>
  
  <p>Here it is</p>
  
  <pre><code>DB::unprepared(
      'create trigger update_points_aft_insert
          after insert on votes
          for each row
          begin
              declare u_id integer;
              if NEW.votable_type = "App\\Comment" then
                  set u_id = (select user_id from comments where id = NEW.votable_id);
                  update users set points=points+NEW.vote where id = u_id;
              end if;
      end;'
  );
  </code></pre>
  
  <p>The problem is when I run <code>show triggers;</code> I get:</p>
  
  <pre><code>*************************** 1. row ***************************
           Trigger: update_points_aft_insert
             Event: INSERT
             Table: votes
         Statement: begin
                  declare u_id integer;
                  if NEW.votable_type = "AppComment" then
                      set u_id = (select user_id from comments where id = NEW.votable_id);
                      update users set points=points+NEW.vote where id = u_id;
                  end if;
              end
            Timing: AFTER
           Created: NULL
          sql_mode: NO_ENGINE_SUBSTITUTION
           Definer: root@localhost
  </code></pre>
  
  <p>character_set_client: utf8
  collation_connection: utf8_unicode_ci
    Database Collation: latin1_swedish_ci</p>
  
  <p>As you can see, what mysql read is <code>if NEW.votable_type = "AppComment" then</code> instead of what I want: <code>if NEW.votable_type = "App\Comment" then</code> ...
  Anyone know how I can tell mysql to read the backslash?</p>
  
  <p>EDIT: what worked was using three backslashes</p>