PHP Schema::hasTable Examples

PHP Schema::hasTable - 30 examples found. These are the top rated real world PHP examples of Schema::hasTable extracted from open source projects. You can rate examples to help us improve the quality of examples.

hasTable() public static method

Determine if the given table exists.
public static hasTable ( string $table ) : boolean
$table string
return boolean
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     if (!Schema::hasTable('insurance')) {
         Schema::create('insurance', function ($table) {
             $table->increments('insurance_id');
             $table->bigInteger('pid')->nullable();
             $table->bigInteger('address_id')->nullable();
             $table->string('insurance_plan_name', 255)->nullable();
             $table->string('insurance_order', 255)->nullable();
             $table->string('insurance_id_num', 255)->nullable();
             $table->string('insurance_group', 255)->nullable();
             $table->string('insurance_relationship', 255)->nullable();
             $table->string('insurance_copay', 255)->nullable();
             $table->string('insurance_deductible', 255)->nullable();
             $table->longtext('insurance_comments')->nullable();
             $table->string('insurance_plan_active', 255)->nullable();
             $table->string('insurance_insu_firstname', 255)->nullable();
             $table->string('insurance_insu_lastname', 255)->nullable();
             $table->string('insurance_insu_address', 255)->nullable();
             $table->string('insurance_insu_city', 255)->nullable();
             $table->string('insurance_insu_state', 255)->nullable();
             $table->string('insurance_insu_zip', 255)->nullable();
             $table->string('insurance_insu_phone', 255)->nullable();
             $table->dateTime('insurance_insu_dob')->nullable();
             $table->string('insurance_insu_gender', 255)->nullable();
         });
     }
 }
 public function up()
 {
     if (!Schema::hasTable($this->table)) {
         Schema::create($this->table, function (Blueprint $table) {
             $table->increments('id');
             $table->string('module', 32)->nullable()->index();
             $table->integer('unit_id')->unsigned()->nullable()->index();
             $table->string('language', 16)->nullable()->index();
             /*
             ALTER TABLE `seo` ADD `language` VARCHAR( 16 ) NULL AFTER `unit_id`;
             ALTER TABLE `seo` ADD INDEX ( `language` );
             */
             $table->string('title', 256)->nullable();
             $table->text('description')->nullable();
             $table->text('keywords')->nullable();
             $table->string('url', 256)->nullable()->index();
             $table->string('h1', 256)->nullable();
             $table->timestamps();
             $table->index('module', 'unit_id');
         });
         echo ' + ' . $this->table . PHP_EOL;
     } else {
         echo '...' . $this->table . PHP_EOL;
     }
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     if (!Schema::hasTable('005_044_email_campaign')) {
         Schema::create('005_044_email_campaign', function ($table) {
             $table->engine = 'InnoDB';
             $table->increments('id_044')->unsigned();
             $table->string('name_044');
             $table->integer('email_account_id_044')->unsigned();
             $table->integer('template_id_044')->unsigned()->nullable();
             $table->string('subject_044');
             $table->string('theme_044');
             $table->text('header_044');
             $table->text('body_044');
             $table->text('footer_044');
             $table->text('text_044');
             $table->text('data_044');
             $table->integer('shipping_date_044')->nullable()->unsigned()->default(0);
             $table->string('shipping_date_text_044')->nullable();
             $table->integer('persistence_date_044')->nullable()->unsigned()->default(0);
             $table->string('persistence_date_text_044')->nullable();
             $table->smallInteger('sorting_044')->nullable()->unsigned()->default(0);
             // estado en true, cuando estamos enviando los emails correspondientes a la campaña a cola de envíos
             $table->boolean('processing_044')->default(false);
             // estado en true, cuando todos los correos que tienen que ser enviados a cola de envíos se han enviado
             $table->boolean('created_044')->default(false);
             $table->integer('viewed_044')->unsigned()->default(0);
             $table->foreign('email_account_id_044', 'fk01_005_044_email_campaign')->references('id_013')->on('001_013_email_account')->onDelete('restrict')->onUpdate('cascade');
             $table->foreign('template_id_044', 'fk02_005_044_email_campaign')->references('id_043')->on('005_043_email_template')->onDelete('restrict')->onUpdate('cascade');
         });
     }
 }
 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     // Create the old table
     if (!Schema::hasTable('user_pricelists')) {
         Schema::create('user_pricelists', function (Blueprint $table) {
             $table->increments('id');
             $table->integer('user_id')->unsigned();
             $table->foreign('user_id')->references('id')->on('users');
             $table->integer('pricelist_id')->unsigned();
             $table->foreign('pricelist_id')->references('id')->on('pricelists');
             $table->unique(array('user_id', 'pricelist_id'));
             $table->decimal('paid', 8, 2)->default(0);
             $table->string('transaction_id')->default('Unknown')->nullable();
             $table->string('payment_status')->default('Completed')->nullable();
             $table->text('options')->nullable();
             $table->timestamps();
         });
     }
     // Transfer existing data to old table, at the end of it drop table order_pricelist
     if (Schema::hasTable('user_pricelists') and Schema::hasTable('order_pricelist')) {
         $orders = DB::table('orders')->join('order_pricelist', 'orders.id', '=', 'order_pricelist.order_id')->select('orders.*', 'order_pricelist.pricelist_id')->get();
         foreach ($orders as $item) {
             // Check if user exists
             if (DB::table('users')->where('id', $item->user_id)->count() > 0) {
                 $order_id = DB::table('user_pricelists')->insertGetId(['user_id' => $item->user_id, 'paid' => $item->paid, 'transaction_id' => $item->transaction_id, 'payment_status' => $item->payment_status, 'options' => $item->options, 'created_at' => $item->created_at, 'updated_at' => $item->updated_at, 'pricelist_id' => $item->pricelist_id]);
             }
         }
         Schema::dropIfExists('order_pricelist');
     }
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     if (Schema::hasTable('post_types') == false) {
         Schema::create('post_types', function (Blueprint $table) {
             $table->increments('id');
             $table->timestamps();
             $table->string('name');
         });
     }
     if (Schema::hasTable('posts') == false) {
         Schema::create('posts', function (Blueprint $table) {
             $table->increments('id');
             $table->string('title');
             $table->string('slug');
             $table->string('hero_url')->nullable()->default(NULL);
             $table->text('body');
             $table->text('excerpt')->nullable()->default(NULL);
             $table->integer('user_id');
             $table->integer('post_type_id');
             $table->string('status');
             $table->softDeletes();
             $table->timestamps();
         });
     }
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     if (!Schema::hasTable('staffs_timetable')) {
         Schema::create('staffs_timetable', function (Blueprint $table) {
             $table->increments('id');
             $table->string('period');
             $table->integer('mon')->unsigned()->nullable()->default(null);
             $table->integer('tue')->unsigned()->nullable()->default(null);
             $table->integer('wed')->unsigned()->nullable()->default(null);
             $table->integer('thu')->unsigned()->nullable()->default(null);
             $table->integer('fri')->unsigned()->nullable()->default(null);
             $table->integer('sat')->unsigned()->nullable()->default(null);
             $table->integer('staff_id')->unsigned();
             $table->timestamps();
         });
         Schema::table('staffs_timetable', function (Blueprint $table) {
             $table->foreign('mon')->references('id')->on('courses');
             $table->foreign('tue')->references('id')->on('courses');
             $table->foreign('wed')->references('id')->on('courses');
             $table->foreign('thu')->references('id')->on('courses');
             $table->foreign('fri')->references('id')->on('courses');
             $table->foreign('sat')->references('id')->on('courses');
             $table->foreign('staff_id')->references('id')->on('users')->onDelete('cascade');
         });
     }
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('usuarios', function (Blueprint $table) {
         $table->increments('id');
         $table->string('fbuid', 20);
         $table->string('rut', 20);
         $table->string('firstname', 100);
         $table->string('lastname', 100);
         $table->string('genero', 20);
         $table->string('phone', 20);
         $table->string('address', 200);
         $table->string('email', 200);
         $table->integer('comuna_id')->unsigned();
         $table->string('ip', 20);
         $table->char('complete', 1);
         $table->text('meta', 20);
         $table->text('access_token', 20);
         $table->text('expire_token', 20);
         $table->timestamps();
         #Indices
         $table->index('comuna_id');
         #FK
         if (Schema::hasTable('comunas')) {
             $table->foreign('comuna_id')->references('id')->on('comunas');
         }
     });
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     if (!Schema::hasTable('immunizations')) {
         Schema::create('immunizations', function ($table) {
             $table->increments('imm_id');
             $table->bigInteger('pid')->nullable();
             $table->bigInteger('eid')->nullable();
             $table->string('cpt', 255)->nullable();
             $table->dateTime('imm_date')->nullable();
             $table->string('imm_immunization', 255)->nullable();
             $table->string('imm_sequence', 255)->nullable();
             $table->string('imm_body_site', 255)->nullable();
             $table->string('imm_dosage', 255)->nullable();
             $table->string('imm_dosage_unit', 255)->nullable();
             $table->string('imm_route', 255)->nullable();
             $table->string('imm_elsewhere', 255)->nullable();
             $table->string('imm_vis', 255)->nullable();
             $table->string('imm_lot', 255)->nullable();
             $table->string('imm_manufacturer', 255)->nullable();
             $table->dateTime('imm_expiration')->nullable();
             $table->string('imm_brand', 255)->nullable();
             $table->string('imm_cvxcode', 255)->nullable();
             $table->string('imm_provider', 255)->nullable();
         });
     }
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     if (!Schema::hasTable('004_403_record')) {
         Schema::create('004_403_record', function (Blueprint $table) {
             $table->engine = 'InnoDB';
             $table->increments('id_403')->unsigned();
             $table->integer('form_id_403')->unsigned();
             $table->integer('date_403')->unsigned();
             $table->string('date_text_403', 25);
             $table->integer('state_id_403')->unsigned()->nullable();
             $table->string('subject_403', 255)->nullable();
             $table->string('company_403', 100)->nullable();
             $table->string('name_403', 50)->nullable();
             $table->string('surname_403', 50)->nullable();
             $table->string('email_403', 100)->nullable();
             $table->string('country_id_403', 2)->nullable();
             $table->string('territorial_area_1_id_403', 6)->nullable();
             $table->string('territorial_area_2_id_403', 10)->nullable();
             $table->string('territorial_area_3_id_403', 10)->nullable();
             $table->boolean('opened_403')->default(false);
             $table->boolean('dispatched_403')->default(false);
             $table->text('data_403');
             $table->foreign('form_id_403', 'fk01_004_403_record')->references('id_401')->on('004_401_form')->onDelete('cascade')->onUpdate('cascade');
             $table->foreign('state_id_403', 'fk02_004_403_record')->references('id_400')->on('004_400_state')->onDelete('restrict')->onUpdate('cascade');
             $table->foreign('country_id_403', 'fk03_004_403_record')->references('id_002')->on('001_002_country')->onDelete('restrict')->onUpdate('cascade');
             $table->foreign('territorial_area_1_id_403', 'fk04_004_403_record')->references('id_003')->on('001_003_territorial_area_1')->onDelete('restrict')->onUpdate('cascade');
             $table->foreign('territorial_area_2_id_403', 'fk05_004_403_record')->references('id_004')->on('001_004_territorial_area_2')->onDelete('restrict')->onUpdate('cascade');
             $table->foreign('territorial_area_3_id_403', 'fk06_004_403_record')->references('id_005')->on('001_005_territorial_area_3')->onDelete('restrict')->onUpdate('cascade');
         });
     }
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     if (!Schema::hasTable('sexoffenders')) {
         Schema::create('sexoffenders', function (Blueprint $table) {
             $table->increments('id');
             $table->string('state_name')->index();
             $table->string('state_code')->index();
             $table->string('state_url');
             $table->string('status');
             $table->integer('records_crawled')->unsigned()->default(0);
             $table->integer('records_expected')->unsigned()->default(0);
             $table->enum('crawl_state', ['running', 'stopped', 'paused', 'completed', 'incomplete'])->default('incomplete')->index();
             $table->enum('paused', ['0', '1'])->default('0')->comment = '0-normal, 1-paused';
             $table->timestamp('expected_time')->nullable();
             $table->timestamp('started_at')->nullable();
             $table->timestamp('completed_at')->nullable();
         });
     }
     if (!Schema::hasTable('sexoffenders_stats')) {
         Schema::create('sexoffenders_stats', function (Blueprint $table) {
             $table->increments('id');
             $table->integer('sexoffender_id')->unsigned();
             $table->foreign('sexoffender_id')->references('id')->on('sexoffenders');
             $table->integer('records_crawled')->unsigned()->default(0);
             $table->time('crawl_time');
             $table->time('record_time');
             $table->timestamp('started_at')->nullable();
             $table->timestamp('completed_at')->nullable();
         });
     }
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     if (Schema::hasTable('notifications') || Schema::hasTable('notification_activities')) {
         return;
     }
     /**
      * Create Table Notifications
      */
     Schema::create('notifications', function (Blueprint $table) {
         $table->increments('id');
         $table->text('job');
         $table->text('data');
         $table->timestamps();
         $table->softDeletes();
     });
     /**
      * Create Table for Activities
      */
     Schema::create('notification_activities', function (Blueprint $table) {
         $table->increments('id');
         $table->unsignedInteger('notification_id');
         $table->foreign('notification_id')->references('id')->on('notifications')->onDelete('cascade');
         /**
          * There is no foreign key set, so one can use his own database structure for UserInterface
          */
         $table->unsignedInteger('user_id')->nullable()->default(null)->index();
         $table->string('activity');
         $table->timestamps();
         $table->index(['notification_id', 'user_id']);
     });
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     if (!Schema::hasTable($this->table)) {
         Schema::create($this->table, function (Blueprint $table) {
             $table->engine = 'InnoDB';
             /* Primary Key */
             $table->increments('id');
             /* Main Data*/
             $table->string('fullname');
             $table->string('email')->unique();
             $table->string('no_telp')->nullable();
             $table->string('username')->unique();
             $table->string('password', 255);
             $table->string('image', 255)->nullable();
             $table->text('address')->nullable();
             $table->tinyInteger('status')->default(0);
             $table->rememberToken();
             /* Foreign Key */
             $table->integer('id_group')->unsigned();
             $table->foreign('id_group')->references('id')->on('groups')->onDelete('cascade')->onUpdate('cascade');
             /* Action Data */
             $table->string('created_by')->nullable()->default('system');
             $table->timestamps();
         });
     }
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     if (!Schema::hasTable('users_list')) {
         Schema::create('users_list', function (Blueprint $table) {
             $table->increments('id');
             $table->timestamps();
             $table->softDeletes();
             $table->string('fullname');
             $table->string('email', 40)->unique();
             $table->string('password', 100);
             $table->string('remember_token', 100);
         });
     }
     if (!Schema::hasTable('users_groups')) {
         Schema::create("users_groups", function (Blueprint $table) {
             $table->increments('id');
             $table->timestamps();
             $table->softDeletes();
             $table->string('title', 30);
             $table->integer('level');
         });
     }
     if (!Schema::hasTable('users_per_groups')) {
         Schema::create("users_per_groups", function (Blueprint $table) {
             $table->integer('user_id');
             $table->integer('group_id');
         });
     }
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     if (!Schema::hasTable('orders')) {
         Schema::create('orders', function ($table) {
             $table->bigIncrements('orders_id');
             $table->bigInteger('address_id')->nullable();
             $table->bigInteger('eid')->nullable();
             $table->bigInteger('t_messages_id')->nullable();
             $table->bigInteger('pid')->nullable();
             $table->string('encounter_provider', 255)->nullable();
             $table->timestamp('orders_date')->default(DB::raw('CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP'));
             $table->string('orders_insurance', 255)->nullable();
             $table->longtext('orders_referrals')->nullable();
             $table->longtext('orders_labs')->nullable();
             $table->longtext('orders_radiology')->nullable();
             $table->longtext('orders_cp')->nullable();
             $table->string('orders_referrals_icd', 255)->nullable();
             $table->string('orders_labs_icd', 255)->nullable();
             $table->string('orders_radiology_icd', 255)->nullable();
             $table->string('orders_cp_icd', 255)->nullable();
             $table->string('orders_labs_obtained', 255)->nullable();
             $table->boolean('orders_completed')->nullable();
             $table->bigInteger('id')->nullable();
         });
     }
 }
 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     // drop all table to back to revision
     if (Schema::hasTable('freelancer_info_skill')) {
         Schema::drop('freelancer_info_skill');
     }
     if (Schema::hasTable('freelancer_info')) {
         if (Schema::hasTable('accepted_job_links')) {
             Schema::drop('accepted_job_links');
         }
         if (Schema::hasTable('accepted_job')) {
             Schema::drop('accepted_job');
         }
         if (Schema::hasTable('job_category')) {
             Schema::drop('job_category');
         }
         if (Schema::hasTable('job')) {
             Schema::drop('job');
         }
         if (Schema::hasTable('category')) {
             Schema::drop('category');
         }
         Schema::drop('freelancer_info');
     }
 }
