repos / git-pr

a self-hosted git collaboration server
git clone https://github.com/picosh/git-pr.git

commit
fb66264
parent
03dd883
author
Eric Bower
date
2024-06-25 10:23:28 -0400 EDT
feat: banned
1 files changed,  +8, -13
M db.go
M db.go
+8, -13
 1@@ -1,6 +1,7 @@
 2 package git
 3 
 4 import (
 5+	"database/sql"
 6 	"fmt"
 7 	"log/slog"
 8 	"time"
 9@@ -18,12 +19,11 @@ type User struct {
10 }
11 
12 type Acl struct {
13-	ID         int64     `db:"id"`
14-	UserID     int64     `db:"user_id"`
15-	Pubkey     string    `db:"pubkey"`
16-	IpAddress  string    `db:"ip_address"`
17-	Permission string    `db:"permission"`
18-	CreatedAt  time.Time `db:"created_at"`
19+	ID         int64          `db:"id"`
20+	Pubkey     sql.NullString `db:"pubkey"`
21+	IpAddress  sql.NullString `db:"ip_address"`
22+	Permission string         `db:"permission"`
23+	CreatedAt  time.Time      `db:"created_at"`
24 }
25 
26 // PatchRequest is a database model for patches submitted to a Repo.
27@@ -85,15 +85,10 @@ CREATE TABLE IF NOT EXISTS app_users (
28 
29 CREATE TABLE IF NOT EXISTS acl (
30   id INTEGER PRIMARY KEY AUTOINCREMENT,
31-  user_id INTEGER,
32   pubkey string,
33   ip_address string,
34-  permission string,
35-  created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
36-  CONSTRAINT acl_user_id_fk
37-    FOREIGN KEY(user_id) REFERENCES app_users(id)
38-    ON DELETE CASCADE
39-    ON UPDATE CASCADE
40+  permission string NOT NULL,
41+  created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
42 );
43 
44 CREATE TABLE IF NOT EXISTS patch_requests (