diff --git a/cps/ub.py b/cps/ub.py index 61787e57..18cd6975 100644 --- a/cps/ub.py +++ b/cps/ub.py @@ -179,6 +179,7 @@ class UserBase: # User Base (all access methods are declared there) class User(UserBase, Base): __tablename__ = 'user' + __table_args__ = {'sqlite_autoincrement': True} id = Column(Integer, primary_key=True) nickname = Column(String(64), unique=True) @@ -715,7 +716,34 @@ def migrate_Database(): conn = engine.connect() conn.execute("ALTER TABLE Settings ADD column `config_updatechannel` INTEGER DEFAULT 0") session.commit() - + try: + # check if one table with autoincrement is existing (should be user table) + conn = engine.connect() + conn.execute("SELECT COUNT(*) FROM sqlite_sequence WHERE name='user'") + except exc.OperationalError: + # Create new table user_id and copy contents of table user into it + conn = engine.connect() + conn.execute("CREATE TABLE user_id (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT," + "nickname VARCHAR(64)," + "email VARCHAR(120)," + "role SMALLINT," + "password VARCHAR," + "kindle_mail VARCHAR(120)," + "locale VARCHAR(2)," + "sidebar_view INTEGER," + "default_language VARCHAR(3)," + "mature_content BOOLEAN," + "UNIQUE (nickname)," + "UNIQUE (email)," + "CHECK (mature_content IN (0, 1)))") + conn.execute("INSERT INTO user_id(id, nickname, email, role, password, kindle_mail,locale," + "sidebar_view, default_language, mature_content) " + "SELECT id, nickname, email, role, password, kindle_mail, locale," + "sidebar_view, default_language, mature_content FROM user") + # delete old user table and rename new user_id table to user: + conn.execute("DROP TABLE user") + conn.execute("ALTER TABLE user_id RENAME TO user") + session.commit() # Remove login capability of user Guest conn = engine.connect() diff --git a/readme.md b/readme.md index f06d50da..bc314c02 100644 --- a/readme.md +++ b/readme.md @@ -56,20 +56,30 @@ Optionally, to enable on-the-fly conversion from one ebook format to another whe [Download](http://www.amazon.com/gp/feature.html?docId=1000765211) Amazon's KindleGen tool for your platform and place the binary named as `kindlegen` in the `vendor` folder. -## Docker images +## Docker Images -Pre-built Docker images based on Alpine Linux are available in these Docker Hub repositories: +Pre-built Docker images are available in these Docker Hub repositories: -**x64** -+ **technosoft2000** at [technosoft2000/calibre-web](https://hub.docker.com/r/technosoft2000/calibre-web/). If you want the option to convert/download ebooks in multiple formats, use this image as it includes Calibre's ebook-convert binary. The "path to convertertool" should be set to /opt/calibre/ebook-convert. -+ **linuxserver.io** at [linuxserver/calibre-web](https://hub.docker.com/r/linuxserver/calibre-web/). Cannot convert between ebook formats. +#### **Technosoft2000 - x64** ++ Docker Hub - [https://hub.docker.com/r/technosoft2000/calibre-web/](https://hub.docker.com/r/technosoft2000/calibre-web/) ++ Github - [https://github.com/Technosoft2000/docker-calibre-web](https://github.com/Technosoft2000/docker-calibre-web) -**armhf** -+ **linuxserver.io** at [lsioarmhf/calibre-web](https://hub.docker.com/r/lsioarmhf/calibre-web/) + Includes the Calibre `ebook-convert` binary. + + The "path to convertertool" should be set to `/opt/calibre/ebook-convert` -**aarch64** -+ **linuxserver.io** at [lsioarmhf/calibre-web-aarch64](https://hub.docker.com/r/lsioarmhf/calibre-web-aarch64) +#### **LinuxServer - x64, armhf, aarch64** ++ Docker Hub - [https://hub.docker.com/r/linuxserver/calibre-web/](https://hub.docker.com/r/linuxserver/calibre-web/) ++ Github - [https://github.com/linuxserver/docker-calibre-web](https://github.com/linuxserver/docker-calibre-web) ++ Github - (Optional Calibre layer) - [https://github.com/linuxserver/docker-calibre-web/tree/calibre](https://github.com/linuxserver/docker-calibre-web/tree/calibre) + + This image has the option to pull in an extra docker manifest layer to include the Calibre `ebook-convert` binary. Just include the environmental variable `DOCKER_MODS=linuxserver/calibre-web:calibre` in your docker run/docker compose file. **(x64 only)** + + If you do not need this functionality then this can be omitted, keeping the image as lightweight as possible. + + Both the Calibre-Web and Calibre-Mod images are rebuilt automatically on new releases of Calibre-Web and Calibre respectively, and on updates to any included base image packages on a weekly basis if required. + + The "path to convertertool" should be set to `/usr/bin/ebook-convert` + + The "path to unrar" should be set to `/usr/bin/unrar` # Wiki -For further informations, How To's and FAQ please check the ![Wiki](../../wiki) +For further informations, How To's and FAQ please check the ![Wiki](../../wiki) \ No newline at end of file