mirror of
https://github.com/TagStudioDev/TagStudio.git
synced 2026-07-10 07:59:38 +02:00
Compare commits
30 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b24900b9fb | |||
| 4c3e0a3810 | |||
| ce64fb7773 | |||
| 8369738c64 | |||
| 81734c1373 | |||
| 33bc77cc9d | |||
| 87822f6aa7 | |||
| 48612a5277 | |||
| e5941b4942 | |||
| 6e64dc4427 | |||
| 660cc406b5 | |||
| c374843e91 | |||
| 20dc5022e9 | |||
| 577cf00453 | |||
| d8b339a17c | |||
| cc78c1abb9 | |||
| e383cab402 | |||
| eb41ed0eb9 | |||
| f4f33b0e01 | |||
| 6679bb92fb | |||
| 67fe77a67c | |||
| 4a8d404905 | |||
| 804bb89b91 | |||
| a7985b971a | |||
| fda10ec67c | |||
| db520890a2 | |||
| 6266ba7a06 | |||
| bdc8e4b59d | |||
| 02a9295743 | |||
| 194b2b82cc |
@@ -42,13 +42,17 @@ def make_engine(connection_string: str) -> Engine:
|
||||
|
||||
def make_tables(engine: Engine) -> None:
|
||||
logger.info("[Library] Creating DB tables...")
|
||||
Base.metadata.create_all(engine)
|
||||
|
||||
# tag IDs < 1000 are reserved
|
||||
# create tag and delete it to bump the autoincrement sequence
|
||||
# TODO - find a better way
|
||||
# is this the better way?
|
||||
with engine.connect() as conn:
|
||||
# TODO: this should instead be migrations that create the exact tables that were added in
|
||||
# the respective DB versions
|
||||
Base.metadata.create_all(conn)
|
||||
conn.commit()
|
||||
|
||||
# TODO: this needs to be a migration
|
||||
# tag IDs < 1000 are reserved
|
||||
# create tag and delete it to bump the autoincrement sequence
|
||||
# TODO - find a better way
|
||||
# is this the better way?
|
||||
result = conn.execute(text("SELECT SEQ FROM sqlite_sequence WHERE name='tags'"))
|
||||
autoincrement_val = result.scalar()
|
||||
if not autoincrement_val or autoincrement_val <= RESERVED_TAG_END:
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -395,14 +395,15 @@ class JsonMigrationModal(QObject):
|
||||
# Convert JSON Library to SQLite
|
||||
yield Translations["json_migration.creating_database_tables"]
|
||||
self.sql_lib = SqliteLibrary()
|
||||
self.temp_path: Path = (
|
||||
self.json_lib.library_dir / TS_FOLDER_NAME / "migration_ts_library.sqlite"
|
||||
)
|
||||
temp_filename = "migration_ts_library.sqlite"
|
||||
self.temp_path: Path = self.json_lib.library_dir / TS_FOLDER_NAME / temp_filename
|
||||
if self.temp_path.exists():
|
||||
logger.info('Temporary migration file "temp_path" already exists. Removing...')
|
||||
self.temp_path.unlink()
|
||||
self.sql_lib.open_sqlite_library(
|
||||
self.json_lib.library_dir, is_new=True, storage_path=str(self.temp_path)
|
||||
self.sql_lib.create_sqlite_library(
|
||||
self.json_lib.library_dir,
|
||||
in_memory=False,
|
||||
sql_filename=temp_filename,
|
||||
)
|
||||
yield Translations.format(
|
||||
"json_migration.migrating_files_entries", entries=len(self.json_lib.entries)
|
||||
|
||||
Reference in New Issue
Block a user