You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What is the output of the command above with the -d flag added to it? (Provided you are comfortable sharing this, it contains a blueprint of your schema)
Please provide a relevant database schema so we can replicate your issue (Provided you are comfortable sharing this)
CREATE TABLE IF NOT EXISTS `projects` (
`id` integer NOT NULL,
`name` varchar(128) NOT NULL,
UNIQUE KEY `name` (`name`),
PRIMARY KEY (`id`)
);
CREATE TABLE IF NOT EXISTS `clients` (
`id` integer NOT NULL,
`project_id` integer NOT NULL,
`username` varchar(128) NOT NULL,
`password` varchar(128) NOT NULL,
UNIQUE KEY `username` (`username`),
PRIMARY KEY (`id`),
FOREIGN KEY (`project_id`) REFERENCES `projects` (`id`) ON DELETE CASCADE
);
CREATE TABLE IF NOT EXISTS `permissions` (
`id` integer NOT NULL,
`client_id` integer NOT NULL,
`resource` varchar(128) NOT NULL,
`permission` tinyint(2) NOT NULL,
PRIMARY KEY (`id`),
FOREIGN KEY (`client_id`) REFERENCES `clients` (`id`) ON DELETE CASCADE
);
INSERT INTO `projects` (`id`,`name`) VALUES (1,'test project 1');
INSERT INTO `clients` (`id`,`project_id`,`username`,`password`) VALUES (1,1,'john','secret');
INSERT INTO `permissions` (`id`,`client_id`,`resource`,`permission`) VALUES (1,1,'resource 1',1);
INSERT INTO `permissions` (`id`,`client_id`,`resource`,`permission`) VALUES (2,1,'resource 2',1);
INSERT INTO `permissions` (`id`,`client_id`,`resource`,`permission`) VALUES (3,1,'resource 3',2);
Further information. What did you do, what did you expect?
Currently using MySQL and the following sqlboiler.yml configuration
Eager loading a project including clients and permissions as described above produces the following error
panic: interface conversion: interface {} is *models.ClientSlice, not *[]*models.Client
However, understanding there has been some work on the dev branch that may be related I also tested this branch. Now using the All() finisher instead of One() there is no error (master branch fails using either of them).
Thank you in advance and keep up the good work!
The text was updated successfully, but these errors were encountered:
Thanks for the report. I believe I've fixed this one. If you can confirm using the dev branch I'll make a release with these fixes. That code is really hard to follow (Rob Pike was right about reflection!) so I missed that one when I fixed the other instance :)
What version of SQLBoiler are you using (
sqlboiler --version
)?SQLBoiler v2.4.0
If this happened at generation time what was the full SQLBoiler command you used to generate your models? (if not applicable leave blank)
If this happened at runtime what code produced the issue? (if not applicable leave blank)
What is the output of the command above with the
-d
flag added to it? (Provided you are comfortable sharing this, it contains a blueprint of your schema)Please provide a relevant database schema so we can replicate your issue (Provided you are comfortable sharing this)
Further information. What did you do, what did you expect?
Currently using MySQL and the following sqlboiler.yml configuration
Eager loading a project including clients and permissions as described above produces the following error
However, understanding there has been some work on the dev branch that may be related I also tested this branch. Now using the All() finisher instead of One() there is no error (master branch fails using either of them).
Thank you in advance and keep up the good work!
The text was updated successfully, but these errors were encountered: