You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Add repository keys and gpg keys
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
# update apt list
sudo apt-get update
# install postgresql
sudo apt-get -y install postgresql postgresql-contrib
# Add working environment variables to user profileecho -c 'export LC_ALL="en_US.UTF-8"'| sudo tee -a ~/.profile
echo -c 'export PGHOST=localhost'| sudo tee -a ~/.profile
Creating a single dbml file
# move to the database directorycd backend/database
# Concatenate all files into a single file# validate and build the project
cat users.dbml vault.dbml search.dbml > learn_db_dev.dbml &&\
dbdocs build learn_db_dev.dbml
Creating a sqldump from dbml file
# create a sql dump from the dbml file
dbml2sql learn_db_dev.dbml -o learn_db_dev.sql
# sometimes you may need to run this twice if you get an error# you may also need to make sure '/etc/postgresql/15/main/pg_hba.conf'# has local connections to trust, like this:# local all postgres trust
cat database/setup_db_test.sql | psql postgres postgres
View the database and tables
# Enter password 'learn_dev_pwd'
psql -U learn_test -d learn_test_db -W
# To view the databases\l# To view all database tables\dt+
# To exit the psql cli\q
Testing class models
# create test user and view dictionary attributes
python3 backend/models/test_models.py
Setting up the API
# create a tmux session with the server running
tmux new-session -d 'python3 backend/main.py'
Setting up the Frontend
# install react, create template and dependencies from boilerplate
npx create-react-app my-app