mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-01 00:08:27 +01:00
Simplify DB setup / migrations
This commit is contained in:
parent
97cd4c8704
commit
5f7319b903
@ -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 [![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.
|
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:
|
## Important commands:
|
||||||
|
|
||||||
```
|
```
|
||||||
// Set up DB
|
// Make sure DATABASE_URL is set and run migrations in your local DB
|
||||||
cp config/database.example.json config/database.json
|
db-migrate up
|
||||||
npm run db-setup
|
|
||||||
|
|
||||||
// Start server in dev-mode:
|
// Start server in dev-mode:
|
||||||
npm run start-dev
|
npm run start-dev
|
||||||
@ -29,16 +42,3 @@ npm test
|
|||||||
4. Run `npm run db-migrate-up`.
|
4. Run `npm run db-migrate-up`.
|
||||||
5. Generate LB artifact using `scripts/generate-liquibase-artifact` (TODO: make this internal)
|
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 = {
|
module.exports = {
|
||||||
store: storeEvent
|
store: storeEvent
|
||||||
};
|
};
|
@ -21,12 +21,7 @@
|
|||||||
"start-dev": "NODE_ENV=local supervisor --ignore ./node_modules/,./public/js server.js",
|
"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/*",
|
"test": "jshint server.js lib test && jsxhint public/js/*.jsx && mocha test test/*",
|
||||||
"tdd": "mocha --watch test test/*",
|
"tdd": "mocha --watch test test/*",
|
||||||
"test-bamboo-ci": "mocha 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"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"any-db": "2.1.0",
|
"any-db": "2.1.0",
|
||||||
|
Loading…
Reference in New Issue
Block a user