/** * Reverse the migrations. * * @return void */ public function down() { Schema::drop('users'); //delete everything inside the profile pictures directory $path = public_path() . '/content/profile_pictures/'; File::deleteDirectory($path, true); }
/** * Reverse the migrations. * * @return void */ public function down() { Schema::drop('users'); Schema::drop('towns'); Schema::drop('educations'); // }
/** * Reverse the migrations. * * @return void */ public function down() { Schema::drop('novels'); Schema::drop('chapters'); Schema::drop('configs'); Schema::drop('mails'); }
/** * Overload the drop method of Schema to prevent the dropping * of core CMS tables * @param $table * @return */ public static function drop($table) { // Drop the table only if it isn't one of the core tables if (static::isNotCoreTable($table)) { parent::drop($table); } }
/** * Reverse the migrations. * * @return void */ public function down() { Schema::table('oauth_refresh_tokens', function (Blueprint $table) { $table->dropForeign('oauth_refresh_tokens_access_token_id_foreign'); }); Schema::drop('oauth_refresh_tokens'); }
/** * Reverse the migrations. * * @return void */ public function down() { Schema::table('media', function (Blueprint $table) { $table->dropColumn('deleted_at'); }); Schema::drop('sample_mediables'); }
/** * Reverse the migrations. * * @return void */ public function down() { Schema::table('forums', function (Blueprint $table) { $table->dropForeign('forums_last_post_id_foreign'); }); Schema::drop('posts'); }
public function importCertMongo($collection, $query) { $this->info("=========Import to: {$collection}============"); $result = DB::connection('mysql')->select($this->getQuery($query, true)); $rows = $result[0]->total; $this->info("Total de filas: {$rows}"); $begin = 0; $block = 1000; $countBlock = 1; $fCsv = storage_path("app/{$collection}.csv"); if (file_exists($fCsv)) { unlink($fCsv); } $fp = fopen($fCsv, 'w'); fputs($fp, "organization, status, from, year, month, quarter, total \n"); while ($rows > $begin) { $result = DB::connection('mysql')->select($this->getQuery($query, false, $begin, $block)); foreach ($result as $key => $value) { $resultArray = json_decode(json_encode($value), true); fputs($fp, str_replace("\n", '', implode($resultArray, ',')) . "\n"); } $this->info("End block {$countBlock}: " . date('H:i:s')); $begin += $block; $countBlock++; } fclose($fp); $this->info('End export to csv: ' . date('H:i:s')); Schema::drop($collection); $db = env('MONGO_DATABASE'); $command = "mongoimport -d {$db} -c {$collection} --type csv --file {$fCsv} --headerline"; shell_exec($command); }
/** * Reverse the migrations. * * @return void */ public function down() { Schema::table('manager_profile', function ($table) { $table->dropForeign('manager_profile_user_id_foreign'); }); Schema::drop('manager_profile'); }
/** * Reverse the migrations. * * @return void */ public function down() { Schema::table("user_settings", function (Blueprint $table) { $table->dropForeign("user_settings_user_id_foreign"); }); Schema::drop("user_settings"); }
public function tearDown() { parent::tearDown(); m::close(); (new \UsersCreateTable())->down(); Facades\Schema::drop('password_reminders'); }
/** * Reverse the migrations. */ public function down() { Schema::drop('account_modules', function (Blueprint $table) { $table->dropForeign('account_module_to_account'); $table->dropForeign('account_module_to_module'); }); }
/** * Reverse the migrations. * * @return void */ public function down() { Schema::table('posts', function (Blueprint $table) { $table->dropForeign('posts_topic_id_foreign'); }); Schema::drop('topics'); }
/** * Execute the console command. * * @return mixed */ public function handle() { if ($this->confirm("Clear database? [Yes|no]", "Yes")) { $this->info('Clear database start'); if (config('database.default') == 'mysql') { DB::statement('SET FOREIGN_KEY_CHECKS=0'); } else { if (config('database.default') == 'sqlite') { DB::statement('PRAGMA foreign_keys = OFF'); } } $tableNames = Schema::getConnection()->getDoctrineSchemaManager()->listTableNames(); foreach ($tableNames as $v) { Schema::drop($v); $this->info('Dropped: ' . $v); } $this->info('Clear database end'); if (config('database.default') == 'mysql') { DB::statement('SET FOREIGN_KEY_CHECKS=1'); } else { if (config('database.default') == 'sqlite') { DB::statement('PRAGMA foreign_keys = ON'); } } } }
/** * Reverse the migrations. * * @return void */ public function down() { Schema::table('third_party_logins', function (Blueprint $table) { $table->dropForeign('third_party_logins_user_id_foreign'); }); Schema::drop('third_party_logins'); }
/** * Reverse the migrations. * * @return void */ public function down() { Schema::drop('permission_role'); Schema::drop('role_user'); Schema::drop('permissions'); Schema::drop('roles'); }
/** * Reverse the migrations. * * @return void */ public function down() { Schema::table('administrators', function ($table) { $table->dropForeign('administrators_user_id_foreign'); }); Schema::drop('administrators'); }
/** * Reverse the migrations. * * @return void */ public function down() { Schema::table("contacts", function (Blueprint $table) { $table->dropForeign("contacts_partnership_id_foreign"); }); Schema::drop("contacts"); }
/** * Reverse the migrations. * * @return void */ public function down() { Schema::table('user_meta', function (Blueprint $table) { $table->dropForeign('user_meta_user_id_foreign'); }); Schema::drop('user_meta'); }
/** * Reverse the migrations. * * @return void */ public function down() { Schema::table('oauth_auth_codes', function (Blueprint $t) { $t->dropForeign('oauth_auth_codes_session_id_foreign'); }); Schema::drop('oauth_auth_codes'); }
/** * Reverse the migrations. * * @return void */ public function down() { Schema::table('oauth_client_endpoints', function (Blueprint $table) { $table->dropForeign('oauth_client_endpoints_client_id_foreign'); }); Schema::drop('oauth_client_endpoints'); }
/** * Reverse the migrations. * * @return void */ public function down() { //disable foreign key check for this connection before running seeders DB::statement('SET FOREIGN_KEY_CHECKS=0;'); Schema::drop('content_fields'); DB::statement('SET FOREIGN_KEY_CHECKS=1;'); }
/** * Reverse the migrations. * * @return void */ public function down() { Schema::table('oauth_session_scopes', function (Blueprint $table) { $table->dropForeign('oauth_session_scopes_session_id_foreign'); $table->dropForeign('oauth_session_scopes_scope_id_foreign'); }); Schema::drop('oauth_session_scopes'); }
public function tearDown() { $this->operator->reset()->delete(); if (Schema::hasTable('users')) { Schema::drop('users'); } parent::tearDown(); }
/** * Reverse the migrations. * * @return void */ public function down() { DB::transaction(function () { Schema::drop('widget_menu'); Schema::drop('widget_permission'); Schema::drop('widgets'); }); }
/** * Reverse the migrations. * * @return void */ public function down() { Schema::table('alerts', function (Blueprint $table) { $table->dropForeign('alerts_alerts_type_id_foreign'); $table->dropForeign('alerts_pets_id_foreign'); }); Schema::drop('alerts'); }
/** * Reverse the migrations. * * @return void */ public function down() { Schema::table('oauth_grant_scopes', function (Blueprint $t) { $t->dropForeign('oauth_grant_scopes_grant_id_foreign'); $t->dropForeign('oauth_grant_scopes_scope_id_foreign'); }); Schema::drop('oauth_grant_scopes'); }
/** * Reverse the migrations. * * @return void */ public function down() { // Schema::drop('evaluation_assertion'); Schema::drop('assertions'); Schema::drop('evaluations'); Schema::drop('webpages'); Schema::drop('assertors'); }
protected function tearDown() { Schema::drop('testing_table'); $this->kernel->call('migrate:rollback'); $this->app->flush(); $this->app = null; parent::tearDown(); }
/** * Execute the console command. * * @return mixed */ public function fire() { //register log in DB $dateBegin = new \DateTime(); $activity = Activity::concept(ConstDb::LOAD_CRL)->first(); if ($activity) { $activity->date_begin = $dateBegin->format('Y-m-d H:i:s'); $activity->save(); } else { Activity::create(['concept' => ConstDb::LOAD_CRL, 'date_begin' => $dateBegin->format('Y-m-d H:i:s')]); } //end log $this->info('Begin: ' . date('H:i:s')); $result = DB::connection('mysql_crl')->select($this->getQuery(true)); $rows = $result[0]->total; $this->info("Total de filas: {$rows}"); $begin = 0; $block = 10000; $countBlock = 1; $fCsv = storage_path('app/crl.csv'); if (file_exists($fCsv)) { unlink($fCsv); } $fp = fopen($fCsv, 'w'); fputs($fp, "organization, from, year, quarter, month, total \n"); while ($rows > $begin) { $result = DB::connection('mysql_crl')->select($this->getQuery(false, $begin, $block)); foreach ($result as $key => $value) { $array = json_decode(json_encode($value), true); $replace = ["\n", ',', ' ']; $replaceTo = ["", ';', ' ']; foreach ($array as $key => $value) { $array[$key] = str_replace($replace, $replaceTo, $value); } fputs($fp, implode($array, ',') . "\n"); } $this->info("End block {$countBlock}: " . date('H:i:s')); $begin += $block; $countBlock++; } fclose($fp); $this->info('End export CSV: ' . date('H:i:s')); Schema::drop('crl'); $db = env('MONGO_DATABASE'); $command = "mongoimport -d {$db} -c crl --type csv --file {$fCsv} --headerline"; shell_exec($command); //register log in DB $dateEnd = new \DateTime(); $activity = Activity::concept(ConstDb::LOAD_CRL)->first(); if ($activity) { $activity->date_end = $dateEnd->format('Y-m-d H:i:s'); $activity->save(); } else { Activity::create(['concept' => ConstDb::LOAD_CRL, 'date_end' => $dateEnd->format('Y-m-d H:i:s')]); } //end log $this->info('End: ' . $dateEnd->format('H:i:s')); }