Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

本地启动了之后发现数据库里没有表 #19

Open
lucky4yf opened this issue Mar 20, 2023 · 6 comments
Open

本地启动了之后发现数据库里没有表 #19

lucky4yf opened this issue Mar 20, 2023 · 6 comments

Comments

@lucky4yf
Copy link

本地clone代码后,执行了build.sh install,启动后项目可以正常打开,但是数据库里没有表和数据

有没有在用的朋友分享一个sql文件

@yingzihezhuzhu
Copy link

image

@lucky4yf
Copy link
Author

lucky4yf commented May 8, 2023

图像

这两个sql文件我看了,里面都是insert语句,没有create table

@yingzihezhuzhu
Copy link

我这边是手动建了一个库,fiy;这个库不创建的话,好像不行。
然后表的话是自动创建的;我这边执行了这个命令,你可以试一下。
image

@lucky4yf
Copy link
Author

lucky4yf commented May 8, 2023

我这边是手动建了一个库,fiy;这个库不创建的话,好像不行。 然后表的话是自动创建的;我这边执行了这个命令,你可以试一下。 image

试过了,用本地root账号建的库,然后配置文件用的也是root账号,启动了之后没有,我也是看到了文档这么说的,结果试了一下没表,才来提issues

@jakehu
Copy link

jakehu commented Jun 12, 2023

数据有问题吧,估计得手动修正数据

[14.812ms] [rows:0] INSERT INTO `sys_casbin_rule` (`p_type`,`v0`,`v1`,`v2`,`v3`,`v4`,`v5`) VALUES ('p','admin','/api/v1/config','GET','','','')
2023/06/12 11:19:30 Error 3098: The table does not comply with the requirements by an external plugin.
exit status 1

@jakehu
Copy link

jakehu commented Jun 12, 2023

加了个主键成功了

type CasbinRule struct {
	CasbinId int    `gorm:"primary_key;auto_increment;" json:"casbinId"`
	PType    string `json:"p_type" gorm:"size:100;"`
	V0       string `json:"v0" gorm:"size:100;"`
	V1       string `json:"v1" gorm:"size:100;"`
	V2       string `json:"v2" gorm:"size:100;"`
	V3       string `json:"v3" gorm:"size:100;"`
	V4       string `json:"v4" gorm:"size:100;"`
	V5       string `json:"v5" gorm:"size:100;"`
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants