another strange behaviour, at least in my opinion, is that if i define a
column to be auto_increment i expect the insert statements to take care of
the incrementation of the column if i omit it,
for example I define a table
Table("ttmsd_webhook_types", key=("id"))[
Column("id", type="int",auto_increment=True),
Column("name", type="text"),],
then I expect to pass data to insert_into_table to work with a tuple like
("ttmsd_webhook_types",
("name"),
(("MS Teams",),
("Discord",))
)
but it doesnt, it give me a IndexError: tuple index out of range error and
i need to define my tuple like
("ttmsd_webhook_types",
("id","name"),
((1,"MS Teams",),
(2,"Discord",))
)
for initial data that should be fine since i know what i add but if i want
to update my types later on I always need to get the count of the id
sequence first to not mess up.
Or do I simply miss stuff here ???
Cheers
MArkus
Am So., 29. Jan. 2023 um 09:52 Uhr schrieb Markus Rosjat <
markus.rosjat@gmail.com>:
> btw I see a lot of Table definitions and i figure the key is like the
> primary key for the table but does trac implementation of table and column
> has the concept of a foreign key or is this something we need to check in
> the code ?
>
> for example the ticket tables, ticket table has an id and related table
> have a column ticket that seems to be the ref to the tickek id but i
> dont see any definition of a foreign key so i there seems to be no
> integrity checks? This in turn defeats the
> whole purpose of a releational database.
>
> cheers
>
> Markus
>
> Am So., 29. Jan. 2023 um 09:33 Uhr schrieb Markus Rosjat <
> markus.rosjat@gmail.com>:
>
>> hey jun,
>>
>> yeah i do look at examples, problem for me was it never really triggered
>> the upgrade so i spend yesterday getting something to work. I have now
>> something that looks like the example in general but with a lot of hacky
>> stuff from other plugins like TagsTrac. So i will try to clean up my code
>> to a version that works in a "cleaner" way i guess.
>>
>> Cheers
>>
>> MArkus
>>
>> Am So., 29. Jan. 2023 um 06:55 Uhr schrieb Jun Omae <jun66j5@gmail.com>:
>>
>>> On Sun, Jan 29, 2023 at 6:12 AM Markus Rosjat <markus.rosjat@gmail.com>
>>> wrote:
>>> >
>>> > hi list,
>>> >
>>> > is there any kind of "sane" example how to archive this task? the
>>> upgrade section for the database
>>> > is, at least for a dummy like me, not in the slidest useful.
>>> >
>>> > the update section in TracDev desnt help at all since you can'T get
>>> behind the magic that would give you a pointer to a "fresh" creation of a
>>> table for a plugin.
>>> >
>>> > a example with the necessary steps in the IEnvironmentSetupParticipant
>>> functions
>>> > would help a lot.
>>> >
>>> > cheers
>>> >
>>> > MArkus
>>>
>>> Have you check out examples for db upgrades in
>>>
>>> https://trac.edgewall.org/wiki/TracDev/PluginDevelopment/ExtensionPoints/trac.env.IEnvironmentSetupParticipant#DBupgrades
>>> ?
>>>
>>> --
>>> Jun Omae <jun66j5@gmail.com> (?? ?)
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Trac Users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to trac-users+unsubscribe@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/trac-users/CAEVLMag7Cjvy6Xf2Xo3TnpbZrg0DJdq0JogK1iS5vMt4Y1bfQw%40mail.gmail.com
>>> .
>>>
>>
--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/trac-users/CAJ4osOm%2BnV30mgopiORKFEtAWownkU234QDe7Oxa-tSdncuhmA%40mail.gmail.com.