<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AlertCmdsuserOrgNurseOfficeAddDocterVerify extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('nurses',function (Blueprint $table){
            $table->integer('stock')->nullable(false)->comment('库存')->after('price');
            $table->integer('used')->nullable()->comment('已使用')->after('stock');
        });

        Schema::table('organizations', function (Blueprint $table) {
            $table->integer('cdms_id')->after('id')->comment('后台账号id')->nullable();
        });

        Schema::table('cdms_users', function (Blueprint $table) {
            $table->integer('org_id')->after('password')->comment('机构id')->nullable();
        });
        Schema::table('offices', function (Blueprint $table) {
            $table->integer('org_id')->after('id')->comment('机构id');
        });
//        Schema::table('nurses',function (Blueprint $table){
//            $table->integer('stock')->nullable(false)->comment('库存')->after('price');
//            $table->integer('used')->nullable()->comment('已使用')->after('stock');
//        });
//
//        Schema::table('organizations', function (Blueprint $table) {
//            $table->integer('cdms_id')->after('id')->comment('后台账号id')->nullable();
//        });
//
//        Schema::table('cdms_users', function (Blueprint $table) {
//            $table->integer('org_id')->after('password')->comment('机构id')->nullable();
//        });
//        Schema::table('offices', function (Blueprint $table) {
//            $table->integer('org_id')->after('id')->comment('机构id');
//        });

        Schema::create('docter_verify',function (Blueprint $table){
            $table->bigIncrements('id')->comment('自增id');
            $table->integer('docter_id')->nullable(false)->comment('医生id');
            $table->integer('org_id')->nullable(false)->comment('社区id');
            $table->integer('status')->nullable(false)->comment('状态 1 待审核 2 社区审核通过 3 后台审核通过 4审核失败')->default(1);
            $table->dateTime('created_at')->comment('创建时间');
            $table->dateTime('updated_at')->comment('跟新时间');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::table('nurses', function (Blueprint $table) {
            $table->dropColumn('stock');
            $table->dropColumn('used');
        });

        Schema::table('organizations', function (Blueprint $table) {
            $table->dropColumn('cdms_id');
        });

        Schema::table('cdms_users', function (Blueprint $table) {
            $table->dropColumn('org_id');
        });
//        Schema::table('nurses', function (Blueprint $table) {
//            $table->dropColumn('stock');
//            $table->dropColumn('used');
//        });
//
//        Schema::table('organizations', function (Blueprint $table) {
//            $table->dropColumn('cdms_id');
//        });
//
//        Schema::table('cdms_users', function (Blueprint $table) {
//            $table->dropColumn('org_id');
//        });

        Schema::dropIfExists('docter_verify');
    }
}
