Skip to content

Commit

Permalink
Fix Sqlite3 and Postgres indexes
Browse files Browse the repository at this point in the history
By adding "IF NOT EXISTS" to the "initQueries" structure we remove the case of panic, when the user does not remove the previous table.

Related issue: gofiber/session#13
  • Loading branch information
hugmouse authored and Sergio Andrés Virviescas Santana committed Jul 21, 2020
1 parent cf90c50 commit 91f87be
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions providers/postgre/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ var (
last_active BIGINT NOT NULL DEFAULT '0',
expiration BIGINT NOT NULL DEFAULT '0'
);`,
"CREATE INDEX last_active ON %s (last_active);",
"CREATE INDEX expiration ON %s (expiration);",
"CREATE INDEX IF NOT EXISTS last_active ON %s (last_active);",
"CREATE INDEX IF NOT EXISTS expiration ON %s (expiration);",
}
)

Expand Down
4 changes: 2 additions & 2 deletions providers/sqlite3/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ var (
last_active BIGINT NOT NULL DEFAULT '0',
expiration BIGINT NOT NULL DEFAULT '0'
);`,
"CREATE INDEX last_active ON %s (last_active);",
"CREATE INDEX expiration ON %s (expiration);",
"CREATE INDEX IF NOT EXISTS last_active ON %s (last_active);",
"CREATE INDEX IF NOT EXISTS expiration ON %s (expiration);",
}
)

Expand Down

0 comments on commit 91f87be

Please sign in to comment.