public function createTable($table) { // drop existing table DB::statement("drop table if exists `{$table}`"); $header = $this->request->getHeader(); $listings = $this->getListings(); $fields = []; foreach ($listings as $listing) { unset($listing->datajoeEntity); foreach ($listing as $k => $v) { if (isset($fields[$k])) { $fields[$k] = strlen(print_r($v, TRUE)) > $fields[$k] ? strlen(print_r($v, TRUE)) + 100 : $fields[$k]; } else { $fields[$k] = strlen(print_r($v, TRUE)) + 100; } } } $sql = "CREATE TABLE IF NOT EXISTS `{$table}` (\n\t\t\t`id` MEDIUMINT( 10 ) UNSIGNED NOT NULL,\n\t\t\t`name` VARCHAR( 100 ) NOT NULL COMMENT 'Name',\n"; foreach ($fields as $k => $v) { if ($k != 'name' && $k != 'id') { $sql .= "`{$k}` VARCHAR( {$v} ) NOT NULL COMMENT " . str_replace('?', '?', DB::connection()->getPdo()->quote($header->{$k}->label)) . ",\n"; } } $sql .= "FULLTEXT KEY `name` (`name`),\n\t\t\tPRIMARY KEY ( `id` )\n\t\t\t) ENGINE = MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci;"; DB::statement($sql); }
/** * Run the database seeds. * * @return void */ public function run() { Model::unguard(); DB::beginTransaction(); DB::statement('SET FOREIGN_KEY_CHECKS = 0'); DB::table('routes')->delete(); DB::table('contents')->delete(); DB::table('categories')->delete(); DB::table('content_types')->delete(); DB::table('languages')->delete(); DB::table('group_user')->delete(); DB::table('user_meta')->delete(); DB::table('users')->delete(); DB::table('groups')->delete(); DB::table('routes')->truncate(); DB::table('contents')->truncate(); DB::table('categories')->truncate(); DB::table('content_types')->truncate(); DB::table('languages')->truncate(); DB::table('group_user')->truncate(); DB::table('user_meta')->truncate(); DB::table('users')->truncate(); DB::table('groups')->truncate(); DB::statement('SET FOREIGN_KEY_CHECKS = 1'); DB::commit(); Model::reguard(); }
public function run() { DB::statement('SET FOREIGN_KEY_CHECKS=0;'); DB::table(config('access.permissions_table'))->truncate(); DB::table(config('access.permission_role_table'))->truncate(); DB::table(config('access.permission_user_table'))->truncate(); $permission_model = config('access.permission'); $viewBackend = new $permission_model(); $viewBackend->name = 'view_backend'; $viewBackend->display_name = 'View Backend'; $viewBackend->system = true; $viewBackend->created_at = Carbon::now(); $viewBackend->updated_at = Carbon::now(); $viewBackend->save(); //Find the first role (admin) give it all permissions $role_model = config('access.role'); $role_model = new $role_model(); $admin = $role_model::first(); $admin->permissions()->sync([$viewBackend->id]); $permission_model = config('access.permission'); $userOnlyPermission = new $permission_model(); $userOnlyPermission->name = 'user_only_permission'; $userOnlyPermission->display_name = 'Test User Only Permission'; $userOnlyPermission->system = false; $userOnlyPermission->created_at = Carbon::now(); $userOnlyPermission->updated_at = Carbon::now(); $userOnlyPermission->save(); $user_model = config('auth.model'); $user_model = new $user_model(); $user = $user_model::find(2); $user->permissions()->sync([$userOnlyPermission->id]); DB::statement('SET FOREIGN_KEY_CHECKS=1;'); }
/** * Run the database seeds. * * @return void */ public function run() { Model::unguard(); DB::statement('SET FOREIGN_KEY_CHECKS=0;'); DB::table('oauth_clients')->truncate(); DB::table('roles')->truncate(); DB::table('oauth_scopes')->truncate(); DB::table('oauth_client_grants')->truncate(); DB::table('oauth_grants')->truncate(); DB::table('oauth_client_scopes')->truncate(); DB::table('oauth_access_tokens')->truncate(); DB::table('oauth_access_token_scopes')->truncate(); DB::table('oauth_sessions')->truncate(); DB::table('oauth_session_scopes')->truncate(); DB::table('oauth_grant_scopes')->truncate(); DB::table('users')->truncate(); DB::statement('SET FOREIGN_KEY_CHECKS=1;'); $this->call(OauthClientsTableSeeder::class); $this->call(RolesTableSeeder::class); $this->call(OauthScopesTableSeeder::class); $this->call(OauthGrantsTableSeeder::class); $this->call(OauthClientGrantsTableSeeder::class); $this->call(OauthClientScopesTableSeeder::class); $this->call(OauthGrantScopesTableSeeder::class); $this->call(UsersTableSeeder::class); Model::reguard(); }
public function run() { if (env('DB_DRIVER') == 'mysql') { DB::statement('SET FOREIGN_KEY_CHECKS=0;'); } if (env('DB_DRIVER') == 'mysql') { DB::table(config('access.assigned_roles_table'))->truncate(); } elseif (env('DB_DRIVER') == 'sqlite') { DB::statement("DELETE FROM " . config('access.assigned_roles_table')); } else { //For PostgreSQL or anything else DB::statement("TRUNCATE TABLE " . config('access.assigned_roles_table') . " CASCADE"); } //Attach admin role to admin user $user_model = config('auth.model'); $user_model = new $user_model(); $user_model::first()->attachRole(1); //Attach user role to general user $user_model = config('auth.model'); $user_model = new $user_model(); $user_model::find(2)->attachRole(2); if (env('DB_DRIVER') == 'mysql') { DB::statement('SET FOREIGN_KEY_CHECKS=1;'); } }
/** * Run the migrations. * * @return void */ public function up() { Schema::create('articles', function (Blueprint $table) { $table->increments('id'); $table->integer('contributor_id')->unsigned(); $table->integer('subcategory_id')->unsigned(); $table->string('title', 70); $table->string('slug', 100)->unique(); $table->string('featured')->default('noimage.jpg'); $table->text('content'); $table->text('content_update')->nullable(); $table->string('excerpt', 300)->nullable(); $table->enum('type', ['standard', 'gallery', 'video'])->default('standard'); $table->enum('status', ['pending', 'draft', 'published', 'reject'])->default('pending'); $table->enum('state', ['general', 'headline', 'trending'])->default('general'); $table->integer('view')->unsigned()->default(0); $table->decimal('reward')->default(0); $table->softDeletes(); $table->timestamps(); $table->foreign('contributor_id')->references('id')->on('contributors')->onDelete('cascade'); $table->foreign('subcategory_id')->references('id')->on('subcategories')->onDelete('cascade'); $table->index(['id', 'slug']); }); DB::statement("ALTER TABLE articles MODIFY content LONGBLOB"); DB::statement("ALTER TABLE articles MODIFY content_update LONGBLOB"); }
public function run() { if (DB::connection()->getDriverName() == 'mysql') { DB::statement('SET FOREIGN_KEY_CHECKS=0;'); } if (DB::connection()->getDriverName() == 'mysql') { DB::table(config('access.assigned_roles_table'))->truncate(); } elseif (DB::connection()->getDriverName() == 'sqlite') { DB::statement('DELETE FROM ' . config('access.assigned_roles_table')); } else { //For PostgreSQL or anything else DB::statement('TRUNCATE TABLE ' . config('access.assigned_roles_table') . ' CASCADE'); } //Attach admin role to admin user $user_model = config('auth.providers.users.model'); $user_model = new $user_model(); $user_model::first()->attachRole(1); //Attach executive role to executive user $user_model = config('auth.providers.users.model'); $user_model = new $user_model(); $user_model::find(2)->attachRole(2); //Attach user role to general user $user_model = config('auth.providers.users.model'); $user_model = new $user_model(); $user_model::find(3)->attachRole(3); if (DB::connection()->getDriverName() == 'mysql') { DB::statement('SET FOREIGN_KEY_CHECKS=1;'); } }
public function run() { if (env('DB_DRIVER') == 'mysql') { DB::table(config('access.roles_table'))->truncate(); } elseif (env('DB_DRIVER') == 'sqlite') { DB::statement('DELETE FROM ' . config('access.roles_table')); } else { //For PostgreSQL or anything else DB::statement('TRUNCATE TABLE ' . config('access.roles_table') . ' CASCADE'); } //Create admin role, id of 1 $role_model = config('access.role'); $admin = new $role_model(); $admin->name = 'Administrator'; $admin->all = true; $admin->sort = 1; $admin->created_at = Carbon::now(); $admin->updated_at = Carbon::now(); $admin->save(); //id = 2 $role_model = config('access.role'); $user = new $role_model(); $user->name = 'User'; $user->sort = 2; $user->created_at = Carbon::now(); $user->updated_at = Carbon::now(); $user->save(); }
/** * Run the database seeds. * * @return void */ public function run() { Model::unguard(); DB::statement('SET FOREIGN_KEY_CHECKS=0'); if (!App::environment('production')) { $this->call('UsersTableSeeder'); $this->call('ProfilesTableSeeder'); } $this->call('RolesTableSeeder'); $this->call('DestinationsTableSeeder'); $this->call('LocationsTableSeeder'); $this->call('MissionTypesTableSeeder'); $this->call('VehiclesTableSeeder'); $this->call('StatisticsTableSeeder'); $this->call('PartsTableSeeder'); $this->call('MissionsTableSeeder'); $this->call('PartFlightsTableSeeder'); $this->call('TagsTableSeeder'); $this->call('NotificationTypesTableSeeder'); $this->call('NotificationsTableSeeder'); $this->call('AstronautsTableSeeder'); $this->call('SpacecraftTableSeeder'); $this->call('SpacecraftFlightsTableSeeder'); $this->call('PayloadsTableSeeder'); $this->call('TelemetryTableSeeder'); $this->call('PrelaunchEventsTableSeeder'); DB::statement('SET FOREIGN_KEY_CHECKS=1'); }
public function store(Request $request) { $input = $request->all(); $unit = Units::findOrFail($input['unit_id']); $item = Items::findOrFail($input['item_id']); if (array_key_exists('default', $input)) { DB::table('item_units')->where(['default' => 1, 'item_id' => $input['item_id']])->update(['default' => 0]); $input['default'] = 1; DB::statement('INSERT INTO item_units (`item_id`, `unit_id`, `factor`, `default`, `updated_at`, `created_at`) VALUES (' . $input['item_id'] . ', ' . $input['unit_id'] . ', ' . $input['factor'] . ', ' . $input['default'] . ', NOW(), NOW())'); Helper::add(DB::getPdo()->lastInsertId(), 'added unit ' . $unit->title . ' for item ' . $item->title . ' (ID ' . $input['item_id'] . ')'); Helper::add(DB::getPdo()->lastInsertId(), 'changed item ' . $item->title . ' (ID ' . $input['item_id'] . ') default unit to ' . $unit->title); ItemUnits::where(['item_id' => $input['item_id']])->update(['factor' => DB::raw('factor/' . $input['factor'])]); StockItem::where(['item_id' => $input['item_id']])->update(['stock' => DB::raw('stock/' . $input['factor'])]); RecipeItems::where(['item_id' => $input['item_id']])->update(['value' => DB::raw('value/' . $input['factor'])]); Menu::where(['item_id' => $input['item_id']])->update(['value' => DB::raw('value/' . $input['factor'])]); ItemPurchases::where(['item_id' => $input['item_id']])->update(['value' => DB::raw('value/' . $input['factor'])]); StockCheck::where(['item_id' => $input['item_id']])->update(['before' => DB::raw('`before` / ' . $input['factor']), 'after' => DB::raw('`after` / ' . $input['factor'])]); } else { $input['default'] = 0; DB::statement('INSERT INTO item_units (`item_id`, `unit_id`, `factor`, `default`, `updated_at`, `created_at`) VALUES (' . $input['item_id'] . ', ' . $input['unit_id'] . ', ' . $input['factor'] . ', ' . $input['default'] . ', NOW(), NOW())'); Helper::add(DB::getPdo()->lastInsertId(), 'added unit ' . $unit->title . ' for item ' . $item->title . ' (ID ' . $input['item_id'] . ')'); } //Units::create($input); Session::flash('flash_message', $this->title . ' successfully added!'); return Redirect::action('ItemsController@index'); }
/** * Run the database seeds. * * @return void */ public function run() { //Truncate DB::statement('SET FOREIGN_KEY_CHECKS=0;'); User::truncate(); Admin::truncate(); Customer::truncate(); Address::truncate(); Category::truncate(); Product::truncate(); Brand::truncate(); Type::truncate(); Image::truncate(); DB::statement('TRUNCATE category_product;'); Product::clearIndices(); Product::reindex(); //Unguard Model::unguard(); //Call $this->call(UsersTableSeeder::class); $this->call(ProductsTableSeeder::class); //Reguard Model::reguard(); DB::statement('SET FOREIGN_KEY_CHECKS=1;'); }
/** * 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;'); }
public function updateAlbum(Request $request) { $albums = json_decode($request->all()['albums'], true); $len = count($albums); DB::statement('SET FOREIGN_KEY_CHECKS=0;'); Album::truncate(); Photo::truncate(); Album::reindex(); DB::statement('SET FOREIGN_KEY_CHECKS=1;'); foreach ($albums as $a) { $album = new Album(); $album->album_id = $a['id']; $album->name = $a['name']; $album->created_time = $a['created_time']; $album->save(); $photos = $a['photos']['data']; foreach ($photos as $p) { $photo = new Photo(); $photo->album_id = $album->id; $photo->photo_id = $p['id']; $photo->source = $p['source']; $photo->save(); } } return '1'; }
/** * 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'); } } } }
/** * Run the migrations. * * @return void */ public function up() { Schema::create('search_texts', function (Blueprint $table) { $table->increments('id'); $table->integer('page_vid')->unsigned()->nullable()->references('id')->on('page_versions')->onUpdate('CASCADE')->onDelete('CASCADE'); $table->integer('page_id')->unsigned()->references('id')->on('pages')->onUpdate('CASCADE')->onDelete('CASCADE'); $table->integer('embargoed_until')->unsigned()->nullable(); $table->string('title', 75)->nullable(); $table->string('standfirst', '255')->null(); $table->longText('text')->nullable(); }); DB::statement('ALTER TABLE search_texts ENGINE = "MyISAM"'); DB::statement('CREATE FULLTEXT INDEX search_texts_title on search_texts(title)'); DB::statement('CREATE FULLTEXT INDEX search_texts_standfirst on search_texts(standfirst)'); DB::statement('CREATE FULLTEXT INDEX search_texts_text on search_texts(text)'); DB::statement('CREATE FULLTEXT INDEX search_texts_all on search_texts(title, standfirst, text)'); DB::statement('ALTER TABLE chunk_texts drop index text_fulltext'); DB::statement('ALTER TABLE page_versions drop index title_fulltext'); $finder = new Finder\Finder(); $finder->addFilter(new Finder\VisibleInSiteSearch()); $pages = $finder->findAll(); foreach ($pages as $p) { DB::table('search_texts')->insert(['page_id' => $p->getId(), 'embargoed_until' => $p->getCurrentVersion()->getEmbargoedUntil()->getTimestamp(), 'page_vid' => $p->getCurrentVersion()->getId(), 'title' => $p->getTitle(), 'standfirst' => Chunk::get('text', 'standfirst', $p)->text(), 'text' => strip_tags(Chunk::get('text', 'bodycopy', $p)->text())]); } }
/** * Execute the console command. * * @return void */ public function fire() { $fkCheck = $this->input->getOption('fkCheck'); $fkCheck ? null : DB::statement('SET FOREIGN_KEY_CHECKS=0;'); $this->module = $this->laravel['modules']; $arguments = $this->input->getArguments(); $name = array_key_exists('module', $arguments) && $arguments['module'] ? strtolower($arguments['module']) : null; if (!$name) { return parent::fire(); } //parent::fire(); if ($name) { return $this->dbseed($name); } foreach ($this->module->getOrdered($this->option('direction')) as $module) { $this->line('Seed for module: <info>' . $module->getName() . '</info>'); $this->dbseed($module->getDotName()); } $fkCheck ? null : DB::statement('SET FOREIGN_KEY_CHECKS=1;'); return $this->info('All modules seeded.'); if (!$this->confirmToProceed()) { return; } $this->resolver->setDefaultConnection($this->getDatabase()); $this->getSeeder()->run(); }
/** * Get all objects and their related variants for a section * @param $where * @param array $selectedColumns * @return mixed * @throws Exception * @since 08-01-2016 * @author Dinanath Thakur <*****@*****.**> */ public function getAllObjectsAndVariantsOfASectionWhere($where, $selectedColumns = ['*']) { if (func_num_args() > 0) { $where = func_get_arg(0); $cacheKey = $this->table . "::" . implode('-', array_flatten($where)); if (cacheGet($cacheKey)) { return cacheGet($cacheKey); } // die("no cache"); DB::statement('SET SESSION group_concat_max_len = 10000'); $result = DB::table($this->table)->join('settings_sections', 'settings_sections.section_id', '=', 'settings_objects.section_id')->join('settings_descriptions', 'settings_descriptions.object_id', '=', 'settings_objects.object_id')->leftJoin('settings_variants', 'settings_variants.object_id', '=', 'settings_objects.object_id')->leftJoin('settings_descriptions as sd', function ($join) { $join->on('sd.object_id', '=', 'settings_variants.variant_id'); })->whereRaw($where['rawQuery'], isset($where['bindParams']) ? $where['bindParams'] : array())->select(DB::raw('settings_objects.object_id , settings_objects.*, settings_sections.name AS section_name, settings_descriptions.value AS setting_name, settings_descriptions.tooltip, GROUP_CONCAT(DISTINCT(settings_variants.variant_id) ORDER BY settings_variants.position) AS variant_ids, GROUP_CONCAT(DISTINCT(BINARY settings_variants.name) ORDER BY settings_variants.position SEPARATOR "____") AS variant_names, GROUP_CONCAT(CASE sd.object_type WHEN "V" THEN sd.value END ORDER BY settings_variants.position SEPARATOR "____") AS var_names'))->orderBy('settings_objects.position')->groupBy('settings_objects.object_id')->get(); cachePut($cacheKey, $result, $this->minutes); return $result; } else { throw new Exception('Argument Not Passed'); } }
/** * Execute the console command. * * @return mixed */ public function handle() { $this->info('Downloading the full ROA cert list'); $roas = json_decode(file_get_contents($this->rpkiServer)); $ipv4AmountCidrArray = $this->ipUtils->IPv4cidrIpCount(); $ipv6AmountCidrArray = $this->ipUtils->IPv6cidrIpCount(); $mysqlTime = '"' . date('Y-m-d H:i:s') . '"'; $this->info('Creating the insert query'); DB::statement('DROP TABLE IF EXISTS roa_table_temp'); DB::statement('DROP TABLE IF EXISTS backup_roa_table'); DB::statement('CREATE TABLE roa_table_temp LIKE roa_table'); $roaInsert = ''; foreach ($roas->roas as $roa) { $roaParts = explode('/', $roa->prefix); $roaCidr = $roaParts[1]; $roaIP = $roaParts[0]; $roaAsn = str_ireplace('as', '', $roa->asn); $startDec = $this->ipUtils->ip2dec($roaIP); if ($this->ipUtils->getInputType($roaIP) == 4) { $ipAmount = $ipv4AmountCidrArray[$roaCidr]; } else { $ipAmount = $ipv6AmountCidrArray[$roaCidr]; } $endDec = bcsub(bcadd($startDec, $ipAmount), 1); $roaInsert .= '("' . $roaIP . '",' . $roaCidr . ',' . $startDec . ',' . $endDec . ',' . $roaAsn . ',' . $roa->maxLength . ',' . $mysqlTime . ',' . $mysqlTime . '),'; } $this->info('Processing the insert query'); $roaInsert = rtrim($roaInsert, ',') . ';'; DB::statement('INSERT INTO roa_table_temp (ip,cidr,ip_dec_start,ip_dec_end,asn,max_length,updated_at,created_at) VALUES ' . $roaInsert); $this->info('Hot Swapping the ROA list table'); DB::statement('RENAME TABLE roa_table TO backup_roa_table, roa_table_temp TO roa_table;'); DB::statement('DROP TABLE IF EXISTS backup_roa_table'); }
/** * Reverse the migrations. * * @return void */ public function down() { Schema::drop('user_socials'); if (DB::table('users')->count() === 0) { DB::statement('ALTER TABLE `users` MODIFY `password` VARCHAR(64) NOT NULL;'); } }
public function run() { if (env('DB_DRIVER') == 'mysql') { DB::statement('SET FOREIGN_KEY_CHECKS=0;'); } if (env('DB_DRIVER') == 'mysql') { DB::table(config('access.roles_table'))->truncate(); } else { //For PostgreSQL or anything else DB::statement("TRUNCATE TABLE " . config('access.roles_table') . " CASCADE"); } //Create admin role, id of 1 $role_model = config('access.role'); $admin = new $role_model(); $admin->name = 'Administrator'; $admin->all = true; $admin->sort = 1; $admin->created_at = Carbon::now(); $admin->updated_at = Carbon::now(); $admin->save(); //id = 2 $role_model = config('access.role'); $user = new $role_model(); $user->name = 'User'; $user->sort = 2; $user->created_at = Carbon::now(); $user->updated_at = Carbon::now(); $user->save(); if (env('DB_DRIVER') == 'mysql') { DB::statement('SET FOREIGN_KEY_CHECKS=1;'); } }
public function run() { DB::statement('SET FOREIGN_KEY_CHECKS = 0'); DB::table('users')->truncate(); DB::table('users')->insert([['user_name' => env('ADMIN_USERNAME'), 'first_name' => env('ADMIN_FIRSTNAME'), 'last_name' => env('ADMIN_LASTNAME'), 'email' => env('ADMIN_EMAIL'), 'password' => Hash::make(env('ADMIN_PASSWORD')), 'is_admin' => 1, 'created_at' => Carbon::now(), 'updated_at' => Carbon::now()]]); DB::statement('SET FOREIGN_KEY_CHECKS = 1'); }
/** * Run the migrations. * * @return void */ public function up() { Schema::table('purchases', function ($table) { $table->date('vat_date'); }); DB::statement("UPDATE `purchases` SET `vat_date` = `date_created`;"); }
/** * Run the migrations. * * @return void */ public function up() { DB::transaction(function () { DB::statement("create temporary table unique_entities (select e.id as orig_id, e.name as name, (select min(id) from entities where entities.name=e.name) as uniq_id from entities as e);"); $pairs = DB::select("select orig_id, uniq_id from unique_entities where orig_id != uniq_id;"); $oldToUnique = []; foreach ($pairs as $pair) { $oldToUnique[$pair->orig_id] = $pair->uniq_id; } $charts = Chart::all(); foreach ($charts as $chart) { $config = json_decode($chart->config); $countries = $config->{'selected-countries'}; if (empty($countries)) { continue; } foreach ($countries as $country) { if (array_key_exists($country->id, $oldToUnique)) { echo "Updating chart config for " . $chart->id . " changing entity id from " . $country->id . " to " . $oldToUnique[$country->id] . "\n"; $country->id = $oldToUnique[$country->id]; } } $chart->config = json_encode($config); $chart->save(); } DB::statement("update data_values as dv inner join unique_entities as e on e.orig_id=dv.fk_ent_id set dv.fk_ent_id=e.uniq_id;"); DB::statement("delete from entities where entities.id in (select orig_id from unique_entities where orig_id != uniq_id);"); DB::statement("drop table unique_entities;"); }); Schema::table("entities", function ($table) { $table->unique('name'); }); }
protected function schedule(Schedule $schedule) { $schedule->call(function () { DB::statement('call RELBACK.SP_CREATE_SCHEDULE(sysdate-7)'); })->twiceDaily(0, 6, 12, 18); //->sendOutputTo(storage_path() . "logs/exec_sp_create_schedule.log"); //->twiceDaily(0, 6, 12, 18) }
/** * Run the database seeds. * * @return void */ public function run() { DB::statement('SET FOREIGN_KEY_CHECKS=0;'); Model::unguard(); $this->call('UsersTableSeeder'); $this->call('EntrustTableSeeder'); DB::statement('SET FOREIGN_KEY_CHECKS=1;'); }
/** * Run the database seeds. * * @return void */ public function run() { Eloquent::unguard(); DB::statement('SET FOREIGN_KEY_CHECKS = 0'); $this->truncateTables(); $this->seedTables(); DB::statement('SET FOREIGN_KEY_CHECKS = 1'); }
private function cleanDatabase() { DB::statement('SET FOREIGN_KEY_CHECKS=0'); foreach ($this->{$tables} as $tableName) { DB::table($tableName)->truncate(); } DB::statement('SET FOREIGN_KEY_CHECKS=1'); }
public function cleanDatabase() { DB::statement('SET FOREIGN_KEY_CHECKS=0'); foreach ($this->tables as $table) { DB::table($table)->truncate(); } DB::statement('SET FOREIGN_KEY_CHECKS=1'); }
protected function runClean($tables) { foreach ($tables as $tuple) { DB::statement("ALTER TABLE {$tuple->table_name} DISABLE TRIGGER ALL"); DB::statement("TRUNCATE TABLE {$tuple->table_name} RESTART IDENTITY CASCADE"); DB::statement("ALTER TABLE {$tuple->table_name} ENABLE TRIGGER ALL"); } }
/** * Run the database seeds. * * @return void */ public function run() { Model::unguard(); DB::statement('SET FOREIGN_KEY_CHECKS=0;'); $this->call('Modules\\Site\\Database\\Seeders\\PagesTableSeeder'); $this->call('Modules\\Site\\Database\\Seeders\\ContentsTableSeeder'); DB::statement('SET FOREIGN_KEY_CHECKS=1;'); }