Skip to content

Biken49/assisment-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

## Setup & Initialize Database

This project uses Docker and PostgreSQL. To start the application and initialize the database with demo tables and data, run the following commands from the project root:

```bash
# Stop and remove any running containers
docker-compose down

# Remove the Postgres volume so init scripts run fresh
docker volume rm assisment-_pg_data

# Start containers (Postgres will initialize the database)
docker-compose up -d

# Wait a few seconds for Postgres to start
sleep 10

# Run SQL scripts manually to create tables and insert demo data
docker exec -i postgres_db psql -U postgres -d energy_db < db-init/create_tables.sql
docker exec -i postgres_db psql -U postgres -d energy_db < db-init/insert_sample_data.sql

# Verify tables and demo data
docker exec -it postgres_db psql -U postgres -d energy_db -c "\dt"
docker exec -it postgres_db psql -U postgres -d energy_db -c "SELECT * FROM meter_telemetry_history LIMIT 5;"
docker exec -it postgres_db psql -U postgres -d energy_db -c "SELECT * FROM meter_live_status LIMIT 5;"
docker exec -it postgres_db psql -U postgres -d energy_db -c "SELECT * FROM vehicle_telemetry_history LIMIT 5;"
docker exec -it postgres_db psql -U postgres -d energy_db -c "SELECT * FROM vehicle_live_status LIMIT 5;"

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors