GORM Playground Link

https://github.com/go-gorm/playground/pull/1

Description

I try to initial the database file when the program is running. but I got an error which is database is locked when I run it in linux/ubuntu 16.04 x86 amd64.

My code

package main

import (
    "gorm.io/driver/sqlite"
    "gorm.io/gorm"
    "log"
)

type Student struct {
    Id   int    `gorm:"column:id;type:int;primaryKey;not null;autoIncrement;comment:id" json:"id"`
    Name string `gorm:"column:name;type:varchar(64);comment:name" json:"name"`
    Age  int    `gorm:"column:age;uniqueIndex;type:int;comment:age" json:"age"`
}

func (u Student) TableName() string {
    return "t_student"
}

func main() {
    db, err := gorm.Open(sqlite.Open("test.db"), &gorm.Config{})
    if err != nil {
        log.Panic(err)
    }
    er := db.AutoMigrate(new(Student))
    if er != nil {
        log.Println(er)
    }
}

Log for it

root@ubuntu:~/gorm-sqlite3# go build -o tt commsns.com/gorm
root@ubuntu:~/gorm-sqlite3# ./tt

2022/01/18 18:33:39 /root/gorm-sqlite3/main.go:28 database is locked
[5027.352ms] [rows:0] CREATE TABLE `t_student` (`id` integer NOT NULL,`name` varchar(64),`age` integer,PRIMARY KEY (`id`))
2022/01/18 18:33:39 database is locked

and my gorm version is v1.22.5, sqlite driver version is v1.2.6

Comment From: github-actions[bot]

The issue has been automatically marked as stale as it missing playground pull request link, which is important to help others understand your issue effectively and make sure the issue hasn't been fixed on latest master, checkout https://github.com/go-gorm/playground for details. it will be closed in 2 days if no further activity occurs. if you are asking question, please use the Question template, most likely your question already answered https://github.com/go-gorm/gorm/issues or described in the document https://gorm.io ✨ Search Before Asking