diff --git a/DV8-Expo/.gitignore b/DV8-Expo/.gitignore index 5ffa8b8..6aa0d37 100644 --- a/DV8-Expo/.gitignore +++ b/DV8-Expo/.gitignore @@ -159,5 +159,5 @@ cython_debug/ # option (not recommended) you can uncomment the following to ignore the entire idea folder. # remove development files -/data +/storage /logs diff --git a/DV8-Expo/run.sh b/DV8-Expo/run.sh index bc7c49f..6bbddba 100644 --- a/DV8-Expo/run.sh +++ b/DV8-Expo/run.sh @@ -1,19 +1,19 @@ #!/bin/sh -# # Check if migrastions folder exists -# if [ ! -d "/data/storage/migrations" ]; -# then -# echo "Creating tables..." -# flask --app website db init -# fi +# Check if migrastions folder exists +if [ ! -d "/data/storage/migrations" ]; +then + echo "Creating tables..." + flask --app website db init +fi -# # Check if there are any changes to the database -# if ! $(flask --app website db check | grep -q "No changes in schema detected."); -# then -# echo "Database changes detected! Migrating..." -# flask --app website db migrate -# flask --app website db upgrade -# fi +# Check if there are any changes to the database +if ! $(flask --app website db check | grep -q "No changes in schema detected."); +then + echo "Database changes detected! Migrating..." + flask --app website db migrate + flask --app website db upgrade +fi # Start website!!!! echo "Starting expo website..." diff --git a/DV8-Expo/website/__init__.py b/DV8-Expo/website/__init__.py index 244b2dc..f99c735 100644 --- a/DV8-Expo/website/__init__.py +++ b/DV8-Expo/website/__init__.py @@ -1,12 +1,13 @@ from flask import Flask, render_template from flask_assets import Bundle -from website.extensions import db, assets -from website.config import INSTANCE_DIR +from website.extensions import db, migrate, assets +from website.config import INSTANCE_DIR, MIGRATION_DIR -app = Flask(__name__) # instance_path=INSTANCE_DIR +app = Flask(__name__, instance_path=INSTANCE_DIR) app.config.from_pyfile('config.py') db.init_app(app) +migrate.init_app(app, db, directory=MIGRATION_DIR) with app.app_context(): db.create_all() diff --git a/DV8-Expo/website/extensions.py b/DV8-Expo/website/extensions.py index 7819cfc..5e479fe 100644 --- a/DV8-Expo/website/extensions.py +++ b/DV8-Expo/website/extensions.py @@ -1,7 +1,9 @@ from flask_sqlalchemy import SQLAlchemy +from flask_migrate import Migrate from flask_caching import Cache from flask_assets import Environment db = SQLAlchemy() +migrate = Migrate() cache = Cache() assets = Environment() diff --git a/DV8-Expo/website/models.py b/DV8-Expo/website/models.py index 780801a..ab0f169 100644 --- a/DV8-Expo/website/models.py +++ b/DV8-Expo/website/models.py @@ -7,23 +7,27 @@ from website.extensions import db class Games(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String, nullable=False) + ageRating = db.Column(db.String, nullable=False) + description = db.Column(db.String, nullable=False) + thumbnail = db.Column(db.String, nullable=False) + background = db.Column(db.String, nullable=False) downloadLink = db.Column(db.String, nullable=False) approved = db.Column(db.Boolean, nullable=False, default=False) +class Images(db.Model): + id = db.Column(db.Integer, primary_key=True) + image = db.Column(db.String, nullable=False) + game_id = db.Column(db.Integer, db.ForeignKey('games.id')) + + class Tags(db.Model): id = db.Column(db.Integer, primary_key=True) tag = db.Column(db.String, nullable=False) game_id = db.Column(db.Integer, db.ForeignKey('games.id')) -class TriggerWarning(db.Model): - id = db.Column(db.Integer, primary_key=True) - warning = db.Column(db.String, nullable=False) - game_id = db.Column(db.Integer, db.ForeignKey('games.id')) - - -class Authros(db.Model): +class Authors(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String, nullable=False) role = db.Column(db.String, nullable=False, default='Developer') diff --git a/DV8-Expo/website/static/sass/nav.sass b/DV8-Expo/website/static/sass/nav.sass index 24c2dc8..586e4ef 100644 --- a/DV8-Expo/website/static/sass/nav.sass +++ b/DV8-Expo/website/static/sass/nav.sass @@ -15,7 +15,7 @@ nav color: $primary z-index: 100 - transition: color 0.2s ease-in-out + transition: color 0.1s ease-in-out &::before content: "" @@ -40,7 +40,7 @@ nav text-decoration: none color: inherit - transition: color 0.2s ease-in-out, font-weight 0.2s + transition: color 0.1s ease-in-out, font-weight 0.1s ease-in-out &:hover color: $accent diff --git a/Highscore-Server/.gitignore b/Highscore-Server/.gitignore index 5ffa8b8..6aa0d37 100644 --- a/Highscore-Server/.gitignore +++ b/Highscore-Server/.gitignore @@ -159,5 +159,5 @@ cython_debug/ # option (not recommended) you can uncomment the following to ignore the entire idea folder. # remove development files -/data +/storage /logs diff --git a/docker-compose.yml b/docker-compose.yml index 13dd672..ccea5fb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,7 +5,7 @@ services: image: caddy:alpine restart: unless-stopped ports: - # - 80:80 + - 80:80 - 443:443 volumes: - ./Caddy/Caddyfile:/etc/caddy/Caddyfile @@ -34,7 +34,7 @@ services: build: ./Highscore-Server restart: unless-stopped volumes: - - ./Highscore-Server/data:/data/storage + - ./Highscore-Server/storage:/data/storage - ./Highscore-Server/logs:/data/logs environment: FLASK_KEY: secret @@ -48,7 +48,7 @@ services: build: ./DV8-Expo restart: unless-stopped volumes: - - ./DV8-Expo/data:/data/storage + - ./DV8-Expo/storage:/data/storage - ./DV8-Expo/logs:/data/logs environment: FLASK_KEY: secret