Example #16
0
 /**
  * Generates a seed file.
  *
  * @param  string  $table
  * @return void
  * @throws Adamgoose\SeedGen\TableNotFoundException
  */
 public function generateSeed($table)
 {
     // Check if table exists
     if (!\Schema::hasTable($table)) {
         throw new TableNotFoundException("Table {$table} was not found.");
     }
     // Get the data
     $data = \DB::table($table)->get();
     $dataArray = array();
     foreach ($data as $row) {
         $rowArray = array();
         foreach ($row as $columnName => $columnValue) {
             $rowArray[$columnName] = $columnValue;
         }
         $dataArray[] = $rowArray;
     }
     // Generate class name
     $className = $this->generateClassName($table);
     // Get template for a seed file contents
     $stub = $this->files->get($this->getStubPath() . '/seed.stub');
     // Get a seed folder path
     $seedPath = app_path() . \Config::get('seedgen::path');
     // Save a populated stub
     $this->files->put($this->getPath($className, $seedPath), $this->populateStub($className, $stub, $table, $this->prettifyArray($dataArray)));
     // Update the DatabaseSeeder.php file
     $this->updateDatabaseSeederRunMethod($className);
 }
 protected function createTable($tableName)
 {
     if (!Schema::hasTable($tableName)) {
         Schema::create($tableName, function (Blueprint $table) {
             $table->increments('id');
             $table->string('url')->unique();
             $table->string('title');
             $table->longtext('content');
             $table->string('language')->nullable();
             $table->timestamps();
             $table->softDeletes();
         });
         try {
             DB::statement("ALTER TABLE " . self::TABLE_NAME . " ADD COLUMN searchtext TSVECTOR");
             DB::statement("UPDATE " . self::TABLE_NAME . "\n\t\t\t\t\tSET searchtext = to_tsvector('english', url || '' || title || '' || content)");
             DB::statement("CREATE INDEX searchtext_gin ON " . self::TABLE_NAME . " USING GIN(searchtext)");
             DB::statement("CREATE TRIGGER ts_searchtext\n\t\t\t\t\tBEFORE INSERT OR UPDATE ON " . self::TABLE_NAME . "\n\t\t\t\t\tFOR EACH ROW EXECUTE PROCEDURE\n\t\t\t\t\ttsvector_update_trigger('searchtext', 'pg_catalog.english', 'url', 'title', 'content')");
             echo "TSVECTOR used.\n";
         } catch (QueryException $e) {
             try {
                 DB::statement('ALTER TABLE `' . $tableName . '` ADD FULLTEXT search(url, title, content)');
                 echo "FULLTEXT used.\n";
             } catch (QueryException $e) {
                 echo "FULLTEXT is not supported.\n";
             }
         }
     }
 }
 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     if (Schema::hasTable('cluster')) {
         DB::table('cluster')->delete();
         Schema::drop('cluster');
     }
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     // checking the existence of the user table before adding
     if (!Schema::hasTable('user')) {
         Schema::create('user', function (Blueprint $table) {
             $table->increments('id');
             $table->timestamps();
             $table->string('username');
             $table->string('password');
             $table->integer('rights');
         });
     } else {
         if (!Schema::hasColumn('user', 'username')) {
             Schema::table('user', function ($table) {
                 $table->string('username');
             });
         }
         if (!Schema::hasColumn('user', 'password')) {
             Schema::table('user', function ($table) {
                 $table->string('password');
             });
         }
         if (!Schema::hasColumn('user', 'rights')) {
             Schema::table('user', function ($table) {
                 $table->integer('rights');
             });
         }
     }
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     if (!Schema::hasTable('labs')) {
         Schema::create('labs', function ($table) {
             $table->bigInteger('eid')->primary();
             $table->bigInteger('pid')->nullable();
             $table->string('encounter_provider', 255)->nullable();
             $table->timestamp('labs_date')->default(DB::raw('CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP'));
             $table->string('labs_ua_urobili', 100)->nullable();
             $table->string('labs_ua_bilirubin', 100)->nullable();
             $table->string('labs_ua_ketones', 100)->nullable();
             $table->string('labs_ua_glucose', 100)->nullable();
             $table->string('labs_ua_protein', 100)->nullable();
             $table->string('labs_ua_nitrites', 100)->nullable();
             $table->string('labs_ua_leukocytes', 100)->nullable();
             $table->string('labs_ua_blood', 100)->nullable();
             $table->string('labs_ua_ph', 100)->nullable();
             $table->string('labs_ua_spgr', 100)->nullable();
             $table->string('labs_ua_color', 100)->nullable();
             $table->string('labs_ua_clarity', 100)->nullable();
             $table->string('labs_upt', 100)->nullable();
             $table->string('labs_strep', 100)->nullable();
             $table->string('labs_mono', 100)->nullable();
             $table->string('labs_flu', 100)->nullable();
             $table->string('labs_microscope', 100)->nullable();
             $table->string('labs_glucose', 100)->nullable();
             $table->longtext('labs_other')->nullable();
         });
     }
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     /**
      * Create the variables table
      */
     if (!Schema::hasTable('translations_variables')) {
         Schema::create('translations_variables', function (Blueprint $table) {
             $table->increments('id');
             $table->text('text');
             $table->text('group');
             $table->string('md5sha1', 255);
             $table->boolean('dynamic')->default(0);
             $table->timestamps();
         });
     }
     /**
      * Create the translated table
      */
     if (!Schema::hasTable('translations_translated')) {
         Schema::create('translations_translated', function (Blueprint $table) {
             $table->integer('variable_id')->unsigned();
             $table->integer('language_id')->unsigned();
             $table->text('translation');
             $table->timestamps();
             $table->foreign('variable_id')->references('id')->on('translations_variables')->onUpdate('cascade')->onDelete('cascade');
             $table->foreign('language_id')->references('id')->on('languages')->onUpdate('cascade')->onDelete('cascade');
             $table->primary(['variable_id', 'language_id']);
         });
     }
 }
 /**
  * Run the migrations.
  */
 public function up()
 {
     if (!Schema::hasTable('suppliers')) {
         Schema::create('suppliers', function (Blueprint $table) {
             $table->increments('id');
             $table->string('name');
             $table->string('shortname');
             $table->string('address')->nullable();
             $table->string('postal_code')->nullable();
             $table->string('zip_code')->nullable();
             $table->string('region')->nullable();
             $table->string('city')->nullable();
             $table->string('country')->nullable();
             $table->string('contact_title')->nullable();
             $table->string('contact_name')->nullable();
             $table->string('contact_phone')->nullable();
             $table->string('contact_fax')->nullable();
             $table->string('contact_email')->nullable();
             $table->text('website')->nullable();
             $table->boolean('producer')->default(0);
             $table->integer('supplied_by')->default(0);
             $table->timestamp('created_at')->default(\DB::raw('CURRENT_TIMESTAMP'));
             $table->timestamp('updated_at')->default(\DB::raw('CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP'));
         });
     }
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     if (!Schema::hasTable('rx_list')) {
         Schema::create('rx_list', function ($table) {
             $table->increments('rxl_id');
             $table->bigInteger('pid')->nullable();
             $table->dateTime('rxl_date_active')->nullable();
             $table->dateTime('rxl_date_prescribed')->nullable();
             $table->string('rxl_medication', 255)->nullable();
             $table->string('rxl_dosage', 255)->nullable();
             $table->string('rxl_dosage_unit', 255)->nullable();
             $table->string('rxl_sig', 255)->nullable();
             $table->string('rxl_route', 255)->nullable();
             $table->string('rxl_frequency', 255)->nullable();
             $table->string('rxl_instructions', 255)->nullable();
             $table->string('rxl_quantity', 255)->nullable();
             $table->string('rxl_refill', 255)->nullable();
             $table->string('rxl_reason', 255)->nullable();
             $table->dateTime('rxl_date_inactive')->nullable();
             $table->dateTime('rxl_date_old')->nullable();
             $table->string('rxl_provider', 255)->nullable();
             $table->bigInteger('id')->nullable();
             $table->string('rxl_dea', 255)->nullable();
             $table->string('rxl_daw', 255)->nullable();
             $table->string('rxl_license', 255)->nullable();
             $table->integer('rxl_days')->nullable();
             $table->dateTime('rxl_due_date')->nullable();
             $table->string('rcopia_sync', 4)->nullable();
             $table->string('rxl_ndcid', 11)->nullable();
         });
     }
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     if (!Schema::hasTable('encounters')) {
         Schema::create('encounters', function ($table) {
             $table->bigIncrements('eid');
             $table->bigInteger('pid')->nullable();
             $table->bigInteger('appt_id')->nullable();
             $table->string('encounter_provider', 255)->nullable();
             $table->timestamp('encounter_date')->default(DB::raw('CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP'));
             $table->string('encounter_signed', 4)->nullable();
             $table->timestamp('date_signed')->default("0000-00-00 00:00:00");
             $table->dateTime('encounter_DOS')->nullable();
             $table->string('encounter_age', 100)->nullable();
             $table->string('encounter_type', 100)->nullable();
             $table->string('encounter_location', 100)->nullable();
             $table->string('encounter_activity', 100)->nullable();
             $table->longtext('encounter_cc')->nullable();
             $table->string('encounter_condition', 255)->nullable();
             $table->string('encounter_condition_work', 4)->nullable();
             $table->string('encounter_condition_auto', 4)->nullable();
             $table->string('encounter_condition_auto_state', 2)->nullable();
             $table->string('encounter_condition_other', 4)->nullable();
             $table->string('bill_submitted', 4)->nullable();
             $table->string('addendum', 4)->nullable();
             $table->bigInteger('addendum_eid')->nullable();
             $table->integer('user_id')->nullable();
             $table->string('encounter_role', 255)->nullable();
             $table->string('referring_provider', 255)->nullable();
             $table->integer('practice_id')->nullable();
             $table->string('referring_provider_npi', 255)->nullable();
         });
     }
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     // When unit testing we need to create a table for users since there will be no users table to alter
     if (!Schema::hasTable('users')) {
         Schema::create('users', function (Blueprint $table) {
             $table->increments('id');
             $table->string('email')->unique()->nullable();
             $table->string('password')->nullable();
             $table->rememberToken();
             $table->timestamps();
         });
     }
     Schema::table('users', function (Blueprint $table) {
         if (Schema::hasColumn('users', 'name')) {
             $table->string('name')->nullable()->change();
         }
         if (!Schema::hasColumn('users', 'first_name')) {
             $table->string('first_name')->nullable();
         }
         if (!Schema::hasColumn('users', 'first_name')) {
             $table->string('last_name')->nullable();
         }
         if (!Schema::hasColumn('users', 'first_name')) {
             $table->string('display_name')->nullable();
         }
         if (!Schema::hasColumn('users', 'first_name')) {
             $table->string('url')->nullable();
         }
         if (!Schema::hasColumn('users', 'first_name')) {
             $table->json('social_media')->nullable();
         }
         if (!Schema::hasColumn('users', 'first_name')) {
             $table->string('address')->nullable();
         }
         if (!Schema::hasColumn('users', 'first_name')) {
             $table->string('city')->nullable();
         }
         if (!Schema::hasColumn('users', 'first_name')) {
             $table->string('country')->nullable();
         }
         if (!Schema::hasColumn('users', 'first_name')) {
             $table->text('bio')->nullable();
         }
         if (!Schema::hasColumn('users', 'first_name')) {
             $table->string('job')->nullable();
         }
         if (!Schema::hasColumn('users', 'first_name')) {
             $table->string('phone')->nullable();
         }
         if (!Schema::hasColumn('users', 'first_name')) {
             $table->string('gender', 140)->nullable();
         }
         if (!Schema::hasColumn('users', 'first_name')) {
             $table->string('relationship', 140)->nullable();
         }
         if (!Schema::hasColumn('users', 'first_name')) {
             $table->date('birthday')->nullable();
         }
     });
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     if (Schema::hasTable('patients')) {
         DB::statement('ALTER TABLE patients ENGINE = InnoDB');
     }
     if (!Schema::hasTable('patients')) {
         Schema::create('patients', function (Blueprint $table) {
             $table->engine = 'InnoDB';
             $table->increments('id');
             $table->integer('patient_no');
             $table->string('lastname');
             $table->string('firstname');
             $table->string('address')->nullable();
             $table->string('contact')->nullable();
             $table->string('email')->nullable();
             $table->string('gender')->nullable();
             $table->date('birthday')->nullable();
             $table->string('bloodtype')->nullable();
             $table->string('occupancy')->nullable();
             $table->string('status')->nullable();
             $table->string('contact_person')->nullable();
             $table->timestamps();
             $table->softDeletes();
         });
     }
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     if (Schema::hasTable('phpbb_sessions')) {
         return;
     }
     Schema::create('phpbb_sessions', function ($table) {
         $table->collation = 'utf8_bin';
         $table->charset = 'utf8';
         $table->string('session_id', 32)->default('');
         $table->mediumInteger('session_user_id')->unsigned()->default(0);
         $table->integer('session_last_visit')->unsigned()->default(0);
         $table->integer('session_start')->unsigned()->default(0);
         $table->integer('session_time')->unsigned()->default(0);
         $table->string('session_ip', 40)->default('');
         $table->string('session_forwarded_for')->default('');
         $table->string('session_page')->default('');
         $table->boolean('session_viewonline')->unsigned()->default(1);
         $table->boolean('session_autologin')->unsigned()->default(0);
         $table->boolean('session_admin')->unsigned()->default(0);
         $table->boolean('verified')->default(0);
         $table->primary('session_id');
         $table->index(['session_time', 'session_page'], 'time_page');
         $table->index(['session_autologin', 'session_time'], 'autologin_time_purge');
         $table->index(['session_user_id', 'session_time'], 'session_user_id_time');
     });
     DB::statement('ALTER TABLE phpbb_sessions ROW_FORMAT=DYNAMIC');
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     if (!Schema::hasTable('assessment')) {
         Schema::create('assessment', function ($table) {
             $table->bigInteger('eid')->primary();
             $table->bigInteger('pid')->nullable();
             $table->string('encounter_provider', 255)->nullable();
             $table->timestamp('assessment_date')->default(DB::raw('CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP'));
             $table->string('assessment_icd1', 20)->nullable();
             $table->string('assessment_icd2', 20)->nullable();
             $table->string('assessment_icd3', 20)->nullable();
             $table->string('assessment_icd4', 20)->nullable();
             $table->string('assessment_icd5', 20)->nullable();
             $table->string('assessment_icd6', 20)->nullable();
             $table->string('assessment_icd7', 20)->nullable();
             $table->string('assessment_icd8', 20)->nullable();
             $table->longtext('assessment_1')->nullable();
             $table->longtext('assessment_2')->nullable();
             $table->longtext('assessment_3')->nullable();
             $table->longtext('assessment_4')->nullable();
             $table->longtext('assessment_5')->nullable();
             $table->longtext('assessment_6')->nullable();
             $table->longtext('assessment_7')->nullable();
             $table->longtext('assessment_8')->nullable();
             $table->longtext('assessment_other')->nullable();
             $table->longtext('assessment_ddx')->nullable();
             $table->longtext('assessment_notes')->nullable();
         });
     }
 }
 /**
  * Reverse the migrations.
  *
  * @return void
  */
 public function down()
 {
     // drop table for back to revision
     if (Schema::hasTable('user_info')) {
         Schema::drop('user_info');
     }
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     if (!Schema::hasTable('teams')) {
         // Create Teams Table...
         Schema::create('teams', function (Blueprint $table) {
             $table->increments('id');
             $table->integer('owner_id')->index();
             $table->string('name');
             $table->timestamps();
         });
     }
     if (!Schema::hasTable('user_teams')) {
         // Create User Teams Intermediate Table...
         Schema::create('user_teams', function (Blueprint $table) {
             $table->integer('team_id');
             $table->integer('user_id');
             $table->string('role', 25);
             $table->unique(['team_id', 'user_id']);
         });
     }
     if (!Schema::hasTable('user_teams')) {
         // Create Invitations Table...
         Schema::create('user_teams', function (Blueprint $table) {
             $table->increments('id');
             $table->integer('team_id')->index();
             $table->integer('user_id')->nullable()->index();
             $table->string('email');
             $table->string('token', 40)->unique();
             $table->timestamps();
         });
     }
 }