Skip to content

Commit

Permalink
Merge pull request #702 from zurdi15/master
Browse files Browse the repository at this point in the history
v3.0.1
  • Loading branch information
zurdi15 authored Mar 13, 2024
2 parents 9d9bf1b + 367e01e commit b3ad9eb
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 23 deletions.
31 changes: 9 additions & 22 deletions backend/alembic/versions/0014_asset_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2024-02-08 15:03:26.338964
"""

import os
from alembic import op
import sqlalchemy as sa
Expand Down Expand Up @@ -56,33 +57,19 @@ def migrate_to_mysql() -> None:
).fetchall()
for table_name in tables:
table_name = table_name[0]

# Skip migration for the 'alembic_version' table
if table_name == "alembic_version":
continue

table_data = sqlite_conn.execute(
text(f"SELECT * FROM {table_name}")
).fetchall()
table_data = sqlite_conn.execute(text(f"SELECT * FROM {table_name}")).fetchall()

# Insert data into MariaDB table
if table_name == "roms":
for row in table_data:
summary = tuple(row)[15].replace('"', '\\"').replace("'", "\\'")
maria_conn.execute(
text(
f'INSERT INTO {table_name} (id, igdb_id, p_igdb_id, sgdb_id, p_sgdb_id, platform_slug, p_name, file_name, file_name_no_tags, file_extension, file_path, file_size, file_size_units, name, slug, summary, path_cover_s, path_cover_l, revision, tags, multi, files, url_cover, url_screenshots, path_screenshots, regions, languages) VALUES ({tuple(row)[0]}, {tuple(row)[1]}, "{tuple(row)[2]}", {tuple(row)[3]}, "{tuple(row)[4]}", "{tuple(row)[5]}", "{tuple(row)[6]}", "{tuple(row)[7]}", "{tuple(row)[8]}", "{tuple(row)[9]}", "{tuple(row)[10]}", {tuple(row)[11]}, "{tuple(row)[12]}", "{tuple(row)[13]}", "{tuple(row)[14]}", "{summary}", "{tuple(row)[16]}", "{tuple(row)[17]}", "{tuple(row)[18]}", \'{tuple(row)[19]}\', {tuple(row)[20]}, \'{tuple(row)[21]}\', "{tuple(row)[22]}", \'{tuple(row)[23]}\', \'{tuple(row)[24]}\', \'{tuple(row)[25]}\', \'{tuple(row)[26]}\')'.replace(
"None,", "null,"
)
)
)
else:
for row in table_data:
maria_conn.execute(
text(
f"INSERT INTO {table_name} VALUES {tuple(row)}".replace(
"None,", "null,"
)
)
)
for row in table_data:
mapped_row = {f"{i}": value for i, value in enumerate(row, start=1)}
columns = ",".join([f":{i}" for i in range(1, len(row) + 1)])
insert_query = f"INSERT INTO {table_name} VALUES ({columns})"
maria_conn.execute(text(insert_query), mapped_row)

maria_conn.execute(text("SET FOREIGN_KEY_CHECKS=1"))

Expand Down
5 changes: 5 additions & 0 deletions docker/nginx/default.conf
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ http {
add_header Access-Control-Allow-Headers *;
}

# Static files
location /assets {
try_files $uri $uri/ =404;
}

# OpenAPI for swagger and redoc
location /openapi.json {
proxy_pass http://uvicorn;
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/stores/download.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,9 @@ export default defineStore("download", {
remove(id: number) {
this.value.splice(this.value.indexOf(id), 1);
},
clear() {
this.value = [] as number[]
this.filesToDownloadMultiFileRom = [] as string[]
}
},
});
5 changes: 4 additions & 1 deletion frontend/src/views/Details/Base.vue
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<script setup lang="ts">
import storeDownload from "@/stores/download";
import type { Events } from "@/types/emitter";
import type { Emitter } from "mitt";
import { inject, onBeforeMount, ref, watch } from "vue";
Expand All @@ -10,8 +11,8 @@ import ActionBar from "@/components/Details/ActionBar.vue";
import AdditionalContent from "@/components/Details/AdditionalContent.vue";
import BackgroundHeader from "@/components/Details/BackgroundHeader.vue";
import Cover from "@/components/Details/Cover.vue";
import Info from "@/components/Details/Info/Base.vue";
import Emulation from "@/components/Details/Emulation.vue";
import Info from "@/components/Details/Info/Base.vue";
import RelatedGames from "@/components/Details/RelatedGames.vue";
import Saves from "@/components/Details/Saves.vue";
import States from "@/components/Details/States.vue";
Expand Down Expand Up @@ -90,6 +91,8 @@ onBeforeMount(async () => {
} else {
await fetchDetails();
}
const downloadStore = storeDownload();
downloadStore.clear();
});
watch(
Expand Down

0 comments on commit b3ad9eb

Please sign in to comment.