diff --git a/database/migrations/2015_03_01_231912_update_accepted_at_to_acceptance_id.php b/database/migrations/2015_03_01_231912_update_accepted_at_to_acceptance_id.php index 0970c536ce..42675ab6d2 100644 --- a/database/migrations/2015_03_01_231912_update_accepted_at_to_acceptance_id.php +++ b/database/migrations/2015_03_01_231912_update_accepted_at_to_acceptance_id.php @@ -18,11 +18,11 @@ class UpdateAcceptedAtToAcceptanceId extends Migration { $table->integer('accepted_id')->nullable()->default(NULL); }); - $results = DB::select('select invitation.id AS invitation_id, acceptance.id AS acceptance_id FROM asset_logs invitation INNER JOIN asset_logs acceptance ON (invitation.checkedout_to=acceptance.checkedout_to AND invitation.asset_id=acceptance.asset_id) WHERE invitation.action_type="checkout" AND acceptance.action_type="accepted"'); + $results = DB::select('select invitation.id AS invitation_id, acceptance.id AS acceptance_id FROM '.DB::getTablePrefix().'asset_logs invitation INNER JOIN '.DB::getTablePrefix().'asset_logs acceptance ON (invitation.checkedout_to=acceptance.checkedout_to AND invitation.asset_id=acceptance.asset_id) WHERE invitation.action_type="checkout" AND acceptance.action_type="accepted"'); foreach ($results as $result) { - $update = DB::update('update asset_logs set accepted_id=? where id=?', [$result->acceptance_id, $result->invitation_id]); + $update = DB::update('update '.DB::getTablePrefix().'asset_logs set accepted_id=? where id=?', [$result->acceptance_id, $result->invitation_id]); } } diff --git a/database/migrations/2015_10_23_182625_add_checkout_time_and_expected_checkout_date_to_assets.php b/database/migrations/2015_10_23_182625_add_checkout_time_and_expected_checkout_date_to_assets.php index d4032feb82..ac220f5984 100644 --- a/database/migrations/2015_10_23_182625_add_checkout_time_and_expected_checkout_date_to_assets.php +++ b/database/migrations/2015_10_23_182625_add_checkout_time_and_expected_checkout_date_to_assets.php @@ -18,8 +18,8 @@ class AddCheckoutTimeAndExpectedCheckoutDateToAssets extends Migration { $answer=$table->dateTime('last_checkout')->nullable(); $table->date('expected_checkin')->nullable(); }); - DB::statement("UPDATE assets SET last_checkout=(SELECT MAX(created_at) FROM asset_logs WHERE asset_logs.id=assets.id AND action_type='checkout') WHERE assigned_to IS NOT NULL"); - DB::statement("UPDATE assets SET expected_checkin=(SELECT expected_checkin FROM asset_logs WHERE asset_logs.id=assets.id AND action_type='checkout' ORDER BY id DESC limit 1) WHERE assigned_to IS NOT NULL"); + DB::statement("UPDATE ".DB::getTablePrefix()."assets SET last_checkout=(SELECT MAX(created_at) FROM ".DB::getTablePrefix()."asset_logs WHERE ".DB::getTablePrefix()."asset_logs.id=".DB::getTablePrefix()."assets.id AND action_type='checkout') WHERE assigned_to IS NOT NULL"); + DB::statement("UPDATE ".DB::getTablePrefix()."assets SET expected_checkin=(SELECT expected_checkin FROM ".DB::getTablePrefix()."asset_logs WHERE ".DB::getTablePrefix()."asset_logs.id=".DB::getTablePrefix()."assets.id AND action_type='checkout' ORDER BY id DESC limit 1) WHERE assigned_to IS NOT NULL"); } /**