Bug 7465: Bump out of date migrations (#7478)

Bump out of date migrations
This commit is contained in:
Juan Fernandez
2022-09-06 10:58:10 -04:00
committed by GitHub
parent aa0102d6b6
commit e86aa9d99b
5 changed files with 12 additions and 8 deletions
+4
View File
@@ -0,0 +1,4 @@
Bumped up the following migrations:
- 20220711104651_RemoveCpeIDColumnFromSoftwareCve
- 20220809091020_AddWindowsUpdatesTable
@@ -7,10 +7,10 @@ import (
)
func init() {
MigrationClient.AddMigration(Up_20220711104651, Down_20220711104651)
MigrationClient.AddMigration(Up_20220831100036, Down_20220831100036)
}
func Up_20220711104651(tx *sql.Tx) error {
func Up_20220831100036(tx *sql.Tx) error {
logger.Info.Println("Deleting dummy software_cpe entries...")
// Remove in batches
const deleteStmt = `DELETE FROM software_cpe WHERE cpe LIKE 'none:%' LIMIT 10000`
@@ -63,6 +63,6 @@ ALTER TABLE software_cve DROP COLUMN cpe_id, ALGORITHM=INPLACE, LOCK=NONE;
return nil
}
func Down_20220711104651(tx *sql.Tx) error {
func Down_20220831100036(tx *sql.Tx) error {
return nil
}
@@ -7,10 +7,10 @@ import (
)
func init() {
MigrationClient.AddMigration(Up_20220809091020, Down_20220809091020)
MigrationClient.AddMigration(Up_20220831100151, Down_20220831100151)
}
func Up_20220809091020(tx *sql.Tx) error {
func Up_20220831100151(tx *sql.Tx) error {
_, err := tx.Exec(`
CREATE TABLE windows_updates (
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
@@ -26,6 +26,6 @@ CREATE TABLE windows_updates (
return nil
}
func Down_20220809091020(tx *sql.Tx) error {
func Down_20220831100151(tx *sql.Tx) error {
return nil
}
@@ -6,7 +6,7 @@ import (
"github.com/stretchr/testify/require"
)
func TestUp_20220809091020(t *testing.T) {
func TestUp_20220831100151(t *testing.T) {
db := applyUpToPrev(t)
applyNext(t, db)
File diff suppressed because one or more lines are too long