#Error [1146]: table ‘XXXs.Xxx’ doesn’t exist (How to Solve)

Error [1146]: table ‘XXXs. Xxx’ doesn’t exist causes and Solutions

When I connect to the database, I don’t enable the default singular representation. Therefore, when the database migration is automatically created, the production represents the plural videos. In fact, when I add, delete, modify, query and call the database, I use the singular form, so I can’t find or create the database table

	DB, err = gorm.Open(mysql.Open(dsn), &gorm.Config{
		QueryFields:            true, //print sql
		SkipDefaultTransaction: true, //Disabling mysql transactions
		NamingStrategy: schema.NamingStrategy{
			SingularTable: true, // Use singular table names
		},
	})

In order to avoid, I change it into singular form

//Automatic creation of video links tableVideo
DB.AutoMigrate(&model.Video{})

Similar Posts: