update migrate
This commit is contained in:
17
main.go
17
main.go
@@ -5,10 +5,11 @@ import (
|
||||
"log"
|
||||
"net/http"
|
||||
|
||||
"t/ent"
|
||||
"t/ent/ogent"
|
||||
"api/ent"
|
||||
"api/ent/ogent"
|
||||
"entgo.io/ent/dialect"
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
"entgo.io/ent/dialect/sql/schema"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -50,14 +51,20 @@ func (h handler) DrawDone(ctx context.Context, params ogent.DrawDoneParams) erro
|
||||
|
||||
func main() {
|
||||
// Create ent client.
|
||||
client, err := ent.Open(dialect.SQLite, "file:/data/ent.sqlite?_fk=1")
|
||||
client, err := ent.Open(dialect.SQLite, "file:/app/data/new.sqlite?_fk=1")
|
||||
//client, err := ent.Open(dialect.SQLite, "file:data/new.sqlite?_fk=1")
|
||||
//client, err := ent.Open(dialect.SQLite, "file:data?mode=memory&cache=shared&_fk=1")
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
// Run the migrations.
|
||||
if err := client.Schema.Create(context.Background()); err != nil {
|
||||
log.Fatal(err)
|
||||
//if err := client.Schema.Create(context.Background()); err != nil {
|
||||
// log.Fatal(err)
|
||||
//}
|
||||
ctx := context.Background()
|
||||
err = client.Schema.Create(ctx, schema.WithAtlas(true))
|
||||
if err != nil {
|
||||
log.Fatalf("failed creating schema resources: %v", err)
|
||||
}
|
||||
// Create the handler.
|
||||
h := handler{
|
||||
|
Reference in New Issue
Block a user