Create a new migration.

@return void
973777
protected function createMigration()
	{
		$data = ['table' => $this->argument('table'), 'attachment' => $this->argument('attachment')];
		$prefix = date('Y_m_d_His');
		$path = app_path() . '/database/migrations';

		if (!is_dir($path)) mkdir($path);

		$fileName  = $path . '/' . $prefix . '_add_' . $data['attachment'] . '_fields_to_' . $data['table'] . '_table.php';
		$data['className'] = 'Add' . ucfirst($data['attachment']) . 'FieldsTo' . ucfirst(Str::camel($data['table'])) . 'Table';

		// Save the new migration to disk using the laraclip migration view.
		$migration = View::make('laraclip::migration', $data)->render();
		File::put($fileName, $migration);

		// Dump the autoloader and print a created migration message to the console.
		$this->call('dump-autoload');
		$this->info("Created migration: $fileName");
	}
557605
public function up()
    {
        Schema::create('product__products', function (Blueprint $table) {
            $table->engine = 'InnoDB';
            $table->increments('id');
            // product type
            $table->string('type');
            // product category
            $table->integer('category_id')->unsigned();
            // product info
            $table->string('sku')->nullable();
            // product price
            $table->integer('price')->unsigned();
            $table->integer('sale_price')->unsigned();
            $table->integer('min_order_limit');
            $table->integer('max_order_limit');
            // stock management
            $table->tinyInteger('use_stock');
            // tax
            $table->tinyInteger('use_tax');
            // etc
            $table->tinyInteger('use_review')->unsigned();
            // shipping
            $table->string('shipping_method_id')->nullable();
            $table->integer('shipping_storage_id')->unsigned();
            // status
            $table->enum('status',['active','hide','inactive'])->default('active');

            $table->timestamps();
        });

        Schema::create('product__product_translations', function (Blueprint $table) {
            $table->engine = 'InnoDB';
            $table->increments('id');

            $table->string('name');
            $table->text('content')->nullable();
            $table->text('description')->nullable();

            $table->integer('product_id')->unsigned();
            $table->string('locale')->index();
            $table->unique(['product_id', 'locale']);
            $table->foreign('product_id')->references('id')->on('product__products')->onDelete('cascade');
        });

    }
271364
public function up()
    {

        Schema::create('User', function (Blueprint $table) {
            $table->increments('id');
            $table->string('username', 25)->nullable()->unique();
            $table->string('password', 60)->nullable();
            $table->string('first_name', 25);
            $table->string('last_name', 25);
            $table->string('email')->unique();
            $table->text('description')->nullable();
            $table->timestamp('birthday')->nullable();
            $table->string('pic')->nullable();
            $table->integer('gender');
            $table->tinyInteger('status');
            $table->string('ip', 15);
            $table->tinyInteger('staff');
            $table->tinyInteger('force_new_password');
            $table->timestamp('last_login')->nullable();
            $table->text('permissions')->nullable();
            $table->rememberToken();
            $table->timestamps();
            $table->softDeletes();
            $table->creation();
        });

        Schema::table('User', function (Blueprint $table) {
            $table->creationRelation();
        });

        Schema::create('Visits', function (Blueprint $table) {
            $table->increments('id');
            $table->string('url')->nullable();
            $table->string('ip', 15)->nullable();
            $table->string('browser')->nullable();
            $table->tinyInteger('checked');

            $table->string('isoCode')->nullable();
            $table->string('country')->nullable();
            $table->string('city')->nullable();
            $table->string('state')->nullable();
            $table->string('postal_code')->nullable();
            $table->string('lat')->nullable();
            $table->string('lon')->nullable();
            $table->string('timezone')->nullable();
            $table->string('continent')->nullable();
            $table->timestamps();
        });

        Schema::create('Logs', function (Blueprint $table) {
            $table->increments('id');
            $table->text('log');
            $table->integer('target')->nullable();
            $table->string('ip', 15)->nullable();
            $table->timestamps();
            $table->creation();
        });

        Schema::table('Logs', function (Blueprint $table) {
            $table->creationRelation();
        });

        Schema::create('Settings', function (Blueprint $table) {
            $table->increments('id');
            $table->string('friendly_name', 25);
            $table->string('name', 25);
            $table->string('value', 150)->nullable();
            $table->string('description', 250)->nullable();
            $table->timestamps();
            $table->creation();
        });

        Schema::table('Settings', function (Blueprint $table) {
            $table->creationRelation();
        });

        Schema::create('Group', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name', 25);
            $table->string('description', 250)->nullable();
            $table->string('slug', 250);
            $table->text('permissions')->nullable();

            $table->timestamps();
            $table->softDeletes();
            $table->creation();

            $table->unique('slug');
        });

        Schema::table('Group', function (Blueprint $table) {
            $table->creationRelation();
        });

        Schema::create('Group_User', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('user')->unsigned();
            $table->integer('group')->unsigned();

            $table->timestamps();
            $table->softDeletes();
            $table->creation();

            $table->foreign('user')->references('id')->on('User');
            $table->foreign('group')->references('id')->on('Group');
        });

        Schema::table('Group_User', function (Blueprint $table) {
            $table->creationRelation();
        });

        Schema::create('ActivityFeed', function (Blueprint $table) {
            $table->increments('id');
            $table->string('added_by', 150);
            $table->text('activity');
            $table->string('icon', 100);
            $table->string('link', 250)->nullable();
            $table->text('permissions')->nullable();

            $table->timestamps();
        });

    }
