forked from joseavilasg/teldrive
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
divyam234
committed
Nov 2, 2023
1 parent
f2ca516
commit 2533234
Showing
13 changed files
with
204 additions
and
124 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
-- +goose Up | ||
-- +goose StatementBegin | ||
|
||
ALTER TABLE teldrive.users DROP COLUMN IF EXISTS tg_session; | ||
|
||
CREATE TABLE teldrive.sessions ( | ||
session text NOT NULL, | ||
user_id bigint NOT NULL, | ||
hash text NOT NULL, | ||
created_at timestamp null default timezone('utc'::text,now()), | ||
PRIMARY KEY(session, hash), | ||
FOREIGN KEY (user_id) REFERENCES teldrive.users(user_id) | ||
); | ||
|
||
-- +goose StatementEnd | ||
|
||
-- +goose Down | ||
-- +goose StatementBegin | ||
DROP TABLE IF EXISTS teldrive.sessions; | ||
-- +goose StatementEnd |
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,12 @@ | ||
package models | ||
|
||
import ( | ||
"time" | ||
) | ||
|
||
type Session struct { | ||
UserId int64 `gorm:"type:bigint;primaryKey"` | ||
Hash string `gorm:"type:text"` | ||
Session string `gorm:"type:text"` | ||
CreatedAt time.Time `gorm:"default:timezone('utc'::text, now())"` | ||
} |
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
Oops, something went wrong.