Skip to content

Commit

Permalink
Updated fields
Browse files Browse the repository at this point in the history
Signed-off-by: Eswar Rajan Subramanian <[email protected]>
  • Loading branch information
seswarrajan committed Jul 1, 2022
1 parent d7bb811 commit 87a0778
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
9 changes: 4 additions & 5 deletions src/libs/mysqlHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,6 @@ func insertSystemPolicy(cfg types.ConfigDB, db *sql.DB, policy types.KnoxSystemP
return err
}
defer stmt.Close()
time := ConvertStrToUnixTime("now")

specPointer := &policy.Spec
spec, err := json.Marshal(specPointer)
Expand All @@ -389,8 +388,8 @@ func insertSystemPolicy(cfg types.ConfigDB, db *sql.DB, policy types.KnoxSystemP
policy.Metadata["status"],
policy.Outdated,
spec,
time,
time,
ConvertStrToUnixTime("now"),
ConvertStrToUnixTime("now"),
true)
if err != nil {
return err
Expand Down Expand Up @@ -536,8 +535,8 @@ func CreateTableSystemPolicyMySQL(cfg types.ConfigDB) error {
" `status` varchar(10) DEFAULT NULL," +
" `outdated` varchar(50) DEFAULT NULL," +
" `spec` JSON DEFAULT NULL," +
" `generatedTime` bigint DEFAULT NULL," +
" `updatedTime` bigint DEFAULT NULL," +
" `generatedTime` bigint NOT NULL," +
" `updatedTime` bigint NOT NULL," +
" `latest` BOOLEAN," +
" PRIMARY KEY (`id`)" +
" );"
Expand Down
9 changes: 4 additions & 5 deletions src/libs/sqliteHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,6 @@ func insertSystemPolicySQLite(cfg types.ConfigDB, db *sql.DB, policy types.KnoxS
return err
}
defer stmt.Close()
time := ConvertStrToUnixTime("now")

specPointer := &policy.Spec
spec, err := json.Marshal(specPointer)
Expand All @@ -379,8 +378,8 @@ func insertSystemPolicySQLite(cfg types.ConfigDB, db *sql.DB, policy types.KnoxS
policy.Metadata["status"],
policy.Outdated,
spec,
time,
time,
ConvertStrToUnixTime("now"),
ConvertStrToUnixTime("now"),
true)
if err != nil {
return err
Expand Down Expand Up @@ -514,8 +513,8 @@ func CreateTableSystemPolicySQLite(cfg types.ConfigDB) error {
" `status` varchar(10) DEFAULT NULL," +
" `outdated` varchar(50) DEFAULT NULL," +
" `spec` JSON DEFAULT NULL," +
" `generatedTime` bigint DEFAULT NULL," +
" `updatedTime` bigint DEFAULT NULL," +
" `generatedTime` bigint NOT NULL," +
" `updatedTime` bigint NOT NULL," +
" `latest` BOOLEAN," +
" PRIMARY KEY (`id`)" +
" );"
Expand Down

0 comments on commit 87a0778

Please sign in to comment.