Commit 3e5dcfee authored by Pavel Leshkovich's avatar Pavel Leshkovich
Browse files

add linked tables projects to instances

parent 97187805
...@@ -23,6 +23,7 @@ function * createTables() { ...@@ -23,6 +23,7 @@ function * createTables() {
\`name\` CHAR(255) NOT NULL, \`name\` CHAR(255) NOT NULL,
\`config\` TEXT NOT NULL, \`config\` TEXT NOT NULL,
\`feed_uuid\` CHAR(36) NOT NULL, \`feed_uuid\` CHAR(36) NOT NULL,
\`instance_id\` CHAR(36) NOT NULL,
PRIMARY KEY (\`id\`), PRIMARY KEY (\`id\`),
UNIQUE INDEX \`id_UNIQUE\` (\`id\` ASC) UNIQUE INDEX \`id_UNIQUE\` (\`id\` ASC)
) )
......
...@@ -8,7 +8,8 @@ function* post() { ...@@ -8,7 +8,8 @@ function* post() {
.isLength(1, 255).value, .isLength(1, 255).value,
config: this.checkBody('config').eq('[object Object]').value, config: this.checkBody('config').eq('[object Object]').value,
feed_uuid: this.checkBody('feed_uuid').isUUID().value, feed_uuid: this.checkBody('feed_uuid').isUUID().value,
project_id: this.checkBody('project_id').isInt().value project_id: this.checkBody('project_id').isInt().value,
instance_id: this.checkParams('instanceId').isUUID().value
}; };
const str = JSON.stringify(project); const str = JSON.stringify(project);
...@@ -25,8 +26,8 @@ function* post() { ...@@ -25,8 +26,8 @@ function* post() {
yield this.db.queryAsync( yield this.db.queryAsync(
`UPDATE \`${ `UPDATE \`${
this.tablesNames.PROJECTS this.tablesNames.PROJECTS
}\` SET name = ?, feed_uuid = ?, project_id = ?, config = ? WHERE id = ?`, }\` SET name = ?, feed_uuid = ?, project_id = ?, config = ?, instance_id = ? WHERE id = ?`,
[project.name, project.feed_uuid, project.project_id, project.config, project.id] [project.name, project.feed_uuid, project.project_id, project.config, projects.instance_id, project.id]
); );
this.logger.log( this.logger.log(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment