Journal Entry, December 13th to December 20th 2019

December 20, 2019 · 1 min read

Laravel

  1. Mon Dec 16

    • Reminder of JSON fields

      $table->json('source_payload');
      $table->string('order_id')->storedAs('source_payload->>"$.eCommerceOrderId"');
      $table->string('user_id')->storedAs('source_payload->>"$.eCommerceCustomerId"');
      $table->string('organization_id')->storedAs('source_payload->>"$.obrorgid"');
      
      // See https://themsaid.com/laravel-mysql-json-colum-fast-lookup-20160709/
      $table->index('order_id');
      $table->index('user_id');
      $table->index('organization_id');
      SELECT
          *, payload->>"$[0].eCommerceCustomerId" as `eCommerceCustomerId`
      FROM
          pendingOrderStatus
      WHERE
          payload->>"$[0].eCommerceCustomerId" = '16350';