mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-25 00:07:47 +01:00
Get rid of liquibase
This commit is contained in:
parent
3e7062227b
commit
3dddf791e6
3
.gitignore
vendored
3
.gitignore
vendored
@ -33,3 +33,6 @@ node_modules
|
||||
|
||||
# Java
|
||||
target
|
||||
|
||||
# Local config
|
||||
/unleash-server/config/database.json
|
@ -1,13 +1,12 @@
|
||||
# unleash-server
|
||||
unleash-server is a place to ask for the status of features.
|
||||
|
||||
|
||||
# Important commands:
|
||||
|
||||
```
|
||||
// Set up DB
|
||||
npm run db-create
|
||||
npm run db-migrate
|
||||
cp config/database.example.json config/database.json
|
||||
npm run db-setup
|
||||
|
||||
// Start server in dev-mode:
|
||||
npm run start-dev
|
||||
@ -18,7 +17,6 @@ http://localhost:4242
|
||||
// Feature API:
|
||||
http://localhost:4242/features
|
||||
|
||||
|
||||
// Execute tests:
|
||||
npm test
|
||||
```
|
3
unleash-server/config/database.json.example
Normal file
3
unleash-server/config/database.json.example
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"dev": "postgres://localhost:5432/unleash_dev"
|
||||
}
|
12
unleash-server/migrations/20141020151056-initial-schema.js
Normal file
12
unleash-server/migrations/20141020151056-initial-schema.js
Normal file
@ -0,0 +1,12 @@
|
||||
var fs = require('fs');
|
||||
var util = require('util');
|
||||
var path = require('path').resolve(__dirname, 'sql/001-initial-schema.%s.sql');
|
||||
|
||||
exports.up = function(db, callback) {
|
||||
var content = fs.readFileSync(util.format(path, 'up'), {encoding: 'utf8'});
|
||||
db.runSql(content, callback);
|
||||
};
|
||||
|
||||
exports.down = function(db, callback) {
|
||||
db.runSql(fs.readFileSync(util.format(path, 'down'), {encoding: 'utf8'}), callback);
|
||||
};
|
@ -0,0 +1,3 @@
|
||||
DROP TABLE strategies;
|
||||
DROP TABLE features;
|
||||
DROP TABLE events;
|
18
unleash-server/migrations/sql/001-initial-schema.up.sql
Normal file
18
unleash-server/migrations/sql/001-initial-schema.up.sql
Normal file
@ -0,0 +1,18 @@
|
||||
CREATE TABLE strategies (
|
||||
created_at timestamp default now(),
|
||||
name varchar(255) PRIMARY KEY NOT NULL,
|
||||
description text
|
||||
);
|
||||
|
||||
CREATE TABLE features (
|
||||
created_at timestamp default now(),
|
||||
name varchar(255) PRIMARY KEY NOT NULL,
|
||||
strategy_name varchar(255) references strategies(name),
|
||||
parameters json
|
||||
);
|
||||
|
||||
CREATE TABLE events (
|
||||
created_at timestamp default now(),
|
||||
type varchar(255) NOT NULL,
|
||||
data json
|
||||
);
|
@ -22,21 +22,23 @@
|
||||
"test": "jshint server.js lib public/scripts test && mocha test test/*",
|
||||
"tdd": "mocha --watch test test/*",
|
||||
"test-bamboo-ci": "mocha test test/*",
|
||||
"db-create": "createdb unleash",
|
||||
"db-drop": "dropdb unleash",
|
||||
"db-migrate": "grunt --verbose liquibase:update"
|
||||
"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": {
|
||||
"bluebird": "2.2.2",
|
||||
"body-parser": "1.4.3",
|
||||
"db-migrate": "^0.7.1",
|
||||
"errorhandler": "1.1.1",
|
||||
"express": "4.9.8",
|
||||
"express-validator": "2.6.0",
|
||||
"ini": "1.3.0",
|
||||
"log4js": "0.6.21",
|
||||
"nconf": "0.6.9",
|
||||
"grunt": "^0.4.5",
|
||||
"grunt-liquibase": "finn-no/grunt-liquibase#auth-in-url"
|
||||
"pg": "^3.6.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"chai": "1.9.1",
|
||||
|
@ -1,35 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<databaseChangeLog
|
||||
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
|
||||
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
|
||||
|
||||
<changeSet id="001-create-strategies" author="fijabakk">
|
||||
<sql>
|
||||
CREATE TABLE strategies (
|
||||
created_at timestamp default now(),
|
||||
name varchar(255) PRIMARY KEY NOT NULL,
|
||||
description text
|
||||
);
|
||||
|
||||
CREATE TABLE features (
|
||||
created_at timestamp default now(),
|
||||
name varchar(255) PRIMARY KEY NOT NULL,
|
||||
strategy_name varchar(255) references strategies(name),
|
||||
parameters json
|
||||
);
|
||||
|
||||
CREATE TABLE events (
|
||||
created_at timestamp default now(),
|
||||
type varchar(255) NOT NULL,
|
||||
data json
|
||||
);
|
||||
</sql>
|
||||
|
||||
<rollback>
|
||||
DROP TABLE strategies;
|
||||
DROP TABLE features;
|
||||
</rollback>
|
||||
</changeSet>
|
||||
</databaseChangeLog>
|
@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<databaseChangeLog
|
||||
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
|
||||
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-2.0.xsd">
|
||||
|
||||
<include relativeToChangelogFile="true" file="001-create-tables.xml"/>
|
||||
|
||||
</databaseChangeLog>
|
Loading…
Reference in New Issue
Block a user