You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: postgres/postgres.go
+74-16Lines changed: 74 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -26,19 +26,31 @@ type Storage struct {
26
26
}
27
27
28
28
var (
29
-
checkSchemaMsg="The `v` row has an incorrect data type. "+
30
-
"It should be BYTEA but is instead %s. This will cause encoding-related panics if the DB is not migrated (see https://github.com/gofiber/storage/blob/main/MIGRATE.md)."
31
-
dropQuery=`DROP TABLE IF EXISTS %s;`
29
+
checkSchemaMsg="The `%s` row has an incorrect data type. "+
30
+
"It should be %s but is instead %s. This will cause encoding-related panics if the DB is not migrated (see https://github.com/gofiber/storage/blob/main/MIGRATE.md)."
31
+
dropQuery=`DROP TABLE IF EXISTS %s;`
32
+
checkTableExistsQuery=`SELECT COUNT(table_name)
33
+
FROM information_schema.tables
34
+
WHERE table_schema = '%s'
35
+
AND table_name = '%s';`
32
36
initQuery= []string{
33
-
`CREATE TABLE IF NOT EXISTS %s (
37
+
`CREATE TABLE %s (
34
38
k VARCHAR(64) PRIMARY KEY NOT NULL DEFAULT '',
35
39
v BYTEA NOT NULL,
36
40
e BIGINT NOT NULL DEFAULT '0'
37
41
);`,
38
42
`CREATE INDEX IF NOT EXISTS e ON %s (e);`,
39
43
}
40
-
checkSchemaQuery=`SELECT DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS
0 commit comments