Giter Site home page Giter Site logo

Comments (5)

changeweb avatar changeweb commented on May 18, 2024

Make the column $table->integer('school_id'); nullable in users migration table. Let me know if it works.

$table->integer('school_id')->nullable();

from unifiedtransform.

jbartus avatar jbartus commented on May 18, 2024

Sorry I must have missed the email when you first responded.

I tried adding ->nullable() there. That worked, but exposed the next error of the same type. Here's the set of them:

SQLSTATE[23000]: Integrity constraint violation: 19 NOT NULL constraint fai  
led: users.code (SQL: insert into "users" ("name", "email", "password", "ro  
le", "active", "verified") values (hasib, [email protected], $2y$1  
0$vU0W7YPwYTDRCDlCHhL1wOaNSStj7YLUDpKCAdOFBgxKzRmar.lVK, master, 1, 1))      


SQLSTATE[23000]: Integrity constraint violation: 19 NOT NULL constraint fai  
  led: users.student_code (SQL: insert into "users" ("name", "email", "passwo  
  rd", "role", "active", "verified") values (hasib, [email protected]  
  m, $2y$10$c93O5X8FeJhIgXVfBghaheiOv0yCrsa/SvQwlnzZesnxdeGNZGUUa, master, 1,  
   1))   


SQLSTATE[23000]: Integrity constraint violation: 19 NOT NULL constraint fai  
  led: student_infos.user_id (SQL: insert into "student_infos" ("student_id",  
   "session", "version", "group", "birthday", "religion", "father_name", "fat  
  her_phone_number", "father_national_id", "father_occupation", "father_desig  
  nation", "father_annual_income", "mother_name", "mother_phone_number", "mot  
  her_national_id", "mother_occupation", "mother_designation", "mother_annual  
  _income", "updated_at", "created_at") values (141, 2019, english, , 1922-08  
  -31, buddhism, Ezekiel Kerluke, 944571, SA0218IBYZVZJSEC8536V4XC, Mathemati  
  cal Science Teacher, Cook, 1000000, Nelle Berge, 3613916, SA0218IBYZVZJSEC8  
  536V4XC, Motorcycle Mechanic, Library Worker, 500000, 2019-06-25 01:05:21,   
  2019-06-25 01:05:21))                     

SQLSTATE[23000]: Integrity constraint violation: 19 NOT NULL constraint fai  
  led: student_board_exams.user_id (SQL: insert into "student_board_exams" ("  
  student_id", "exam_name", "group", "roll", "registration", "session", "boar  
  d", "passing_year", "institution_name", "gpa", "updated_at", "created_at")   
  values (67, A Level, arts, 4738146, 699750, 2018-19, rajsahi, 2011, efnj sc  
  hool, 5, 2019-06-25 02:10:31, 2019-06-25 02:10:31))        

Here's a git branch with each of them set nullable():
master...jbartus:master

That successfully completes the php artisan db:seed step, however when you login to the resulting app and click the Manage Schools button you get this error

Type error: Argument 2 passed to App\Model::scopeBySchool() must be of the type int, null given, called in /var/www/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php on line 955

Querying the sqlite database file it checks out:

# sqlite3 -line database.sqlite "select school_id from users where name='hasib'"
school_id =

I setup another environment using mysql with the master branch here (so none of my ->nullable() edits), and it works fine. The key difference seems to be here:

# mysql -u root -p'<snip>' -h'<snip>' unifiedtransform -e "select school_id from users where name='hasib';"
school_id
0

Hmmm where'd that zero come from:

# mysql -u root -p'<snip>' -h'<snip>' unifiedtransform -e "show create table users\G" | grep school_id
`school_id` int(11) NOT NULL,

It looks like mysql defaults to zero for an int thats defined as not null but passed a null value.

I'm not sure what the right next step is here, maybe nothing, just figured I'd share my results w/you.

from unifiedtransform.

jbartus avatar jbartus commented on May 18, 2024

@changeweb I don't see a way to re-open this, and that's your call, so just @'ing you to make sure this didn't get lost in the void.

from unifiedtransform.

changeweb avatar changeweb commented on May 18, 2024

@jbartus Thanks for sharing your result. It may help others who may face similar issue.

Unfortunately I can't focus on this issue right now but I am reopening this issue.

I will suggest you try any Laravel Sqlite package to work with this software. Hope that will work in your case.

from unifiedtransform.

JuanVqz avatar JuanVqz commented on May 18, 2024

@jbartus maybe if you run composer require doctrine/dbal fix that.
I run dusk test with sqlite in pull request #174 add doctrine/dbal.
Here more info.

from unifiedtransform.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.