1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-28 00:06:53 +01:00

Simplify DB setup / migrations

This commit is contained in:
Jari Bakken 2014-10-23 14:36:06 +02:00
parent 97cd4c8704
commit 5f7319b903
4 changed files with 17 additions and 26 deletions

View File

@ -1,12 +1,25 @@
# unleash-server [![Build Status](https://travis-ci.org/finn-no/unleash.svg?branch=master)](https://travis-ci.org/finn-no/unleash) [![Code Climate](https://codeclimate.com/github/finn-no/unleash/badges/gpa.svg)](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
```

View File

@ -1,3 +0,0 @@
{
"dev": "postgres://localhost:5432/unleash_dev"
}

View File

@ -13,7 +13,6 @@ function storeEvent(event) {
});
}
module.exports = {
store: storeEvent
};

View File

@ -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",