-
Notifications
You must be signed in to change notification settings - Fork 938
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
all: migrate executed command logging away from gorm to sqlboiler (#1654
) * common: add schemas for executed command logs * common: configure and run sqlboiler for executed command log model * all: migrate executed command logging to sqlboiler
- Loading branch information
1 parent
3615e45
commit e0960d9
Showing
11 changed files
with
1,064 additions
and
58 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package common | ||
|
||
var ExecutedCommandDBSchemas = []string{` | ||
CREATE TABLE IF NOT EXISTS executed_commands ( | ||
id SERIAL PRIMARY KEY, | ||
created_at TIMESTAMP WITH TIME ZONE NOT NULL, | ||
updated_at TIMESTAMP WITH TIME ZONE NOT NULL, | ||
user_id TEXT NOT NULL, -- text not bigint for legacy compatibility | ||
channel_id TEXT NOT NULL, | ||
guild_id TEXT, | ||
command TEXT NOT NULL, | ||
raw_command TEXT NOT NULL, | ||
error TEXT, | ||
time_stamp TIMESTAMP WITH TIME ZONE NOT NULL, | ||
response_time BIGINT NOT NULL | ||
); | ||
`, ` | ||
-- Preexisting tables created prior to sqlboiler are missing non-null constraints, | ||
-- so add them retraoctively. | ||
ALTER TABLE executed_commands ALTER COLUMN created_at SET NOT NULL; | ||
`, ` | ||
ALTER TABLE executed_commands ALTER COLUMN updated_at SET NOT NULL; | ||
`, ` | ||
ALTER TABLE executed_commands ALTER COLUMN user_id SET NOT NULL; | ||
`, ` | ||
ALTER TABLE executed_commands ALTER COLUMN channel_id SET NOT NULL; | ||
`, ` | ||
ALTER TABLE executed_commands ALTER COLUMN command SET NOT NULL; | ||
`, ` | ||
ALTER TABLE executed_commands ALTER COLUMN raw_command SET NOT NULL; | ||
`, ` | ||
ALTER TABLE executed_commands ALTER COLUMN time_stamp SET NOT NULL; | ||
`, ` | ||
ALTER TABLE executed_commands ALTER COLUMN response_time SET NOT NULL; | ||
`} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.