-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3330 from FlowFuse/3260-update-device-on-group-me…
…mbership-change Update device on group membership change
- Loading branch information
Showing
12 changed files
with
388 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
forge/db/migrations/20240116-01-add-targetSnapshot-to-DeviceGroup.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* eslint-disable no-unused-vars */ | ||
/** | ||
* Add targetSnapshotId to DeviceGroups | ||
* | ||
* -- DDL for table DeviceGroups - before migration | ||
* CREATE TABLE DeviceGroups ( | ||
* id INTEGER PRIMARY KEY AUTOINCREMENT, | ||
* name VARCHAR (255) NOT NULL, | ||
* description TEXT, | ||
* createdAt DATETIME NOT NULL, | ||
* updatedAt DATETIME NOT NULL, | ||
* ApplicationId INTEGER REFERENCES Applications (id) ON DELETE CASCADE | ||
* ON UPDATE CASCADE | ||
* ); | ||
* | ||
* | ||
* -- DDL for table DeviceGroups - after migration | ||
* CREATE TABLE DeviceGroups ( | ||
* id INTEGER PRIMARY KEY AUTOINCREMENT, | ||
* name VARCHAR (255) NOT NULL, | ||
* description TEXT, | ||
* createdAt DATETIME NOT NULL, | ||
* updatedAt DATETIME NOT NULL, | ||
* ApplicationId INTEGER REFERENCES Applications (id) ON DELETE CASCADE | ||
* ON UPDATE CASCADE, | ||
* targetSnapshotId INTEGER REFERENCES ProjectSnapshots (id) ON DELETE SET NULL | ||
* ON UPDATE CASCADE | ||
* ); | ||
* | ||
* | ||
* -- DDL for table DeviceGroups - auto created by sequelize | ||
* CREATE TABLE DeviceGroups ( | ||
* id INTEGER PRIMARY KEY AUTOINCREMENT, | ||
* name VARCHAR (255) NOT NULL, | ||
* description TEXT, | ||
* targetSnapshotId INTEGER REFERENCES ProjectSnapshots (id) ON DELETE SET NULL | ||
* ON UPDATE CASCADE, | ||
* createdAt DATETIME NOT NULL, | ||
* updatedAt DATETIME NOT NULL, | ||
* ApplicationId INTEGER REFERENCES Applications (id) ON DELETE CASCADE | ||
* ON UPDATE CASCADE | ||
* ); | ||
* | ||
*/ | ||
|
||
const { Sequelize, QueryInterface } = require('sequelize') | ||
|
||
module.exports = { | ||
/** | ||
* upgrade database | ||
* @param {QueryInterface} context QueryInterface | ||
*/ | ||
up: async (context) => { | ||
await context.addColumn('DeviceGroups', 'targetSnapshotId', { | ||
type: Sequelize.INTEGER, | ||
references: { | ||
model: 'ProjectSnapshots', | ||
key: 'id' | ||
}, | ||
onUpdate: 'CASCADE', | ||
onDelete: 'SET NULL' | ||
}) | ||
}, | ||
|
||
down: async (queryInterface, Sequelize) => { | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.