Lanka Developers Community

    Lanka Developers

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Shop

    can not run migration

    Back-End Development
    lara
    3
    5
    676
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • hashan
      hashan Web Development last edited by

      public function up()
      {
          Schema::create('registerusers', function (Blueprint $table) {
              $table->increments('id');
              $table->string('firstname', 10);
              $table->string('lastname', 20);
              $table->integer('phone', 10);
              $table->string('email')->unique();
              $table->string('gender');
              $table->string('vehiclemodel');
              $table->string('platenum', 6);
              $table->timestamps();
          });
      }
      

      Erroris : Illuminate\Database\QueryException : SQLSTATE[42000]: Syntax error or access violation: 1075 Incorrect table definition; there can be only one auto column and it must be defined as a key

      1 Reply Last reply Reply Quote 1
      • Nubelle
        Nubelle Web Development last edited by

        othana tiyena integer eka unsigned karana

        $table->integer('phone',10)->unsigned();

        1 Reply Last reply Reply Quote 0
        • hashan
          hashan Web Development last edited by

          SQLSTATE[HY000]: General error: 1364 Field 'username' doesn't have a default value (SQL: insert into registerusers (updated_at, created_at) values (2019-07-15 12:03:06, 2019-07-15 12:03:06))
          menna me error eka enwa, data base ekata data sav krnna giama.

          public function storeRegister(Request $request)
          {
          $registeruser = new registeruser;
          $request->all();
          $registeruser->save();
          }

          Nubelle 1 Reply Last reply Reply Quote 0
          • dev_lak
            dev_lak last edited by

            username kyna field ekata value ekak naha kyla kyanne

            1 Reply Last reply Reply Quote 1
            • Nubelle
              Nubelle Web Development @hashan last edited by

              @hashan row sql use krane ai mchan , Laravel ORM eka use karana

              1 Reply Last reply Reply Quote 0
              • 1 / 1
              • First post
                Last post

              0
              Online

              3.7k
              Users

              1.3k
              Topics

              5.3k
              Posts

              • Privacy
              • Terms & Conditions
              • Donate

              © Copyrights and All right reserved Lanka Developers Community

              Powered by Axis Technologies (PVT) Ltd

              Made with in Sri Lanka

              | |