'custom book data table (for plugins)'

def upgrade_version_17(self):

    script = '\n                                DROP    TABLE    IF    EXISTS    books_plugin_data;\n                                CREATE    TABLE    books_plugin_data(id    INTEGER    PRIMARY    KEY,\n                                                                                                                                                    book    INTEGER    NON    NULL,\n                                                                                                                                                    name    TEXT    NON    NULL,\n                                                                                                                                                    val    TEXT    NON    NULL,\n                                                                                                                                                    UNIQUE(book,name));\n                                DROP    TRIGGER    IF    EXISTS    books_delete_trg;\n                                CREATE    TRIGGER    books_delete_trg\n                                                AFTER    DELETE    ON    books\n                                                BEGIN\n                                                                DELETE    FROM    books_authors_link    WHERE    book=OLD.id;\n                                                                DELETE    FROM    books_publishers_link    WHERE    book=OLD.id;\n                                                                DELETE    FROM    books_ratings_link    WHERE    book=OLD.id;\n                                                                DELETE    FROM    books_series_link    WHERE    book=OLD.id;\n                                                                DELETE    FROM    books_tags_link    WHERE    book=OLD.id;\n                                                                DELETE    FROM    data    WHERE    book=OLD.id;\n                                                                DELETE    FROM    comments    WHERE    book=OLD.id;\n                                                                DELETE    FROM    conversion_options    WHERE    book=OLD.id;\n                                                                DELETE    FROM    books_plugin_data    WHERE    book=OLD.id;\n                                END;\n                                '
    self.conn.executescript(script)
