backend

command module
v0.0.0-...-c4aec86 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 31, 2022 License: MIT Imports: 12 Imported by: 0

README

Deployment

We are using fly.io for deployment

In order to deploy to fly.io flyctl needs to be installed

Mac: brew install flyctl

Windows: iwr https://fly.io/install.ps1 -useb | iex

Testing

  • To run all tests
    go test ./... 
    
  • To run tests in an individual directory
    go test ./<directory>
    

flyctl commands

in order to deploy flyctl launch

Follow commands and keep track of the postgres credentials, they will be required to create a db_url in order to connect to the database using dbmate

Once finished a fly.toml file will be created

#Database:

Create a migration using dmate. Dbmate uses .env's dburl in order to connect to the database

Dbmate commands:

dbmate init [name of database]
dbmate up
dbmate down
  • dbmate init creates database with name of file
  • dbmate up runs migration updates tables
  • dbmate down runs migration and deletes tables

Dbmate up runs once. if you make edits to the sql file you have to run dbmate down in order for the database to be updated.

##Test data: mockaroo is used to create sample random data. You can add your table field names and convert to sql file in order to insert to your database

If you create a test files to fill your database

On windows: if psql in your path follow mac instructions. if not use .bat file in order to automate the process.

REM Run psql
[path to .exe psql]"C:\Program Files\PostgreSQL\14\bin\psql.exe" -h "[hostname]" -U "[username]" -d "[dbname]" -p "[port]" -f "[name of file]"

pause

On mac: psql should already be added to your environment variables/path psql [database name] -f [path to test file]

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL