-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[ADD] migrate database_cleanup #469
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
aa38f9d
[IMP] allow to select lines to purge in a tree view
hbrunn d527c0b
[IMP] adaptto upstream changes
hbrunn ece76e7
[ADD] migrate database_cleanup
hbrunn 45f0ee3
[FIX] typo
hbrunn 4ef48d7
[ADD] test purging modules
hbrunn faa4428
[ADD] test purging tables
hbrunn 03dbdcf
[IMP] review
hbrunn 908c1ed
[FIX] more review
hbrunn 50e09ad
[FIX] replace string formatted sql statements
hbrunn b7308cf
[IMP] only commit where absolutely necessary, mute pylint there
hbrunn 11b5942
[IMP] update README
hbrunn 027a758
[ADD] check if our user may access the cleanup
hbrunn b1e887a
[FIX] copy&paste
hbrunn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,68 @@ | ||
| .. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg | ||
| :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
| :alt: License: AGPL-3 | ||
|
|
||
| ================ | ||
| Database cleanup | ||
| ================ | ||
|
|
||
| Clean your OpenERP database from remnants of modules, models, columns and | ||
| tables left by uninstalled modules (prior to 7.0) or a homebrew database | ||
| upgrade to a new major version of OpenERP. | ||
|
|
||
| Caution! This module is potentially harmful and can *easily* destroy the | ||
| integrity of your data. Do not use if you are not entirely comfortable | ||
| with the technical details of the OpenERP data model of *all* the modules | ||
| that have ever been installed on your database, and do not purge any module, | ||
| model, column or table if you do not know exactly what you are doing. | ||
|
|
||
| Usage | ||
| ===== | ||
|
|
||
| After installation of this module, go to the Settings menu -> Technical -> | ||
| Database cleanup. Go through the modules, models, columns and tables | ||
| entries under this menu (in that order) and find out if there is orphaned data | ||
| in your database. You can either delete entries by line, or sweep all entries | ||
| in one big step (if you are *really* confident). | ||
|
|
||
| Caution! This module is potentially harmful and can *easily* destroy the | ||
| integrity of your data. Do not use if you are not entirely comfortable | ||
| with the technical details of the OpenERP data model of *all* the modules | ||
| that have ever been installed on your database, and do not purge any module, | ||
| model, column or table if you do not know exactly what you are doing. | ||
| .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas | ||
| :alt: Try me on Runbot | ||
| :target: https://runbot.odoo-community.org/runbot/149/9.0 | ||
|
|
||
| Bug Tracker | ||
| =========== | ||
|
|
||
| Bugs are tracked on `GitHub Issues <https://github.com/OCA/database_cleanup/issues>`_. | ||
| In case of trouble, please check there if your issue has already been reported. | ||
| If you spotted it first, help us smashing it by providing a detailed and welcomed feedback. | ||
|
|
||
| Credits | ||
| ======= | ||
|
|
||
| Images | ||
| ------ | ||
|
|
||
| * Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_. | ||
|
|
||
| Contributors | ||
| ------------ | ||
|
|
||
| * Stefan Rijnhart <stefan@opener.amsterdam> | ||
| * Holger Brunn <hbrunn@therp.nl> | ||
|
|
||
| Do not contact contributors directly about help with questions or problems concerning this addon, but use the `community mailing list <mailto:community@mail.odoo.com>`_ or the `appropriate specialized mailinglist <https://odoo-community.org/groups>`_ for help, and the bug tracker linked in `Bug Tracker`_ above for technical issues. | ||
|
|
||
| Maintainer | ||
| ---------- | ||
|
|
||
| .. image:: https://odoo-community.org/logo.png | ||
| :alt: Odoo Community Association | ||
| :target: https://odoo-community.org | ||
|
|
||
| This module is maintained by the OCA. | ||
|
|
||
| OCA, or the Odoo Community Association, is a nonprofit organization whose | ||
| mission is to support the collaborative development of Odoo features and | ||
| promote its widespread use. | ||
|
|
||
| To contribute to this module, please visit https://odoo-community.org. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,4 @@ | ||
| from . import model | ||
| # -*- coding: utf-8 -*- | ||
| # © 2014-2016 Therp BV <http://therp.nl> | ||
| # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
| from . import models |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,39 +1,22 @@ | ||
| # -*- coding: utf-8 -*- | ||
| ############################################################################## | ||
| # | ||
| # OpenERP, Open Source Management Solution | ||
| # This module copyright (C) 2014 Therp BV (<http://therp.nl>). | ||
| # | ||
| # This program is free software: you can redistribute it and/or modify | ||
| # it under the terms of the GNU Affero General Public License as | ||
| # published by the Free Software Foundation, either version 3 of the | ||
| # License, or (at your option) any later version. | ||
| # | ||
| # This program is distributed in the hope that it will be useful, | ||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| # GNU Affero General Public License for more details. | ||
| # | ||
| # You should have received a copy of the GNU Affero General Public License | ||
| # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| # | ||
| ############################################################################## | ||
|
|
||
| # © 2014-2016 Therp BV <http://therp.nl> | ||
| # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
| { | ||
| 'name': 'Database cleanup', | ||
| 'version': '8.0.0.1.0', | ||
| 'version': '9.0.1.0.0', | ||
| 'author': "Therp BV,Odoo Community Association (OCA)", | ||
| 'depends': ['base'], | ||
| 'license': 'AGPL-3', | ||
| 'category': 'Tools', | ||
| 'data': [ | ||
| 'view/purge_menus.xml', | ||
| 'view/purge_modules.xml', | ||
| 'view/purge_models.xml', | ||
| 'view/purge_columns.xml', | ||
| 'view/purge_tables.xml', | ||
| 'view/purge_data.xml', | ||
| 'view/menu.xml', | ||
| ], | ||
| 'installable': False, | ||
| "views/purge_wizard.xml", | ||
| 'views/purge_menus.xml', | ||
| 'views/purge_modules.xml', | ||
| 'views/purge_models.xml', | ||
| 'views/purge_columns.xml', | ||
| 'views/purge_tables.xml', | ||
| 'views/purge_data.xml', | ||
| 'views/menu.xml', | ||
| ], | ||
| 'installable': True, | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| # -*- coding: utf-8 -*- | ||
| # © 2016 Therp BV <http://therp.nl> | ||
| # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
| from psycopg2.extensions import ISQLQuote | ||
|
|
||
|
|
||
| class IdentifierAdapter(ISQLQuote): | ||
| def __init__(self, identifier, quote=True): | ||
| self.quote = quote | ||
| self.identifier = identifier | ||
|
|
||
| def __conform__(self, protocol): | ||
| if protocol == ISQLQuote: | ||
| return self | ||
|
|
||
| def getquoted(self): | ||
| def is_identifier_char(c): | ||
| return c.isalnum() or c in ['_', '$'] | ||
|
|
||
| format_string = '"%s"' | ||
| if not self.quote: | ||
| format_string = '%s' | ||
| return format_string % filter(is_identifier_char, self.identifier) |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is valid the
(prior to 7.0)yet?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes