So it is now time to do the Data Modelling for our webapp. In case you are reading my blog for the first time, this is the idea of the webapp that I am talking about.
App Idea (Task 1.1)
If you are just wondering what app idea I am talking about then please check out my previous post. The first internship…
And this is the prototype for our webapp
App Prototype (Task 1.2)
Prototype? What’s that? Do you have the same question? Don’t worry, I will be explaining in detail what an app…
As I always explain even the simplest of concepts in my blogposts. So here is a defintion for all you folks who don’t know about Data Modelling.
Data modeling in software engineering is the process of creating a data model for an information system by applying certain formal techniques. Data modeling is a process used to define and analyze data requirements needed to support the business processes within the scope of corresponding information systems in organizations.
We were supposed to make data models for our app and add relevant tables to our Hasura project. Although I started this task in quite a different way. I decided to learn thoroughly about E-R diagrams so that I would be able to derive the tables and relationships from them easily. I did all this just to avoid making mistakes in constructing different tables for my app. I thought it makes more sense to first construct the data models right rather than worrying about problems in your data models when you are almost done with your app.
E-R diagram stands for entity-relationship diagrams. An entity is a real world object that has some properties called attributes. So, E-R diagrams are about the various entities that one is going to have in the data model and the relationship between these entities. I used this source to learn about E-R diagrams. It is one of the best book out there and it teaches you thoroughly about databases. The name of the book is Database System Concepts by Abraham Silberschatz, Henry F. Korth and S.Sudarshan. I use this book whenever I have to study any topic about databases. You can do that too. Trust me, it’s going to be your bestfriend when it comes to databases!! It can be obtained at the link I have given above.
So after learning about E-R diagrams, now was the time to put my knowledge into use. I started making the E-R diagram for my webapp. I used pencil and rubber to do that and trust me you should also do the same because it’s gonna save you alot of paper !! So after various attempts I was finally able to draw an E-R diagram that, according to me, is enough to represent all the entities and relationships that I am going to have in my database. So here it is
After completing the E-R diagram, it was now easy for me to make tables and the relationships between them as all this was already present in the E-R diagram. In the E-R diagram, I had already shown with directed and undirected arrows the various relationships that can exist between entities i.e., one-to-one, one-to-many, many-to-one, many-to-many. If you don’t know which arrows indicate which kind of relationship then you should read a bit about E-R diagrams. So I started creating tables on my Hasura project. This task was now really easy. We were asked to share the schema by using a tool called PonyOrm. Although I have used a different tool called DbDesigner. I personally found this tool to be quite easy and useful as compared to PonyOrm. It didn’t took me much time to create the schema and only after half an hour I was done with creating the schema. So here it is
So, as you can see there are 6 tables in my data model namely Student, Course, Teacher, Subject, Semester, Attendance. The various attributes and relationships between these attributes are similar to what was depicted by the E-R diagram.
Up Next is Hasura Data Api!!!