forked from pocketbase/pocketbase
-
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.
[pocketbase#282] added the "real" user ip to the logs
- Loading branch information
1 parent
9bf66be
commit cfaff31
Showing
19 changed files
with
241 additions
and
146 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package logs | ||
|
||
import ( | ||
"github.com/pocketbase/dbx" | ||
) | ||
|
||
func init() { | ||
LogsMigrations.Register(func(db dbx.Builder) error { | ||
// delete old index (don't check for error because of backward compatability with old installations) | ||
db.DropIndex("_requests", "_request_ip_idx").Execute() | ||
|
||
// rename ip -> remoteIp | ||
if _, err := db.RenameColumn("_requests", "ip", "remoteIp").Execute(); err != nil { | ||
return err | ||
} | ||
|
||
// add new userIp column | ||
if _, err := db.AddColumn("_requests", "userIp", `TEXT DEFAULT "127.0.0.1" NOT NULL`).Execute(); err != nil { | ||
return err | ||
} | ||
|
||
// add new indexes | ||
if _, err := db.CreateIndex("_requests", "_request_remote_ip_idx", "remoteIp").Execute(); err != nil { | ||
return err | ||
} | ||
if _, err := db.CreateIndex("_requests", "_request_user_ip_idx", "userIp").Execute(); err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
}, func(db dbx.Builder) error { | ||
// delete new indexes | ||
if _, err := db.DropIndex("_requests", "_request_remote_ip_idx").Execute(); err != nil { | ||
return err | ||
} | ||
if _, err := db.DropIndex("_requests", "_request_user_ip_idx").Execute(); err != nil { | ||
return err | ||
} | ||
|
||
// drop userIp column | ||
if _, err := db.DropColumn("_requests", "userIp").Execute(); err != nil { | ||
return err | ||
} | ||
|
||
// restore original remoteIp column name | ||
if _, err := db.RenameColumn("_requests", "remoteIp", "ip").Execute(); err != nil { | ||
return err | ||
} | ||
|
||
// restore original index | ||
if _, err := db.CreateIndex("_requests", "_request_ip_idx", "ip").Execute(); err != nil { | ||
return err | ||
} | ||
|
||
return nil | ||
}) | ||
} |
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
Binary file not shown.
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
2 changes: 1 addition & 1 deletion
2
ui/dist/assets/CodeEditor.6a766e2d.js → ui/dist/assets/CodeEditor.f0bf9689.js
Large diffs are not rendered by default.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...ssets/FilterAutocompleteInput.7ac53d63.js → ...ssets/FilterAutocompleteInput.9df887af.js
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.