Skip to content
Snippets Groups Projects
Commit 1645e52a authored by Bjarke Madsen's avatar Bjarke Madsen
Browse files

Change to postgresql 12

parent 6159e5e8
No related branches found
No related tags found
No related merge requests found
......@@ -7,4 +7,4 @@
script_location = migrations
# script_location = cachedb_migrations
# change this to run migrations from the command line
sqlalchemy.url = mysql+pymysql://compendium:compendium321@localhost/compendium
sqlalchemy.url = postgresql://compendium:compendium321@localhost:65000/compendium
......@@ -31,9 +31,9 @@ def session_scope(
session.close()
def mysql_dsn(db_username, db_password, db_hostname, db_name, port=3306):
return (f'mysql+pymysql://{db_username}:{db_password}'
f'@{db_hostname}:{port}/{db_name}?charset=utf8mb4')
def postgresql_dsn(db_username, db_password, db_hostname, db_name, port=5432):
return (f'postgresql://{db_username}:{db_password}'
f'@{db_hostname}:{port}/{db_name}')
def init_db_model(dsn):
......
......@@ -29,9 +29,9 @@ def upgrade(dsn, migrations_directory=DEFAULT_MIGRATIONS_DIRECTORY):
if __name__ == "__main__":
logging.basicConfig(level=logging.DEBUG)
upgrade(db.mysql_dsn(
upgrade(db.postgresql_dsn(
db_username='compendium',
db_password='compendium321',
db_hostname='localhost',
db_name='compendium',
port=3306))
port=65000))
{
"SQLALCHEMY_DATABASE_URI": "mysql+pymysql://compendium:compendium321@localhost/compendium"
"SQLALCHEMY_DATABASE_URI": "postgresql://compendium:compendium321@localhost:65000/compendium"
}
version: '3.1'
services:
mysql:
restart: unless-stopped
container_name: mysql-compendium
environment:
MYSQL_ALLOW_EMPTY_PASSWORD: "no"
MYSQL_DATABASE: compendium
MYSQL_PASSWORD: compendium321
MYSQL_ROOT_PASSWORD: compendium321
MYSQL_USER: compendium
volumes:
- ./build/mysql_logs:/var/log/
- ./build/mysql_data:/var/lib/mysql/
image: mysql:8
command: mysqld --general-log=1 --general-log-file=/var/log/mysql.log
ports:
- 3306:3306
postgres:
image: postgres:12
environment:
POSTGRES_DB: compendium
POSTGRES_USER: compendium
POSTGRES_PASSWORD: compendium321
restart: unless-stopped
hostname: postgres
ports:
- "65000:5432"
volumes:
- ./build/db:/var/lib/postgresql
\ No newline at end of file
......@@ -15,7 +15,7 @@ setup(
'flask-cors',
'SQLAlchemy',
'alembic',
'PyMySQL',
'psycopg2-binary',
'cryptography',
],
include_package_data=True,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment