Modify

Opened 14 years ago

Last modified 13 years ago

#6223 new defect

Plugin Not Working on Mysql

Reported by: shubham_chakraborty@… Owned by: Matthew Chretien
Priority: high Component: MilestoneTeamsPlugin
Severity: blocker Keywords:
Cc: Trac Release: 0.11

Description

the plugin fails to create milestone_teams table in Mysql db. Upon installation it does show the message of upgradation but internally nothing happens and successful message is shown. Moreover, the query in the file is not Mysql compatible. I tried to run the isolated query in Mysql but it still gives an error.

Can you provide the MySql query alongwith the steps to manually install this.(since auto creation of tables does not occur, env upgrade shows successful message without any real creation of any table. So i might have mnaunally replace all files and create tables.)

Attachments (0)

Change History (3)

comment:1 Changed 14 years ago by anonymous

Created the egg & applied it manually. Created table & worked around that - issue in mySQL is that you cant use a TEXT as a primary key (?) - so created an auto-inc field as a primary key for it... table created fine.

So - plugin appears to load - appears in Admin - displays list of milestones. Drop-downs appear, but when you press "save" it doesnt write anything to the milestone_teams.

Manually created an entry in the milestone_teams table - refreshed the webpage but it doesnt read from the table either.... strange.... so changed the "notify" manually to "1"... ok - now my name appears as the manger.... save still not working... and when I open the edit screen my name is not selected as the manager....

so... "get_milestone_team" appears to be working fine... even with mySQL....

Problem appears to be in ---->

if not self.set_milestone_team(req.args.get('title'), req.args.get('manager'), req.args.get('members')):

this is returning "title" correctly but not returning manager or members....

Would assume that the "save" is the same in "set_milestone_team"

comment:2 Changed 14 years ago by anonymous

Ok - got it mostly working... members is coming up as an array, but am posting back the code...

In DO_DB_UPGRADE(SELF) just change the "CREATE TABLE" to below....

                cursor.execute("""CREATE TABLE milestone_teams (
                    `id` INT NOT NULL AUTO_INCREMENT ,
                    `milestone` TEXT NOT NULL ,
                    `username` TEXT NOT NULL ,
                    `role` INT NULL ,
                    `notify` INT NULL ,
                    PRIMARY KEY (`id`)
                   )""")


In "def set_milestone_team(self, milestone, manager, members)" I made the following changes....

        addquery    = "INSERT INTO milestone_teams (milestone, username, role, notify) VALUES (%s, %s, %s, %s)"
        modquery    = "UPDATE milestone_teams SET username=%s, role=%s, notify=%s WHERE milestone=%s"
        remquery    = "UPDATE milestone_teams SET notify=0 WHERE username=%s"

(I got rid of the "INSERT OR REPLACE"... split into two queries.)

Then when we check the manager..... if the current manager is empty, create the record, else modify it...

            if manager != old_milestone['manager']:
                self.log.info("MilestoneTeams: Adding manager %s to milestone %s" % (manager, milestone))
                if (len(old_milestone['manager']) == 0):
                    cursor.execute(addquery, (milestone, manager, 1, 1))
                else:
                    cursor.execute(modquery, (milestone, manager, 1, 1))

comment:5 Changed 13 years ago by anonymous

Any movement on this besides the code changes posted above?

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain Matthew Chretien.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.