[07:05] *** patrickb joined [07:53] o/ [07:56] I'm pretty sure Red fails to do "-" -> "_" conversion somewhere in INSERT statement creation on the SQLite backend. Any clues on where to look? [07:57] Is that a drivers responsibility? [08:00] it should be done here: https://github.com/FCO/Red/blob/master/lib/Red/Driver/CommonSQL.pm6#L172 [08:01] have you used `my $*RED-DEBUG = True;` to see the generated SQL? [08:01] yes [08:01] patrickb: ^^ [08:03] would you mind to share the code with that problem. please? [08:03] https://nopaste.chaoz-irc.net/view/3c58b1ed [08:04] https://nopaste.chaoz-irc.net/view/8b2e1063 <- that's the table class [08:05] all those DB::Stuff thingies are enums [08:07] https://nopaste.chaoz-irc.net/view/d1439ed1 <- that's the full Schema [08:07] it seems event-top is not being set... [08:08] oh! MAIN_BANCH is the enum? [08:08] also source-retrieval-retries is still set to its default value [08:08] I mean, is MAIN_BRANCH the enum? [08:09] project is also an enum, and that is set [08:10] so my thesis is, it silently ignores attributes with - in them [08:10] commit-sha is also missing [08:10] it seems a deeper problem... it seems it's not understanding enums... (I don't remember of testing enums...) [08:11] it is well possible enums also don't work, but I'm really sure it also fails to deal with - in attributes [08:12] commit-sha is a plain string column. It's missing. source-retrieval-retries is a plain Int column, its passed value is ignored and the default value applied [08:12] I've already had many problems forgetting to do the transformation from kebabcase to snake case on Red's code... I thought it was fixed... but it's possible I've forgot it somewhere else... [08:12] what's your Red version? [08:13] project on the other hand is *not* missing [08:13] 0.1.44 [08:14] I'll need to investigate that... [08:15] are there any hopes for enums to somehow work? (once the - _ thing is solved?) [08:15] I'll try to fix that as soon as possible... would you mind to open an issue with that, please? [08:15] will do [08:16] if you continue trying to find the problem, and you fix that, please PR it [08:22] I'll have another quick look, but won't spend much time on it. I guess you'll be a lot quicker than me in finding the problem. [08:22] thank you! [08:23] https://github.com/FCO/Red/issues/487 [08:24] thanks! [08:30] Isn't it possible to specify a column name different from the attribute? `is column 'col-name'> or something like that? [08:36] yes, exactly that [08:36] SmokeMachine: Thanks for your work and caring for the users of Red. This is much appreciated and not taken for granted. [08:36] :) [08:49] patrickb: one example of renaming a column: https://github.com/FCO/Red/blob/658511fd434d2689eec71c79cf48499507fadc6c/t/02-tdd.t#L93 [08:55] how can I give a `referencing` a name? [09:01] at the same way, `is referencing(*.id, :model)` is just a fancy way of doing a `is column{ :references{ .id }, :model-name}` ... for example: https://github.com/FCO/Red/blob/658511fd434d2689eec71c79cf48499507fadc6c/t/24-metamodel-model.t#L31 [09:03] patrickb: ^^ [10:20] SmokeMachine: I think you were right. It's actually the enums that cause this, not the "-". [10:21] :) and :( at the same time... :) [10:23] I don't remember testing it with enums... I think I've completely forgot about them... I only thought about creating tables from the enums... but haven't implemented that... [10:24] patrickb: https://github.com/FCO/Red/issues/34 [10:25] Hm. Couldn't it just do a very thin mapping to Plain ints? [10:26] I think we should support all of those options... (but we could start with the mapping to the enum's value...) [10:27] what do you think? [10:28] for now, you maybe could use custom inflators and deflators for that (while that's not implemented) [10:29] I suspect that would cover most uses. I guess one typically would want enums to just list alternatives. Especially in the context of a DB. For that case just writing the enum value to the DB is the obvious solution. [10:29] a custom inflator/deflator example: https://github.com/FCO/Red/blob/658511fd434d2689eec71c79cf48499507fadc6c/examples/blog2/Post.rakumod#L11 [10:30] Thanks! I'll have a look. [10:31] Is it possible to provide inflators / deflators for a type instead of a column? Quite some typing otherwise... [10:36] It's planed to be possible... currently we have a hardcoded one... https://github.com/FCO/Red/blob/master/lib/Red/Type/Json.pm6 [10:39] So can I implement such a Type class myself and just reference it in `is column{}`? [10:41] I don't think that will be that easy... if I remember well Json was kind special... and I was still trying to find a goodly to generalize that... [10:42] and Json isn't defined on `is column{}` but on the attribute itself, for example: https://github.com/FCO/Red/blob/658511fd434d2689eec71c79cf48499507fadc6c/t/36-json.t#L15 [10:43] (I really need to improve the documentation...) [10:46] patrickb: can I ask you a favor? if you learning something you find useful while testing Red, would you mind to write. piece of documentation about that and PR it? My poor English make it too hard to me to write documentation... (if any other person would like to also help me on that, I'd thank a lot) [11:05] Will see what I can do [11:06] thank you very much! [11:35] I have now added respective inflators and deflators to my schema and the values in the generated SQL are now properly deflated. But the SQL still only includes default values. All values I passed to the Object constructor are still missing in the SQL. [11:35] This is such an obvious problem that I suspect I'm doing something quite obvious wrong. [11:36] odd, can I see your code? [11:37] https://nopaste.linux-dev.org/?1335494 [11:38] ok, that's it! [11:38] there are 2 options to insert data on database: [11:39] 1 - `Model.new(:col1, :col2).^save` [11:39] 2 - `Model.^create(:col1, :col2)` [11:39] ouch [11:40] when you do `Model.new(...).^create` you are calling `Model.^create` without any parameter [11:41] is it possible that's the problem since the beginning? (sorry for not seeing that before) [11:41] Is it possible to forbid ^create on a defined object? [11:41] well, the inflators and deflators are probably still necessary. [11:41] yes... I think that's a good idea [11:42] would you mind to open a new issue, please? [11:42] :-) [11:42] (I mean for forbidding .^create on defined obj) [11:44] https://github.com/FCO/Red/issues/488 [11:44] thanks! [11:46] for creating/updating/deleting rows, we have a documentation page: https://fco.github.io/Red/tutorials/start.html [11:47] have you already seen this? https://fco.github.io/Red/ [11:47] (almost everything is missing there... but that's a start...) [11:47] I have read through most of it, yes. [13:09] *** abraxxa left [19:46] SmokeMachine: https://github.com/FCO/Red/issues/490 [19:46] This has haunted me for the last few hours. [19:48] SmokeMachine: I suspect it's a rakudo bug, but it makes sense that you have a look first, as I think you can pinpoint better where things go wrong. [20:05] Have you tried adding `use Red:api<2>` to CITestSetManager.rakumod? [20:06] Without that the operators are not being override… [20:06] patrickb: ^^ [20:08] Works. Thanks! [20:08] But that error is completely LTA… [20:08] The failure mode is... suboptimal. [20:08] Yes, it is [20:08] Yeah... [20:09] Would you mind to add that tou tour issue, please? [20:09] Sorry and thanks for finding all these issues! :) [20:13] I really need some help finding and fixing Red issues… [20:33] Done [20:49] thanks! [21:39] *** patrickb left