978846
public function up()
    {
        Schema::create($this->table, function (Blueprint $table) {
            $table->increments('id');
            $table->string($this->key)->index();
            $table->text($this->value);
        });
    }
1178543
public function up()
    {
        Schema::create(
            'contents',
            function (Blueprint $table) {
                $table->increments('id');
                $table->timestamps();
            }
        );

        Schema::create(
            'revisions',
            function (Blueprint $table) {
                $table->increments('id');
                $table->unsignedInteger('language_id');
                $table->unsignedInteger('content_id');
                $table->timestamps();

                $table->foreign('language_id')->references('id')->on('languages');
                $table->foreign('content_id')->references('id')->on('contents');
            }
        );

        Schema::create(
            'field_string',
            function (Blueprint $table) {
                $this->fieldTableFields($table);
                $table->string('value');
            }
        );

        Schema::create(
            'field_text',
            function (Blueprint $table) {
                $this->fieldTableFields($table);
                $table->text('value');
            }
        );

        Schema::create(
            'field_date',
            function (Blueprint $table) {
                $this->fieldTableFields($table);
                $table->date('value');
            }
        );

        Schema::create(
            'field_datetime',
            function (Blueprint $table) {
                $this->fieldTableFields($table);
                $table->datetime('value');
            }
        );

        Schema::create(
            'field_entity',
            function (Blueprint $table) {
                $this->fieldTableFields($table);
                $table->unsignedInteger('value');
                $table->foreign('value')->references('id')->on('contents');
            }
        );
    }
384776
public function up()
    {
        $tableNames = config('permission.table_names');

        Schema::create($tableNames['permissions'], function (Blueprint $table) {
            $table->increments('id');
            $table->string('name');
            $table->string('guard_name');
            $table->timestamps();
        });

        Schema::create($tableNames['roles'], function (Blueprint $table) {
            $table->increments('id');
            $table->string('name');
            $table->string('guard_name');
            $table->timestamps();
        });

        Schema::create($tableNames['model_has_permissions'], function (Blueprint $table) use ($tableNames) {
            $table->integer('permission_id')->unsigned();
            $table->morphs('model');

            $table->foreign('permission_id')
                ->references('id')
                ->on($tableNames['permissions'])
                ->onDelete('cascade');

            $table->primary(['permission_id', 'model_id', 'model_type'], 'model_has_permissions_pk');
        });

        Schema::create($tableNames['model_has_roles'], function (Blueprint $table) use ($tableNames) {
            $table->integer('role_id')->unsigned();
            $table->morphs('model');

            $table->foreign('role_id')
                ->references('id')
                ->on($tableNames['roles'])
                ->onDelete('cascade');

            $table->primary(['role_id', 'model_id', 'model_type'], 'model_has_roles_pk');
        });

        Schema::create($tableNames['role_has_permissions'], function (Blueprint $table) use ($tableNames) {
            $table->integer('permission_id')->unsigned();
            $table->integer('role_id')->unsigned();

            $table->foreign('permission_id')
                ->references('id')
                ->on($tableNames['permissions'])
                ->onDelete('cascade');

            $table->foreign('role_id')
                ->references('id')
                ->on($tableNames['roles'])
                ->onDelete('cascade');

            $table->primary(['permission_id', 'role_id'], 'role_has_permissions_pk');

            app('cache')->forget('spatie.permission.cache');
        });
    }
1363782
public function createMigrationsTable()
	{
		SchemaManager::table('migrations')->create(function($scheme) {
			$scheme->integer('id', 11, false, true, ['primary' => true]);
			$scheme->varchar('class_name', 255, false);
			$scheme->varchar('status', 25, false);
			$scheme->varchar('path', 255, false);
		});
	}
