laravel-数据迁移

1.创建迁移文件

php artisan make:migration create_sys_admin_table

2.编写表结构

    public function up()
    {
        Schema::create('sys_admin', function (Blueprint $table) {
            $table->engine = 'InnoDB';
            $table->bigIncrements('id');
            $table->string('name', '24')->comment('昵称')->default('');
            $table->string('account', '24')->comment('账号')->default('');
            $table->string('password')->comment('密码')->default('');
            $table->tinyInteger('status')->unsigned()->comment('状态 1-开启,0-禁用')->default(1);
            $table->integer('created_at')->unsigned()->default(0);
            $table->integer('updated_at')->unsigned()->default(0);
            $table->integer('deleted_at')->unsigned()->nullable();
        });
    }

3.执行命令,创建数据表

php artisan migrate

 

posted @ 2022-06-23 15:40  CanyingV  阅读(69)  评论(0编辑  收藏  举报