44  <img  src =" https://api.dependabot.com/badges/status?host=github&repo=kriasoft/react-firebase-starter "  alt =" Dependabot "  height =" 20 "  />
55  <a  href =" https://opencollective.com/react-firebase-starter " ><img  src =" https://opencollective.com/react-firebase-starter/backers/badge.svg?maxAge=3600 "  height =" 20 " ></a >
66  <a  href =" https://twitter.com/ReactStarter " ><img  src =" https://img.shields.io/twitter/follow/ReactStarter.svg?style=social& ; label=Follow& ; maxAge=3600 "  alt =" Twitter "  height =" 20 " ></a >
7-   <a  href =" https://t.me/ReactStarter  " ><img  src =" https://img.shields.io/badge/chat-Telegram -green.svg?style=social& ; maxAge=3600 "  height =" 20 " ></a >
7+   <a  href =" https://discord.gg/2nKEnKq  " ><img  src =" https://img.shields.io/badge/chat-Discord -green.svg?style=social& ; maxAge=3600 "  height =" 20 " ></a >
88</h1 >
99
1010** React Starter Kit**  _ for Firebase_  is a popular project template (aka, boilerplate) for building
@@ -13,11 +13,11 @@ provided by <a href="https://cloud.google.com/">Google Cloud</a> (Cloud SQL, Clo
1313hosting, and file storage). It allows you to save time and build upon a solid foundation and
1414design patterns.
1515
16- <p  align =" center " ><strong >View</strong > <a  href =" https://firebase.reactstarter.com " >online demo</a > (<a  href =" https://firebase.reactstarter.com/graphql " >API</a >, <a  href =" https://firebase.reactstarter.com/graphql/model " >data model</a >)   ; |  ;  <strong >Follow us</strong > on <a  href =" https://twitter.com/ReactStarter " >Twitter</a >   ; |  ;  <strong >Get FREE support</strong > on <a  href =" https://t.me/ReactStarter  " >Telegram </a >   ; |  ;  <a  href =" https://angel.co/company/kriasoft/jobs/ " ><strong >We're hiring!</strong ></a ></p >
16+ <p  align =" center " ><strong >View</strong > <a  href =" https://firebase.reactstarter.com " >online demo</a > (<a  href =" https://firebase.reactstarter.com/graphql " >API</a >, <a  href =" https://firebase.reactstarter.com/graphql/model " >data model</a >)   ; |  ;  <strong >Follow us</strong > on <a  href =" https://twitter.com/ReactStarter " >Twitter</a >   ; |  ;  <strong >Get FREE support</strong > on <a  href =" https://discord.gg/2nKEnKq  " >Discord </a >   ; |  ;  <a  href =" https://angel.co/company/kriasoft/jobs/ " ><strong >We're hiring!</strong ></a ></p >
1717
1818--- 
1919
20- This project was bootstraped  with [ React Starter Kit for Firebase] [ rfs ]  by [ Kriasoft] [ kriasoft ] .
20+ This project was bootstrapped  with [ React Starter Kit for Firebase] [ rfs ]  by [ Kriasoft] [ kriasoft ] .
2121
2222### Tech Stack  
2323
@@ -107,18 +107,38 @@ In order to re-compile GraphQL fragments, run `yarn relay` or `yarn relay --watc
107107
108108### How to Migrate Database Schema  
109109
110+ While the app is in development, you can use a simplified migration workflow by
111+ creating a backup of your existing database, making changes to the existing
112+ migration file (see ` migrations/20180101000000_initial.js ` ), re-apply the
113+ migration and restore data from the backup file (` backup.sql ` ):
114+ 
110115``` bash 
111- $ yarn db-change                   #  Create a new database migration file
112- $ yarn db-migrate                  #  Migrate database to the latest version
113- $ yarn db-rollback                 #  Rollback the latest migration
114- $ yarn db-backup --env=prod        #  Write database backup to backup.sql
115- $ yarn db-restore --env=dev        #  Restore database from backup.sql
116- $ yarn db                          #  Open PostgreSQL shell (for testing/debugging)
116+ $ yarn db-backup --env=dev         #  Or, yarn db-backup --env=test
117+ $ yarn db-reset-dev                #  Or, yarn db-reset-test
118+ ``` 
119+ 
120+ Upon deployment to production, switch to normal migration workflow:
121+ 
122+ ``` bash 
123+ $ yarn db-change < name>             #  Create a new database migration file
124+ $ yarn db-migrate --env=dev        #  Migrate database to the latest version
117125``` 
118126
119- ** Note** : Appending ` --env=prod `  or ` --env=test `  flags to any of the commands above will load the
120- corresponding database settings for the selected deployment environment from
121- [ Firebase Config API] ( https://firebase.google.com/docs/functions/config-env ) 
127+ ** HINT** : Test your migration thoroughly with a local instance of the DB first
128+ (by using ` --env=local `  or ` --env=dev `  (default) flag) then apply it to your
129+ ` test `  or ` prod `  database instance using ` --env=test `  or ` --env=prod `  command
130+ argument.
131+ 
132+ Other helpful database scripts:
133+ 
134+ ``` bash 
135+ $ yarn db-version --env=dev        #  Print the version number of the last migration
136+ $ yarn db-rollback --env=dev       #  Rollback the latest migration
137+ $ yarn db-restore --env=dev        #  Restore database from backup.sql
138+ $ yarn db-seed --env=dev           #  Seed database with test data
139+ $ yarn db --env=dev                #  Open Knex.js REPL shell (type ".exit" for exit)
140+ $ yarn psql --env=dev              #  Open PostgreSQL shell (type "\q" for exit)
141+ ``` 
122142
123143### How to Test  
124144
0 commit comments