-
Notifications
You must be signed in to change notification settings - Fork 225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Benchmark cache #955
base: dev
Are you sure you want to change the base?
Benchmark cache #955
Changes from 1 commit
323b113
2f5cd16
d5885e6
174e791
57483af
6f53747
75cedf4
a5cf430
0c3f561
0c2509b
e06fb1f
f01d790
3a2d0db
588e1ea
6049f50
468a50b
bd7043e
a1e8b7b
df1f34c
99d9aec
31991fd
19c9f4c
8f64838
9b23f5b
d173c1c
4194533
17c8956
cf390fd
579c8f9
164bc95
dec578c
a99be7d
a835fd0
8be58e5
91330df
929350b
973d64d
741a901
a4ec3fc
85ade75
d15498c
ecff047
502dbe1
a1b04d6
2d13640
5b769de
7b31337
864693e
580a08d
3849695
cdcecc3
4798414
5cca11a
5d30ad2
18dbd90
dd03d7d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php /** @noinspection SqlNoDataSourceInspection */ | ||
use DBA\Factory; | ||
|
||
if (!Util::databaseTableExists("HardwareGroup")) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Typically, we wrap upgrade steps also with in a check of a unique key which is stored in database to determine if the update part was already executed or not. Of course, if databaseTableExists() is checked, it would not execute it twice anyway. But with having a key stored in the database, it's also easier to look up in case of issues and to keep consistency overall, we should always have this wrap with a key (as seen in the other update files). |
||
Factory::getAgentFactory()->getDB()->query("CREATE TABLE `HardwareGroup` ( | ||
`hardwareGroupId` INT(11) NOT NULL, | ||
`devices` VARCHAR(65000) NOT NULL, | ||
) ENGINE=InnoDB;" | ||
); | ||
Factory::getAgentFactory()->getDB()->query("ALTER TABLE `HardwareGroup` MODIFY `hardwareGroupId` int(11) NOT NULL AUTO_INCREMENT"); | ||
} | ||
|
||
//change Agent table | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess this should not be commented out? Otherwise I think this would break existing installations as the Agent table would not be as expected with the benchmark caching code. The same probably applies for the Benchmark table and the adding of the foreign key constraints. |
||
Factory::getAgentFactory()->getDB()->query("ALTER TABLE `Agent` | ||
DROP COLUMN devices; | ||
"); | ||
Factory::getAgentFactory()->getDB()->query("ALTER TABLE `Agent` | ||
ADD COLUMN hardwareGroupId INT(11); | ||
"); | ||
Factory::getAgentFactory()->getDB()->query("ALTER TABLE `Agent` ADD CONSTRAINT FOREIGN KEY (`hardwareGroupId`) REFERENCES `HardwareGroup` (`hardwareGroupId`);"); | ||
|
||
|
||
if (!Util::databaseTableExists("Benchmark")) { | ||
Factory::getAgentFactory()->getDB()->query("CREATE TABLE `Benchmark` ( | ||
`benchmarkId` INT(11) NOT NULL, | ||
`benchmarkValue` VARCHAR(256) NOT NULL, | ||
`hardwareGroupId` INT(11) NOT NULL, | ||
`attackParameters` VARCHAR(256) NOT NULL, | ||
`ttl` INT(11) NULL, | ||
`hashMode` INT(11) NULL, | ||
`benchmarkType` VARCHAR(10) NULL, | ||
) ENGINE=InnoDB;" | ||
); | ||
Factory::getAgentFactory()->getDB()->query("ALTER TABLE `Benchmark` MODIFY `benchmarkId` int(11) NOT NULL AUTO_INCREMENT"); | ||
} | ||
Factory::getAgentFactory()->getDB()->query("ALTER TABLE `Benchmark` ADD CONSTRAINT FOREIGN KEY (`hardwareGroupId`) REFERENCES `HardwareGroup` (`hardwareGroupId`);"); | ||
|
||
?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While the release is not fixed and in preparation, the update files typically are named ./update_v0.14.x_v0.x.x.php.