Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I worked on the migration database integrity constraints #301

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

orajiakuchibuchi
Copy link

@orajiakuchibuchi orajiakuchibuchi commented May 20, 2021

Screenshot from 2021-05-21 00-15-12
Screenshot from 2021-05-21 00-14-09

Before my contribution, I realized the system was working fine but there were no foreign key integrity constraints in the database design.
I worked on the migration schemas, adding the foreign key integrity constraints. I also rearranged the order of the migrations.
This provides a better database relationship and schema structure.
Test run on a new database.
After running the php artisan migrate command,
Go to http://localhost/phpmyadmin
Click the database > Database designer

Below are screenshots of the old and new database design view

@orajiakuchibuchi
Copy link
Author

I worked on the master dashboard as well. adding the side menu, and dashboard card. new cards for the following: total number of schools, admins, teachers, and students. Added the side menu
screencapture-127-0-0-1-8001-masters-2021-05-22-00_27_28

@changeweb
Copy link
Owner

changeweb commented May 22, 2021

@orajiakuchibuchi Great work! I didn't add foreign key constraint because in some cases, we need to delete a row from a table but it could not be deleted just because of foreign key constrained was integrated.

If you can add some Tests which test of delete actions without being affected by foreign key, I would be confident enough to merge the PR.

Copy link

@olakehinde olakehinde left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@orajiakuchibuchi You should add the onDelete('cascade'); to the foreign ket declaration in all your migration files so that as @changeweb has indicated, when a model entity is deleted, all the child models/relationships associated with it can also be deleted.
For example:
$table->foreign('school_id')->references('id')->on('schools');
becomes
$table->foreign('school_id')->references('id')->on('schools')->onDelete('cascade');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants