add message about db encoding

This commit is contained in:
sk1982 2024-04-16 19:53:34 -04:00
parent 97f66f8a10
commit 71c0450ea3
4 changed files with 10 additions and 1 deletions

View File

@ -4,6 +4,9 @@ An ARTEMiS frontend.
# **WARNING: Back up your database**
I am not responsible for misconfigurations that lead to database issues. **You should back up your database before making any changes to it.**
### **Important**: your default database encoding must be unicode
You can change the encoding by running `ALTER DATABASE aime CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;`
## Creating Database Tables
Before running the database importer script, you must create the tables in your database. This can be done by running the server once with `AUTOMIGRATE` enabled ([see below](#runtime-variables)), or by running `npm run migrate` (make sure you have run `npm i` first and have the [`DATABASE_URL`](#runtime-variables) environment variable set).

View File

@ -8,7 +8,9 @@ const dbmigrate = DBMigrate.getInstance(true);
if (process.argv[2] === 'up')
dbmigrate.up();
else if (process.argv[2] == 'down')
else if (process.argv[2] === 'down')
dbmigrate.down();
else if (process.argv[2] === 'reset')
dbmigrate.reset();
else
console.error('Unknown action', argv[2]);

View File

@ -12,6 +12,7 @@
"migrate:up": "dotenvx run -f .env.local -- node db-migrate.cjs up",
"migrate": "npm run migrate:up",
"migrate:down": "dotenvx run -f .env.local -- node db-migrate.cjs down",
"migrate:reset": "dotenvx run -f .env.local -- node db-migrate.cjs reset",
"migrate:create": "dotenvx run -f .env.local -- db-migrate create",
"db:export": "dotenvx run -f .env.local -- kysely-codegen --exclude-pattern cozynet* --exclude-pattern alembic_version --exclude-pattern actaeon_migrations --out-file src/types/db.d.ts && node process-db.js"
},

View File

@ -52,6 +52,9 @@ Usage: `py db-importer.py [options] <game> [game_options]`
The database importer requires the `DATABASE_URL` environment variable to be set, which can be set in an `.env` file in the format `DATABASE_URL=mysql://user:pass@host:port/db_name` (see the `--env` option)
### **Important**: your default database encoding must be unicode
You can change the encoding by running `ALTER DATABASE aime CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;`
# **WARNING: Back up your database**
I am not responsible for misconfigurations that lead to database issues. **You should back up your database before making any changes to it.**