877540
public function migrate()
	{
		$this->msg( sprintf( 'Add new type columns for Laravel' ), 0 );
		$this->status( '' );

		foreach( $this->tables as $rname => $list ) {
			$this->addColumn( $rname, $list );
		}

		$this->msg( sprintf( 'Drop old unique indexes for Laravel' ), 0 );
		$this->status( '' );

		foreach( $this->constraints as $rname => $list ) {
			$this->dropIndex( $rname, $list );
		}

		$this->msg( sprintf( 'Migrate typeid to type for Laravel' ), 0 );
		$this->status( '' );

		foreach( $this->migrations as $rname => $list ) {
			$this->migrateData( $rname, $list );
		}
	}
888822
public function up()
    {
    	if (Schema::hasTable('users')) {

    		Schema::table('users', function (Blueprint $table) {
	            
	            if (!Schema::hasColumn('users', 'is_admin')) {

	            	$table->tinyInteger('is_admin')->default(0)->comment('1: admin, 0: not is admin');
	            }

	            if (!Schema::hasColumn('users', 'name')) {
	            	$table->string('name');
	            }
	            
	            if (!Schema::hasColumn('users', 'email')) {
	            	$table->string('email')->unique();
	            }

	            if (!Schema::hasColumn('users', 'password')) {
	            	$table->string('password');
	            }

	            if (!Schema::hasColumn('users', 'remember_token')) {
	            	$table->rememberToken();
	            }


	        });
    	}

    	else {

    		Schema::create('users', function (Blueprint $table) {
	            $table->increments('id');
	            $table->string('name');
	            $table->string('email')->unique();
	            $table->string('password');
	            $table->tinyInteger('is_admin')->default(0)->comment('1: admin, 0: not is admin');
	            $table->rememberToken();
	            $table->timestamps();
	        });
    	}
        
    }
490071
public function up()
    {
        Schema::create('tags', function($table) {
            $table->increments('id');
            $table->string('name');
            $table->string('slug');
            $table->timestamps();
            $table->softDeletes();
        });
        Schema::create('categories', function($table) {
            $table->increments('id');
            $table->string('name');
            $table->string('slug');
            $table->string('image');
            $table->timestamps();
            $table->softDeletes();
        });
        Schema::create('taggables', function($table) {
            $table->increments('id');
            $table->integer('tag_id')->unsigned();
            $table->morphs('taggables');
            $table->foreign('tag_id')->references('id')->on('tags')->onDelete('cascade');
        });
        Schema::create('categoryables', function($table) {
            $table->increments('id');
            $table->integer('category_id')->unsigned();
            $table->morphs('categoryables');
            $table->foreign('category_id')->references('id')->on('categories')->onDelete('cascade');
        });
        Schema::create('articles', function($table){
            $table->increments('id');
            $table->integer('user_id')->unsigned();
            $table->string('title');
            $table->string('slug');
            $table->text('intro');
            $table->longText('body');
            $table->string('image');
            $table->boolean('published');
            $table->timestamps();
            $table->softDeletes();
            $table->index('slug');
        });
    }
334529
public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->increments('id');
            $table->string('first_name', 60);
            $table->string('last_name', 60);
            $table->string('nickname', 60)->unique();
            $table->string('email', 100)->unique();
            $table->string('password', 60);
            $table->enum('role', Roles::allowed())->default(Roles::default());
            $table->string('phone_number', 20)->nullable();
            $table->enum('gender', ['female', 'male'])->default('male');
            $table->date('birthday')->nullable();
            $table->text('image')->nullable();
            $table->string('facebook', 100)->nullable();
            $table->string('twitter', 100)->nullable();
            $table->string('website', 100)->nullable();
            $table->string('language', 10)->default('en');
            $table->string('time_zone', 60)->nullable();
            $table->string('description', 150)->nullable();
            $table->integer('rate_val')->nullable();
            $table->integer('rate_count')->nullable();
            $table->json('preferences')->nullable()->default(null);
            $table->boolean('verified')->default(false);
            $table->string('confirmation_token', 60)->nullable();

            $table->rememberToken();
            $table->timestamps();
            $table->timestamp('disabled_at')->nullable();
            $table->softDeletes();
        });
    }
