/** * Execute the console command. * * @return mixed */ public function handle() { \DB::statement('SET FOREIGN_KEY_CHECKS=0;'); foreach ($this->filesystem->files(__DIR__ . "/../../../../database/migrations") as $file) { $this->filesystem->requireOnce($file); $migrationClass = $this->classFinder->findClass($file); $migration = new $migrationClass(); $migration->down(); $migration->up(); } $this->info("Merx tables migrated."); \DB::statement('SET FOREIGN_KEY_CHECKS=1;'); }
/** * run package database migrations * * @return void */ public function migrate() { $fileSystem = new Filesystem(); $classFinder = new ClassFinder(); foreach ($fileSystem->files(__DIR__ . "/migrations") as $file) { $fileSystem->requireOnce($file); $migrationClass = $classFinder->findClass($file); (new $migrationClass())->up(); } foreach ($fileSystem->files(__DIR__ . "/seeds") as $file) { $fileSystem->requireOnce($file); $migrationClass = $classFinder->findClass($file); (new $migrationClass())->run(); } }
/** * run package database migrations * * @return void */ public function migrate() { $fileSystem = new Filesystem(); $classFinder = new ClassFinder(); foreach ($fileSystem->files(__DIR__ . "/../src/Commands") as $file) { $fileSystem->requireOnce($file); $migrationClass = $classFinder->findClass($file); (new $migrationClass())->fire(); } }
/** * Run all database migrations from the specified path * * @param string $path * @return void */ protected function migrateDatabaseFromPath($path) { $fileSystem = new Filesystem(); $classFinder = new ClassFinder(); foreach ($fileSystem->files($path) as $file) { $fileSystem->requireOnce($file); $migrationClass = $classFinder->findClass($file); (new $migrationClass())->up(); } }
/** * Run package database migrations. */ public function migrate() { $fileSystem = new Filesystem(); $classFinder = new ClassFinder(); foreach ($fileSystem->files(__DIR__ . '/App/database/migrations') as $file) { $fileSystem->requireOnce($file); $migrationClass = $classFinder->findClass($file); (new $migrationClass())->down(); (new $migrationClass())->up(); } }
/** * run package database migrations. */ public function migrate() { $fileSystem = new Filesystem(); $classFinder = new ClassFinder(); foreach ($fileSystem->files(__DIR__ . '/../../../../tests/NilPortugues/App/Migrations') as $file) { $fileSystem->requireOnce($file); $migrationClass = $classFinder->findClass($file); (new $migrationClass())->down(); (new $migrationClass())->up(); } }
protected function getMigrations() { $migrations = []; $fileSystem = new Filesystem(); $classFinder = new ClassFinder(); foreach ($fileSystem->files(__DIR__ . '/../migrations') as $file) { $fileSystem->requireOnce($file); $migrations[] = $classFinder->findClass($file); } return $migrations; }
/** * Run package database migrations. * Thanks http://stackoverflow.com/questions/27759301/setting-up-integration-tests-in-a-laravel-package * * @return void */ public function migrate() { $fileSystem = new Filesystem(); $classFinder = new ClassFinder(); $packageMigrations = $fileSystem->files(__DIR__ . "/../../src/Migrations"); $laravelMigrations = $fileSystem->files(__DIR__ . "/../../vendor/laravel/laravel/database/migrations"); $migrationFiles = array_merge($laravelMigrations, $packageMigrations); foreach ($migrationFiles as $file) { $fileSystem->requireOnce($file); $migrationClass = $classFinder->findClass($file); (new $migrationClass())->up(); } }
protected function migrateDatabase() { // First create fake users and articles tables (new CreateTestUsersTable())->up(); (new CreateTestArticlesTable())->up(); // Then migrate Merx tables $fileSystem = new Filesystem(); $classFinder = new ClassFinder(); foreach ($fileSystem->files(__DIR__ . "/../database/migrations") as $file) { $fileSystem->requireOnce($file); $migrationClass = $classFinder->findClass($file); (new $migrationClass())->up(); } }
/** * Execute the console command. * * @return mixed */ public function handle() { $this->disableForeignKeyChecks(); $migrationCount = 0; foreach ($this->filesystem->files(__DIR__ . "/../../../../database/migrations") as $file) { $this->filesystem->requireOnce($file); $migrationClass = $this->classFinder->findClass($file); $migration = new $migrationClass(); if ($this->option("refresh")) { $migration->down(); } try { $migration->up(); $migrationCount++; } catch (QueryException $ex) { if (!$this->isTableAlreadyExistError($ex)) { throw $ex; } } } $this->enableForeignKeyChecks(); $this->info("{$migrationCount} table(s) migrated."); }