Mhamdans17 commited on
Commit
edff646
·
1 Parent(s): 11fca28

chore: remove test scripts

Browse files
Files changed (3) hide show
  1. drop_table.go +0 -19
  2. kill_locks.go +0 -23
  3. test_migrate.go +0 -35
drop_table.go DELETED
@@ -1,19 +0,0 @@
1
- package main
2
-
3
- import (
4
- "log"
5
- "service-warungpos-go/config"
6
- )
7
-
8
- func main() {
9
- config.LoadConfig()
10
- config.ConnectDatabase()
11
-
12
- log.Println("Dropping point_histories table...")
13
- err := config.DB.Exec(`DROP TABLE IF EXISTS point_histories CASCADE;`).Error
14
- if err != nil {
15
- log.Println("Error dropping table:", err)
16
- }
17
-
18
- log.Println("Done.")
19
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
kill_locks.go DELETED
@@ -1,23 +0,0 @@
1
- package main
2
-
3
- import (
4
- "log"
5
- "service-warungpos-go/config"
6
- )
7
-
8
- func main() {
9
- config.LoadConfig()
10
- config.ConnectDatabase()
11
-
12
- log.Println("Killing ALL other connections to this database...")
13
- err := config.DB.Exec(`
14
- SELECT pg_terminate_backend(pid)
15
- FROM pg_stat_activity
16
- WHERE datname = current_database() AND pid <> pg_backend_pid() AND usename = current_user;
17
- `).Error
18
- if err != nil {
19
- log.Println("Error killing connections:", err)
20
- }
21
-
22
- log.Println("Done killing all connections.")
23
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
test_migrate.go DELETED
@@ -1,35 +0,0 @@
1
- package main
2
-
3
- import (
4
- "log"
5
- "service-warungpos-go/config"
6
- "service-warungpos-go/models"
7
- )
8
-
9
- func main() {
10
- config.LoadConfig()
11
- config.ConnectDatabase()
12
-
13
- log.Println("Running Auto-Migration Test...")
14
- err := config.DB.AutoMigrate(
15
- &models.Company{},
16
- &models.Branch{},
17
- &models.User{},
18
- &models.Category{},
19
- &models.Product{},
20
- &models.BranchProduct{},
21
- &models.Order{},
22
- &models.OrderItem{},
23
- &models.OTP{},
24
- &models.Setting{},
25
- &models.Member{},
26
- &models.PointRule{},
27
- &models.WalletTransaction{},
28
- &models.TopupRequest{},
29
- &models.PointHistory{},
30
- )
31
- if err != nil {
32
- log.Fatalf("Gagal melakukan Auto-Migration: %v", err)
33
- }
34
- log.Println("Auto-Migration Selesai dengan Sukses!")
35
- }