mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	Simplify DB setup / migrations
This commit is contained in:
		
							parent
							
								
									cb88a15ee9
								
							
						
					
					
						commit
						3fc8131a43
					
				| @ -1,12 +1,25 @@ | ||||
| # unleash-server [](https://travis-ci.org/finn-no/unleash) [](https://codeclimate.com/github/finn-no/unleash) | ||||
| unleash-server is a place to ask for the status of features. | ||||
| 
 | ||||
| ### Create a local unleash-db on postgres | ||||
| ´´´bash | ||||
| $ psql postgres <<SQL | ||||
| CREATE USER unleash_user WITH PASSWORD 'passord'; | ||||
| CREATE DATABASE unleash; | ||||
| GRANT ALL PRIVILEGES ON DATABASE unleash to unleash_user; | ||||
| SQL | ||||
| ´´´ | ||||
| 
 | ||||
| Then set up your DATABASE_URI env.var: | ||||
| ``` | ||||
| export DATABASE_URL=postgres://unleash_user:passord@localhost:5432/unleash | ||||
| ``` | ||||
| 
 | ||||
| ## Important commands: | ||||
| 
 | ||||
| ``` | ||||
| // Set up DB | ||||
| cp config/database.example.json config/database.json | ||||
| npm run db-setup | ||||
| // Make sure DATABASE_URL is set and run migrations in your local DB | ||||
| db-migrate up | ||||
| 
 | ||||
| // Start server in dev-mode: | ||||
| npm run start-dev | ||||
| @ -29,16 +42,3 @@ npm test | ||||
| 4. Run `npm run db-migrate-up`. | ||||
| 5. Generate LB artifact using `scripts/generate-liquibase-artifact` (TODO: make this internal) | ||||
| 
 | ||||
| ### Create a local unleash-db on postgres | ||||
| ´´´bash | ||||
| $ psql postgres <<SQL | ||||
| CREATE USER unleash_user WITH PASSWORD 'passord'; | ||||
| CREATE DATABASE unleash; | ||||
| GRANT ALL PRIVILEGES ON DATABASE unleash to unleash_user; | ||||
| SQL | ||||
| ´´´ | ||||
| 
 | ||||
| Then set up your DATABASE_URI env.var: | ||||
| ``` | ||||
| export DATABASE_URL=postgres://unleash_user:passord@localhost:5432/unleash | ||||
| ``` | ||||
|  | ||||
| @ -1,3 +0,0 @@ | ||||
| { | ||||
|     "dev": "postgres://localhost:5432/unleash_dev" | ||||
| } | ||||
| @ -13,7 +13,6 @@ function storeEvent(event) { | ||||
|     }); | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| module.exports = { | ||||
|     store: storeEvent | ||||
| }; | ||||
| @ -21,12 +21,7 @@ | ||||
|         "start-dev": "NODE_ENV=local supervisor --ignore ./node_modules/,./public/js server.js", | ||||
|         "test": "jshint server.js lib test && jsxhint public/js/*.jsx && mocha test test/*", | ||||
|         "tdd": "mocha --watch test test/*", | ||||
|         "test-bamboo-ci": "mocha test test/*", | ||||
|         "db-create": "createdb unleash_${NODE_ENV:-dev}", | ||||
|         "db-drop": "dropdb unleash_${NODE_ENV:-dev}", | ||||
|         "db-migrate-up": "db-migrate --config config/database.json up", | ||||
|         "db-migrate-down": "db-migrate --config config/database.json down", | ||||
|         "db-setup": "npm run db-create; npm run db-migrate-up" | ||||
|         "test-bamboo-ci": "mocha test test/*" | ||||
|     }, | ||||
|     "dependencies": { | ||||
|         "any-db": "2.1.0", | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user