id(); $table->string('username'); $table->string('password')->nullable(); $table->string('phone')->nullable(); $table->string('name')->nullable(); $table->string('avatar')->nullable(); $table->decimal('balance', 12, 2)->default(0)->comment('余额'); $table->string('invite_code')->comment('邀请码'); $table->unsignedBigInteger('inviter_id')->nullable()->comment('邀请人'); $table->string('inviter_path')->nullable()->comment('所有上级邀请人'); $table->timestamps(); $table->comment('用户表'); }); Schema::create('user_socialites', function (Blueprint $table) { $table->id(); $table->unsignedBigInteger('user_id'); $table->string('type'); $table->string('openid'); $table->string('unionid')->nullable(); $table->json('data')->nullable(); $table->timestamps(); $table->comment('用户-第三方登录'); }); Schema::create('user_balance_logs', function (Blueprint $table) { $table->id(); $table->unsignedBigInteger('user_id'); $table->string('cate')->comment('类别'); $table->string('description')->comment('描述'); $table->decimal('amount', 12, 2)->comment('变动数量, 正数为增加, 负数为减少'); $table->decimal('balance', 12, 2)->comment('变更后的余额'); $table->string('remarks')->nullable()->comment('备注'); $table->nullableMorphs('source'); $table->timestamps(); $table->comment('用户-余额流水记录'); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('user_balance_logs'); Schema::dropIfExists('user_socialites'); Schema::dropIfExists('users'); } };