2022-11-29 19:55:00 -07:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2024-05-11 14:24:49 -06:00
|
|
|
"context"
|
2022-11-29 19:55:00 -07:00
|
|
|
"database/sql"
|
|
|
|
"log"
|
|
|
|
|
|
|
|
"suah.dev/gostart/data"
|
|
|
|
)
|
|
|
|
|
2022-12-21 19:23:44 -07:00
|
|
|
func tmpDBPopulate(db *sql.DB) error {
|
2024-05-11 14:24:49 -06:00
|
|
|
ctx := context.Background()
|
2022-12-02 20:53:05 -07:00
|
|
|
log.Println("CREATING TEMP DATABASE!")
|
2024-05-11 14:24:49 -06:00
|
|
|
if _, err := db.ExecContext(ctx, schema); err != nil {
|
2022-12-21 19:23:44 -07:00
|
|
|
return err
|
2022-11-29 19:55:00 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
ownerID := int64(57395170551826799)
|
|
|
|
|
2024-05-11 14:24:49 -06:00
|
|
|
_, err := app.queries.AddOwner(ctx, data.AddOwnerParams{
|
2022-12-21 20:51:54 -07:00
|
|
|
ID: 57395170551826799,
|
|
|
|
Name: "europa.humpback-trout.ts.net.",
|
|
|
|
ShowShared: true,
|
2022-11-29 19:55:00 -07:00
|
|
|
})
|
2022-11-29 20:45:48 -07:00
|
|
|
if err != nil {
|
2022-12-21 19:23:44 -07:00
|
|
|
return err
|
2022-11-29 20:45:48 -07:00
|
|
|
}
|
2024-05-11 14:24:49 -06:00
|
|
|
_, err = app.queries.AddLink(ctx, data.AddLinkParams{
|
2022-11-29 19:55:00 -07:00
|
|
|
OwnerID: ownerID,
|
|
|
|
Url: "https://tapenet.org",
|
|
|
|
Name: "Tape::Net",
|
2022-12-21 19:23:44 -07:00
|
|
|
Shared: true,
|
2022-12-02 20:53:05 -07:00
|
|
|
LogoUrl: "https://git.tapenet.org/assets/img/logo.svg",
|
2022-11-29 19:55:00 -07:00
|
|
|
})
|
2022-12-21 19:23:44 -07:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
2022-11-29 19:55:00 -07:00
|
|
|
|
2024-05-11 14:24:49 -06:00
|
|
|
_, err = app.queries.AddPullRequest(ctx, data.AddPullRequestParams{
|
2022-12-02 20:53:05 -07:00
|
|
|
OwnerID: ownerID,
|
|
|
|
Number: 1234,
|
|
|
|
Repo: "NixOS/nixpkgs",
|
2022-11-29 19:55:00 -07:00
|
|
|
})
|
2022-11-29 20:45:48 -07:00
|
|
|
if err != nil {
|
2022-12-21 19:23:44 -07:00
|
|
|
return err
|
2022-11-29 20:45:48 -07:00
|
|
|
}
|
2024-05-11 14:24:49 -06:00
|
|
|
_, err = app.queries.AddWatchItem(ctx, data.AddWatchItemParams{
|
2022-11-29 19:55:00 -07:00
|
|
|
Name: "tailscale",
|
2022-11-29 20:45:48 -07:00
|
|
|
Repo: "NixOS/nixpkgs",
|
2022-11-29 19:55:00 -07:00
|
|
|
OwnerID: ownerID,
|
|
|
|
})
|
2022-11-29 20:45:48 -07:00
|
|
|
if err != nil {
|
2022-12-21 19:23:44 -07:00
|
|
|
return err
|
2022-11-29 20:45:48 -07:00
|
|
|
}
|
2022-12-21 19:23:44 -07:00
|
|
|
|
|
|
|
log.Println("Done setting up tmp DB")
|
|
|
|
return nil
|
2022-11-29 19:55:00 -07:00
|
|
|
}
|