2016.01.22

一、Laravel 数据库 Schema Builder

2016.01.22_第1张图片
php artisan
2016.01.22_第2张图片
migrations

$table->increments('id');//设置主键自增ID

重命名:Schema::rename($form,$to);

指定数据库连接

Schema::connection('foo')->create('tests',function(Blueprint $table){

           $table->increaments('id');

});

删除表

Schema::drop('test');

Schema::dropIfExists('test');

修改表

php artisan make:migration alter_cards_title_to_name --table=cards

Schema::table('cards',function($table){

                         $table->string('name',50)->change();

});

Schema::table('cards',function($table){

                        $table->string('name',50)->nullable()->change();

});

添加外键

$table->integer('user_id')->unsigned();

$table->foreign('user_id')->references('id')->on('users');

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

删除外键

$table->dropForeign('posts_user_id_foreign');

定义存储引擎

Schema::create('users',function($table){

           $table->engine='InnoDB';

           $table->string('email');

});

二、centOS下安装git仓库

1、创建 git用户组和用户

groupadd git

useradd -g git gituser //gituser指定到git组

adduser git2

usermod -G git git2

useradd -g git git3

groups  当前权限的所有用户组

cat /etc/passwd    所有用户信息

cat /etc/group     所有用户组

userdel -r name 删除用户


ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDF6Fx1Rf2ihxuMnlUdOx1zx3o/oPOyH1WNpNmLx1JwaTbGPpLNr+pl8pee580IXmRxMvAHvOwvHUdstm/aZJiFyQJVrILqYaN52eJsIKc1KvFNFQpOad7tyi0TqllIIOVOWi+3uMZ4Bi9c5+rrrV4cjN+m8h+kvv6pyX0XBnvHWPHyle5X32YLEFVCJATj/6xfsxkX8Pvt3FDdMSuUaQppbEAu7tNDxBf9XqaIqHnl1O0m8FJCU3NCCWAuUC+TmJXW+h6yQZEdzUrwxLi/0iLjA2H2n76a4VHhrbmPCiSQPKo/bbQ/dOqA3puFi5yYaq2WHRtynizpeZUIeyhjmfch you@homestead

你可能感兴趣的:(2016.01.22)