Skip to content
Permalink
Browse files

Lint commit (#239)

* Upgrade eslint configs to get rid of peer warning

* Add pre-commit hook to format code

* Lint whole project, not just lib
  • Loading branch information...
SimenB committed Jun 28, 2017
1 parent 0640879 commit d1ec402066d7f3c3724798b81fc61537eea846d1
@@ -17,12 +17,17 @@ const argv = require('yargs')
})
.option('databaseUrl', {
alias: 'd',
describe: 'The full databaseUrl to connect to, including username and password',
describe:
'The full databaseUrl to connect to, including username and password',
demand: true,
type: 'string',
})
.argv
}).argv;

serverImpl.start(argv)
.then(conf => console.log(`Unleash started on http://localhost:${conf.app.get('port')}`))
.catch(console.err);
serverImpl
.start(argv)
.then(conf =>
console.log(
`Unleash started on http://localhost:${conf.app.get('port')}`
)
)
.catch(console.err);
@@ -1,7 +1,8 @@
'use strict';

exports.up = function (db, callback) {
db.runSql(`
exports.up = function(db, callback) {
db.runSql(
`
CREATE TABLE strategies (
created_at timestamp default now(),
name varchar(255) PRIMARY KEY NOT NULL,
@@ -23,14 +24,18 @@ CREATE TABLE events (
created_by varchar(255) NOT NULL,
data json
);
`, callback);
`,
callback
);
};


exports.down = function (db, callback) {
db.runSql(`
exports.down = function(db, callback) {
db.runSql(
`
DROP TABLE events;
DROP TABLE features;
DROP TABLE strategies;
`, callback);
`,
callback
);
};
@@ -1,10 +1,9 @@
'use strict';

exports.up = function (db, callback) {
exports.up = function(db, callback) {
db.runSql('ALTER TABLE features ADD "description" text;', callback);
};


exports.down = function (db, callback) {
exports.down = function(db, callback) {
db.runSql('ALTER TABLE features DROP COLUMN "description";', callback);
};
@@ -1,10 +1,15 @@
'use strict';

exports.up = function (db, callback) {
db.runSql('ALTER TABLE strategies ADD "parameters_template" json;', callback);
exports.up = function(db, callback) {
db.runSql(
'ALTER TABLE strategies ADD "parameters_template" json;',
callback
);
};


exports.down = function (db, callback) {
db.runSql('ALTER TABLE strategies DROP COLUMN "parameters_template";', callback);
exports.down = function(db, callback) {
db.runSql(
'ALTER TABLE strategies DROP COLUMN "parameters_template";',
callback
);
};
@@ -1,14 +1,19 @@
'use strict';

exports.up = function (db, callback) {
db.runSql(`
exports.up = function(db, callback) {
db.runSql(
`
INSERT INTO strategies(name, description)
VALUES ('default', 'Default on/off strategy.');
`, callback);
`,
callback
);
};


exports.down = function (db, callback) {
db.runSql(`
DELETE FROM strategies where name='default';`, callback);
exports.down = function(db, callback) {
db.runSql(
`
DELETE FROM strategies where name='default';`,
callback
);
};
@@ -1,14 +1,19 @@
'use strict';

exports.up = function (db, callback) {
db.runSql(`
exports.up = function(db, callback) {
db.runSql(
`
INSERT INTO events(type, created_by, data)
VALUES ('strategy-created', 'migration', '{"name":"default","description":"Default on or off Strategy."}');
`, callback);
`,
callback
);
};


exports.down = function (db, callback) {
db.runSql(`
delete from events where type='strategy-created' and data->>'name' = 'default';`, callback);
exports.down = function(db, callback) {
db.runSql(
`
delete from events where type='strategy-created' and data->>'name' = 'default';`,
callback
);
};
@@ -1,10 +1,9 @@
'use strict';

exports.up = function (db, callback) {
exports.up = function(db, callback) {
db.runSql('ALTER TABLE features ADD archived integer DEFAULT 0;', callback);
};


exports.down = function (db, callback) {
exports.down = function(db, callback) {
db.runSql('ALTER TABLE features DROP COLUMN "archived";', callback);
};
@@ -1,16 +1,21 @@
'use strict';

exports.up = function (db, callback) {
db.runSql(`
exports.up = function(db, callback) {
db.runSql(
`
UPDATE events SET type='feature-revived' WHERE type='feature-revive';
UPDATE events SET type='feature-archived' WHERE type='feature-archive';
`, callback);
`,
callback
);
};


exports.down = function (db, callback) {
db.runSql(`
exports.down = function(db, callback) {
db.runSql(
`
UPDATE events SET type='feature-revive' WHERE type='feature-revived';
UPDATE events SET type='feature-archive' WHERE type='feature-archived';
`, callback);
`,
callback
);
};
@@ -1,7 +1,8 @@
'use strict';

exports.up = function (db, callback) {
db.runSql(`
exports.up = function(db, callback) {
db.runSql(
`
--create new strategies-column
ALTER TABLE features ADD "strategies" json;
@@ -14,12 +15,14 @@ WHERE f.name = features.name;
--delete old strategy-columns
ALTER TABLE features DROP COLUMN "strategy_name";
ALTER TABLE features DROP COLUMN "parameters";
`, callback);
`,
callback
);
};


exports.down = function (db, callback) {
db.runSql(`
exports.down = function(db, callback) {
db.runSql(
`
--create old columns
ALTER TABLE features ADD "parameters" json;
ALTER TABLE features ADD "strategy_name" varchar(255);
@@ -33,5 +36,7 @@ WHERE f.name = features.name;
--drop new column
ALTER TABLE features DROP COLUMN "strategies";
`, callback);
`,
callback
);
};
@@ -1,15 +1,17 @@
'use strict';

exports.up = function (db, callback) {
db.runSql(`
exports.up = function(db, callback) {
db.runSql(
`
CREATE TABLE client_metrics (
id serial primary key,
created_at timestamp default now(),
metrics json
);`, callback);
);`,
callback
);
};


exports.down = function (db, callback) {
exports.down = function(db, callback) {
db.runSql('DROP TABLE client_metrics;', callback);
};
@@ -1,17 +1,19 @@
'use strict';

exports.up = function (db, callback) {
db.runSql(`
exports.up = function(db, callback) {
db.runSql(
`
CREATE TABLE client_instances (
app_name varchar(255),
instance_id varchar(255),
client_ip varchar(255),
last_seen timestamp default now(),
created_at timestamp default now()
);`, callback);
);`,
callback
);
};


exports.down = function (db, callback) {
exports.down = function(db, callback) {
db.runSql('DROP TABLE client_instances;', callback);
};
@@ -1,20 +1,29 @@
/* eslint camelcase: "off" */
'use strict';

exports.up = function (db, cb) {
db.createTable('client_applications', {
app_name: { type: 'string', length: 255, primaryKey: true, notNull: true },
created_at: { type: 'timestamp', defaultValue: 'now()' },
updated_at: { type: 'timestamp', defaultValue: 'now()' },
seen_at: { type: 'timestamp' },
strategies: { type: 'json' },
description: { type: 'string', length: 255 },
icon: { type: 'string', length: 255 },
url: { type: 'string', length: 255 },
color: { type: 'string', length: 255 },
}, cb);
exports.up = function(db, cb) {
db.createTable(
'client_applications',
{
app_name: {
type: 'string',
length: 255,
primaryKey: true,
notNull: true,
},
created_at: { type: 'timestamp', defaultValue: 'now()' },
updated_at: { type: 'timestamp', defaultValue: 'now()' },
seen_at: { type: 'timestamp' },
strategies: { type: 'json' },
description: { type: 'string', length: 255 },
icon: { type: 'string', length: 255 },
url: { type: 'string', length: 255 },
color: { type: 'string', length: 255 },
},
cb
);
};

exports.down = function (db, cb) {
exports.down = function(db, cb) {
return db.dropTable('client_applications', cb);
};

0 comments on commit d1ec402

Please sign in to comment.
You can’t perform that action at this time.