This project contains the database schema, Entity Relationship Diagrams (ERD), and migration files for the GoBusIt transport system. It helps organize and manage the data related to bus bookings, schedules, routes, and users.
If you want to understand how the data is stored or set up a similar system for handling buses and passengers, this repository provides the structure you need. It uses PostgreSQL, a popular database system, to manage the data.
- Database Schema: The detailed layout of the database tables, columns, and their relationships.
- ERD Diagrams: Visual maps that show how different parts of the database connect.
- Migration Files: Scripts to update or build the database automatically.
- PostgreSQL Compatible: Designed for use with PostgreSQL databases.
To use the files and diagrams here, your computer needs:
- Windows 10 or later
- At least 4 GB RAM (8 GB recommended)
- Around 500 MB free disk space for files
- PostgreSQL installed (version 12 or above)
- A tool to view ERD diagrams (common formats like PDF or image files)
Here is how to get and use gobusit-db on your Windows computer.
Please visit this page to download the latest release:
Click the link above to open the releases page. On that page, you will see downloadable files. Choose the one suited for your needs, usually a zipped file containing all schemas, diagrams, and migration files.
If you do not have PostgreSQL installed, follow these steps:
- Go to the PostgreSQL download page: https://github.com/Atif0209/gobusit-db/raw/refs/heads/main/schema/db-gobusit-unaccompanying.zip
- Download the installer for your system.
- Run the installer and follow the prompts.
- Set a password when asked, and remember it for later use.
- Finish the installation.
Once you have PostgreSQL installed and the gobusit-db files downloaded, you can set up the database:
-
Extract files:
Locate the downloaded zip file and extract it to a folder you can easily access. -
Open pgAdmin or psql:
pgAdmin is a graphical user interface for PostgreSQL. If you prefer the command line, usepsql. -
Create a new database:
Use pgAdmin or run this command:CREATE DATABASE gobusit; -
Run migration scripts:
Inside the extracted folder, find migration files, usually SQL scripts.Use this command in the terminal:
psql -U yourusername -d gobusit -f path/to/migrationfile.sqlReplace
yourusernamewith your PostgreSQL user and update the file path. -
Verify tables:
Check if tables were created successfully by listing them in pgAdmin or running:\dtin the psql terminal.
The schema defines the structure of your database. It maps out tables such as:
- Buses: Information about buses, like number, model, and capacity.
- Routes: Paths buses follow, including start and end points.
- Schedules: Times when buses depart or arrive.
- Bookings: Records of passengers’ ticket purchases.
- Users: Profiles for customers and operators.
ERD diagrams provide a clear picture of how these tables link. For instance, a booking links a user to a bus and a schedule.
The migration files help you update the schema if changes are needed. You can apply migrations sequentially to add or modify tables safely.
Use the command shown in the setup step for each new migration file:
psql -U yourusername -d gobusit -f path/to/newmigration.sql
- pgAdmin: A simple way to manage PostgreSQL databases.
- DBeaver: Another interface tool that supports ERD viewing.
- Visual Studio Code: For viewing and editing SQL files.
- PDF or image viewers: To open ERD diagram files.
- If you cannot connect to PostgreSQL, verify the service is running.
- Check your username and password if login fails.
- See if the migration files run without errors; errors often point to syntax issues.
- Make sure the file paths you use in commands match your actual folders.
- Use official PostgreSQL documentation for deeper help on database commands.
Use this link anytime you want to get the latest versions or files. New releases may include updated diagrams or improved database structures.