diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2021-03-16 17:04:54 +0100 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2021-03-16 17:04:54 +0100 |
| commit | 901beb4df2c074ba54fedc91dd6e780cebe093d1 (patch) | |
| tree | 4c628137716c7025726ada9642e3241172f6699f | |
| parent | 1cfe96ca6ef5c54eadd986c951dade0f56d72440 (diff) | |
migrate to mysql
| -rw-r--r-- | cli/commands/admin/migrate_to_mysql.py | 4 | ||||
| -rw-r--r-- | docs/migrate_to_mysql.md | 18 |
2 files changed, 19 insertions, 3 deletions
diff --git a/cli/commands/admin/migrate_to_mysql.py b/cli/commands/admin/migrate_to_mysql.py index 32ff7cf..0ad9929 100644 --- a/cli/commands/admin/migrate_to_mysql.py +++ b/cli/commands/admin/migrate_to_mysql.py @@ -47,7 +47,7 @@ def make_mysql_base(): def make_sqlite3_base(): """Make a SQLite3 connection""" - connection_url = "sqlite:///{}".format(os.path.join(app_cfg.DIR_DATABASE, 'animism.sqlite3')) + connection_url = "sqlite:///{}".format(os.path.join(app_cfg.DIR_DATABASE, 'swimmer.sqlite3')) return make_base(connection_url) def make_base(connection_url): @@ -117,4 +117,4 @@ def make_classes(Base): created_at = Column(UtcDateTime(), default=utcnow()) updated_at = Column(UtcDateTime(), onupdate=utcnow()) - return [ Upload, Graph, Page, Tile ] + return [ Graph, Page, Tile, Upload ] diff --git a/docs/migrate_to_mysql.md b/docs/migrate_to_mysql.md index 45fe7de..f414a1e 100644 --- a/docs/migrate_to_mysql.md +++ b/docs/migrate_to_mysql.md @@ -1 +1,17 @@ -migrate_to_mysql.md +# Migrate to MySQL + +1. Create a MySQL user and database + +``` +CREATE USER 'swimmer'@'localhost' IDENTIFIED BY 'swimmer'; +CREATE DATABASE swimmer; +GRANT ALL PRIVILEGES ON swimmer.* TO 'swimmer'@'localhost'; +``` + +2. Set up the `.env` which should disable SQLite. + +3. Run `./cli.py db upgrade head` + +4. Run `./cli.py admin migrate_to_mysql` + +5. Restart the server. |
