Modify

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#12128 closed defect (fixed)

Project deletion does not remove info from other database tables

Reported by: Cinc Owned by: falkb
Priority: normal Component: SimpleMultiProjectPlugin
Severity: normal Keywords:
Cc: Trac Release:

Description

When deleting a project from the admin panel only self.__SmpModel.delete_project([id]) is called. The association of milestones to projects in database table smp_milestone_project isn't removed. Same is probably true for the version table.

Attachments (2)

model_12128.patch (1.9 KB) - added by Cinc 10 years ago.
Patch: remove project info from other database tables.
model.py (24.1 KB) - added by Cinc 10 years ago.
Complete file: remove project info from other database tables.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 10 years ago by Cinc

The following patch should do the job:

  • Requirements-Trac/Trac/Plugins/SimpleMultiProject-0.0.4dev-py2.7.egg/simplemultiproject/model.py

     
    226226            for id in ids_projects:
    227227                query = """DELETE FROM smp_project WHERE id_project=%s"""
    228228                cursor.execute(query, [id])
     229                query = """DELETE FROM smp_milestone_project WHERE id_project=%s;"""
     230                cursor.execute(query, [id])
     231                query = """DELETE FROM smp_version_project WHERE id_project=%s;"""
     232                cursor.execute(query, [id])
     233                query = """DELETE FROM smp_component_project WHERE id_project=%s;"""
     234                cursor.execute(query, [id])
    229235            self.__start_transaction(db)
     236
    230237        else:
    231238            @with_transaction(self.env)
    232239            def execute_sql_statement(db):
    233240                cursor = db.cursor()
    234241                for id in ids_projects:
    235242                    query = """DELETE FROM smp_project WHERE id_project=%s"""
     243                    cursor.execute(query, [id])
     244                    query = """DELETE FROM smp_milestone_project WHERE id_project=%s;"""
     245                    cursor.execute(query, [id])
     246                    query = """DELETE FROM smp_version_project WHERE id_project=%s;"""
     247                    cursor.execute(query, [id])
     248                    query = """DELETE FROM smp_component_project WHERE id_project=%s;"""
    236249                    cursor.execute(query, [id])
    237250
    238251    def update_project(self, id, name, summary, description, closed, restrict):

Changed 10 years ago by Cinc

Attachment: model_12128.patch added

Patch: remove project info from other database tables.

Changed 10 years ago by Cinc

Attachment: model.py added

Complete file: remove project info from other database tables.

comment:2 Changed 10 years ago by falkb

Resolution: fixed
Status: newclosed

In 14358:

patch by Cinc fixes #12128, thanks a lot for this contribution!

comment:3 Changed 10 years ago by falkb

Looked good, tested with 1.0 and 0.12. Thanks Cinc! Do you have any more plans?

comment:4 Changed 10 years ago by Cinc

I'm currently looking into #11160. That is a really easy one. Almost done with it.

#10089 would be nice to have (project specific wiki pages) but that's quite complicated. There is a reason why Trac doesn't support multiproject out of the box.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain falkb.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


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

 
Note: See TracTickets for help on using tickets.