username/branchPurpose
Eg:
sharad/AddMigrationFiles
Activate venv
source venv/Srcipts/activateAdd Requirements to requirements.txt
pip freeze>requirements.txtGenerate Migration Files automatically
alembic revision --autogenerate -m "<migration_file_name>"Run migrations
alembic upgrade headRoll back migrations to initial state
alembic downgrade baseRoll back migration to certain state: (For example, if you want to downgrade 00fc then you have to use alembic downgrade <version before 00fc>)
alembic downgrade <versionNumber>Run backend
uvicorn main:app --host <host> --port <portnumber> --reloadRemove all of the __pycache__ folders
find -type d -name __pycache__ -exec rm -rf {} +Run the following commands initially
alembic revision --autogenerate -m "Inital Setup"Before doing some changes, you can delete the alembic_versions and other tables before generating migration files again
Postgresql url format:DATABASE_URI = 'postgresql://postgres:<password>@localhost/<name_of_the_datbase>'
-
Change Directory to server, activate python environment and remove all pycache server
source backend.sh -
Remove all pycache folder (you need to be inside server folder to execute this)
source remove_pycache.sh