210177
public function up()
    {
        Schema::create('translation_groups', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name')->unique();
            $table->string('description')->nullable()->default(NULL);
            $table->timestamps();
        });

        Schema::create('translations', function (Blueprint $table) {
            $table->increments('id');
            $table->string('language', 10);
            $table->string('key', 100);
            $table->text('value')->nullable()->default(NULL);
            $table->integer('parent')->unsigned()->nullable()->default(NULL);
            $table->integer('translation_group')->unsigned();
            $table->boolean('flagged')->nullable()->default(NULL);
            $table->timestamps();

            $table->unique(['language', 'key', 'translation_group', 'parent']);

            $table->foreign('parent')->references('id')->on('translations')->onDelete('SET NULL');
            $table->foreign('translation_group')->references('id')->on('translation_groups')->onDelete('cascade');
        });
    }
1350716
public function up()
    {
        Schema::create('posts', function (Blueprint $table) {
            $table->increments('id');

            $table->string('title');
            $table->string('slug');
            $table->string('category')->nullable();
            $table->text('excerpt')->nullable();
            $table->longText('content')->nullable();
            $table->longText('featured_media')->nullable();
            $table->timestamp('published_at')->nullable();

            $table->integer('author_user_id')->unsigned()->nullable();

            $table->foreign('author_user_id')
                ->references('id')
                ->on('users')
                ->onDelete('cascade')
                ->onUpdate('cascade');

            $table->nullableTimestamps();
            $table->softDeletes();
        });
    }
451233
public function up()
    {
        if ( ! Schema::hasTable('provinces')) {
            Schema::create('provinces', function(Blueprint $table) {
                $table->increments('id');
                $table->string('province', 50);

                $table->engine = 'InnoDB';
            });
        }

        if ( ! Schema::hasTable('counties')) {
            Schema::create('counties', function(Blueprint $table) {
                $table->increments('id');
                $table->unsignedInteger('province_id');
                $table->foreign('province_id')->references('id')->on('provinces')->onDelete('cascade');
                $table->string('county', 75);

                $table->engine = 'InnoDB';
            });
        }

        if ( ! Schema::hasTable('districts')) {
            Schema::create('districts', function(Blueprint $table) {
                $table->increments('id');
                $table->unsignedInteger('county_id');
                $table->foreign('county_id')->references('id')->on('counties')->onDelete('cascade');
                $table->string('district', 75);

                $table->engine = 'InnoDB';
            });
        }

        if ( ! Schema::hasTable('neighborhoods')) {
            Schema::create('neighborhoods', function(Blueprint $table) {
                $table->increments('id');
                $table->unsignedInteger('district_id');
                $table->foreign('district_id')->references('id')->on('districts')->onDelete('cascade');
                $table->string('neighborhood', 150);

                $table->engine = 'InnoDB';
            });
        }

        if ( ! Schema::hasTable('postal_codes')) {
            Schema::create('postal_codes', function(Blueprint $table) {
                $table->increments('id');
                $table->unsignedInteger('neighborhood_id');
                $table->foreign('neighborhood_id')->references('id')->on('neighborhoods')->onDelete('cascade');
                $table->char('postal_code', 6);

                $table->engine = 'InnoDB';
            });
        }
    }
537735
public function up()
    {
        Schema::create($this->table, function (Blueprint $table) {
            $table->increments('id');
            $table->string('action');

            $table->string('table_name');

            $table->string('revisionable_type')->nullable();
            $table->integer('revisionable_id')->unsigned();

            $table->unsignedInteger('user_id')->nullable();

            $table->binary('old')->nullable();
            $table->binary('new')->nullable();

            $table->string('ip')->nullable();
            $table->string('ip_forwarded')->nullable();

            $table->timestamps();

            $table->index('action');
            $table->index('user_id');
            $table->index(['revisionable_type', 'revisionable_id']);
        });
    }
751003
public static function migrate() {
        $connection = \DLModel::getConnectionResolver()->connection();
        if ($connection->getPdo()) {
            $builder = $connection->getSchemaBuilder();
            if (!$builder->hasTable('modules')) {
                foreach (glob(__DIR__ . '/../../migrations/app/*.php') as $file) {
                    $migration = require($file);
                    if (is_array($migration)) {
                        $builder->create($connection->getTablePrefix() . key($migration), current($migration));
                    }
                }
            }
        }
    }
1258052
public function generateMigration()
    {
        if (!$this->confirm('Do you want to create a migration?')) {
            return;
        }

        $this->console->call('generate:migration', [
            'name' => "create_{$this->getEntities()}_table",
            '--fields' => $this->console->option('fields'),
            '--force' => $this->console->option('force'),
        ]);
    }