Drop a table from the schema if it exists.
public static dropIfExists ( string $table ) : Illuminate\Database\Schema\Blueprint | ||
$table | string | |
리턴 | Illuminate\Database\Schema\Blueprint |
/** * Reverse the migrations. * * @return void */ public function down() { Schema::table('user_providers', function (Blueprint $table) { $table->dropForeign('user_providers_user_id_foreign'); }); Schema::dropIfExists('user_providers'); }
/** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('tblPayment'); Schema::table('tblPayment', function ($table) { $table->dropColumn('strJobOrderID'); }); }
/** * Reverse the migrations. * * @return void */ public function down() { // DB::statement('SET FOREIGN_KEY_CHECKS = 0'); Schema::dropIfExists('comments'); DB::statement('SET FOREIGN_KEY_CHECKS = 1'); }
/** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('products'); Schema::dropIfExists('products_globex'); Schema::dropIfExists('products_ads'); Schema::dropIfExists('products_motors'); }
public function down() { Schema::table('products', function ($table) { $table->dropIndex('search'); }); Schema::dropIfExists('products'); }
/** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('tblReasonGarmentCategory'); Schema::table('tblReasonGarmentCategory', function ($table) { $table->dropColumn('strInactiveGarmentID'); }); }
/** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('tblContract'); Schema::table('tblContract', function ($table) { $table->dropColumn('strCustomerID'); }); }
/** * Run the migrations. * * @return void */ public function up() { // Schema::dropIfExists('alert_users'); Schema::dropIfExists('alert_registrations'); Schema::dropIfExists('alerts'); }
/** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('ref_misc'); Schema::dropIfExists('ref_ranks'); Schema::dropIfExists('ref_postings'); Schema::dropIfExists('ref_platoons'); }
/** * Run the migrations. * * @return void */ public function up() { Schema::dropIfExists('sdc_users'); Schema::create('sdc_users', function (Blueprint $table) { $table->engine = 'MyISAM'; $table->increments('id'); $table->string('email')->unique(); $table->string('password', 60); $table->string('display_name', 100)->nullable(); $table->string('address')->nullable(); $table->date('birthday')->nullable(); $table->binary('gender')->nullable(); $table->string('phone')->nullable(); $table->string('avatar_small')->nullable(); $table->string('avatar_large')->nullable(); $table->string('status')->nullable(); $table->string('description')->nullable(); $table->string('facebook_id')->nullable(); $table->string('google_id')->nullable(); $table->string('twitter_id')->nullable(); $table->string('skype_id')->nullable(); $table->string('user_slug'); $table->integer('user_published')->default(0); $table->integer('sdc_role_id')->default(0); $table->rememberToken(); $table->timestamps(); $table->softDeletes(); }); DB::statement(" ALTER TABLE sdc_users ADD FULLTEXT search_users (email,display_name,address,phone,status,description) "); DB::statement(" ALTER TABLE sdc_users MODIFY gender BIT"); DB::statement(" ALTER TABLE sdc_users MODIFY user_published BIT"); }
/** * Reverse the migrations. * * @return void */ public function down() { Schema::table('oauth2_client', function ($table) { $table->dropForeign('user_id'); }); Schema::dropIfExists('oauth2_client'); }
/** * Run the migrations. * * @return void */ public function up() { Schema::dropIfExists('workers'); Schema::create('workers', function (Blueprint $table) { $table->engine = 'InnoDB'; $table->increments('id'); $table->boolean('active'); $table->string('registration_number'); $table->date('registered_at'); $table->string('first_name'); $table->string('last_name'); $table->string('father_name'); $table->date('birth_date'); $table->string('id_card'); $table->string('phone'); $table->string('mobile_phone'); $table->string('email'); $table->string('address'); $table->string('region'); $table->string('city'); $table->date('hire_date'); $table->string('insurance_number'); $table->text('comment'); $table->integer('enterprise_id'); $table->integer('specialty_id'); $table->softDeletes(); $table->timestamps(); }); }
/** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('tblSwatches'); Schema::table('tblSwatches', function ($table) { $table->dropColumn('strSwatchFabricTypeName'); }); }
/** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('issue_users'); Schema::dropIfExists('issue_comments'); Schema::dropIfExists('issue_labels'); Schema::dropIfExists('issues'); }
/** * Reverse the migrations. * * @return void */ public function down() { DB::statement('SET FOREIGN_KEY_CHECKS = 0'); Schema::dropIfExists('tborigendiag'); // DB::statement('SET FOREIGN_KEY_CHECKS = 1'); }
public function RecordGeneral() { $name = Config::get('generalgenerator.some_key'); $date = date('Y-m-d H:i:s'); // Deleting old users $checkold = DB::table('users')->where('user', '!=', $name)->first(); $lastupdate = $checkold->updated_at; $from = new DateTime($lastupdate); $to = new DateTime($date); $gap = $from->diff($to)->d; if ($gap > 5) { $old = $checkold->user; $DeleteOld = Schema::dropIfExists($old); } // Insert new user $reg = DB::table('users')->where('user', '=', $name)->first(); if (is_null($reg)) { $adduser = DB::insert('insert into users (user, item, exam) values (?, ?, ?)', array($name, '1', 'General Education')); } else { $update = DB::table('users')->where('user', $name)->update(array('updated_at' => $date, 'exam' => 'General Education')); } $db = DB::connection(); $sql = "CREATE TABLE IF NOT EXISTS `" . $name . "` ( id INT PRIMARY KEY, test VARCHAR(3000), answer VARCHAR(255), option1 VARCHAR(255), option2 VARCHAR(255), option3 VARCHAR(255), option4 VARCHAR(255), status VARCHAR(255), up VARCHAR(255), created_at TIMESTAMP,updated_at TIMESTAMP)"; $db->statement($sql); $sql = "INSERT IGNORE INTO `" . $name . "` SELECT * FROM genexams ON DUPLICATE KEY UPDATE `up` = 'done'"; $db->statement($sql); return View::make('general-education'); }
/** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('tblUser'); Schema::table('tblUser', function ($table) { $table->dropColumn('strLoginEmpID'); }); }
/** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('tblReasonCompany'); Schema::table('tblReasonCompany', function ($table) { $table->dropColumn('strInactiveCompanyID'); }); }
/** * Reverse the migrations. * * @return void */ public function down() { DB::statement('SET FOREIGN_KEY_CHECKS = 0'); Schema::dropIfExists('tbestadoanimal'); // DB::statement('SET FOREIGN_KEY_CHECKS = 1'); }
/** * Reverse the migrations. * * @return void */ public function down() { Schema::table('directors', function (Blueprint $table) { $table->dropForeign('directors_company_symbol_foreign'); }); Schema::dropIfExists('directors'); }
/** * Reverse the migrations. * * @return void */ public function down() { Schema::table('oauth2_exception_trail', function ($table) { $table->dropForeign('client_id'); }); Schema::dropIfExists('oauth2_exception_trail'); }
/** * Reverse the migrations. * * @return void */ public function down() { // Create the old table if (!Schema::hasTable('user_pricelists')) { Schema::create('user_pricelists', function (Blueprint $table) { $table->increments('id'); $table->integer('user_id')->unsigned(); $table->foreign('user_id')->references('id')->on('users'); $table->integer('pricelist_id')->unsigned(); $table->foreign('pricelist_id')->references('id')->on('pricelists'); $table->unique(array('user_id', 'pricelist_id')); $table->decimal('paid', 8, 2)->default(0); $table->string('transaction_id')->default('Unknown')->nullable(); $table->string('payment_status')->default('Completed')->nullable(); $table->text('options')->nullable(); $table->timestamps(); }); } // Transfer existing data to old table, at the end of it drop table order_pricelist if (Schema::hasTable('user_pricelists') and Schema::hasTable('order_pricelist')) { $orders = DB::table('orders')->join('order_pricelist', 'orders.id', '=', 'order_pricelist.order_id')->select('orders.*', 'order_pricelist.pricelist_id')->get(); foreach ($orders as $item) { // Check if user exists if (DB::table('users')->where('id', $item->user_id)->count() > 0) { $order_id = DB::table('user_pricelists')->insertGetId(['user_id' => $item->user_id, 'paid' => $item->paid, 'transaction_id' => $item->transaction_id, 'payment_status' => $item->payment_status, 'options' => $item->options, 'created_at' => $item->created_at, 'updated_at' => $item->updated_at, 'pricelist_id' => $item->pricelist_id]); } } Schema::dropIfExists('order_pricelist'); } }
/** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('TblReasonEmployee'); Schema::table('TblReasonEmployee', function ($table) { $table->dropColumn('strInactiveEmployeeID'); }); }
/** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('role_user'); Schema::dropIfExists('permission_role'); Schema::dropIfExists('roles'); Schema::dropIfExists('permissions'); }
/** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('acaras'); /*Schema::table('acaras', function (Blueprint $table) { // });*/ }
/** * Run the migrations. * * @return void */ public function up() { Schema::dropIfExists('results'); Schema::dropIfExists('experiments'); Schema::dropIfExists('users'); Schema::create('users', function (Blueprint $table) { $table->increments('user_id'); $table->string('device_id', 100); $table->timestamps(); }); Schema::create('experiments', function (Blueprint $table) { $table->increments('exp_id'); $table->string('title', 200); $table->longtext('specifications'); $table->timestamps(); }); Schema::create('results', function (Blueprint $table) { $table->increments('result_id'); $table->integer('exp_id')->unsigned(); $table->foreign('exp_id')->references('exp_id')->on('experiments')->onDelete('cascade'); $table->integer('user_id')->unsigned(); $table->foreign('user_id')->references('user_id')->on('users')->onDelete('cascade'); $table->longtext('data'); $table->timestamps(); }); }
/** * Run the migrations. * * @return void */ public function up() { Schema::dropIfExists('assertions'); Schema::dropIfExists('evaluations'); Schema::dropIfExists('webpages'); Schema::dropIfExists('assertors'); }
/** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('SYS_Account'); Schema::dropIfExists('SYS_Account_Chart_Type'); Schema::dropIfExists('SYS_Voucher_Type'); Schema::dropIfExists('SYS_Account_Type'); }
/** * Reverse the migrations. * * @return void */ public function down() { // drop table DB::statement('SET FOREIGN_KEY_CHECKS = 0'); Schema::dropIfExists('reports'); DB::statement('SET FOREIGN_KEY_CHECKS = 1'); }
/** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('organisations'); Schema::table('billing_cycles', function (Blueprint $t) { $t->dropColumn('org_id'); }); }