mirror of
https://github.com/rommapp/romm.git
synced 2026-12-04 21:02:21 +01:00
@@ -5,6 +5,7 @@ Revises: 0013_upgrade_file_extension
|
||||
Create Date: 2024-02-08 15:03:26.338964
|
||||
|
||||
"""
|
||||
|
||||
import os
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
@@ -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"))
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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[]
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
@@ -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";
|
||||
@@ -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";
|
||||
@@ -90,6 +91,8 @@ onBeforeMount(async () => {
|
||||
} else {
|
||||
await fetchDetails();
|
||||
}
|
||||
const downloadStore = storeDownload();
|
||||
downloadStore.clear();
|
||||
});
|
||||
|
||||
watch(
|
||||
|
||||
Reference in New Issue
Block a user