Files
modrinth/packages/app-lib/migrations/20260619120000_finish-instance-profile-migration.sql
T
734720e11e feat: instances v2 (#6431)
* feat: base of instances v2

* feat: use old profiles with compat layer

* prototype: instances v2

* fix: install_from using profile

* fix: skins migration fix

* fix: frontend still using profile path

* fix: add update proj multiselect guard

* fix: cargo fmt

* fix: content missing fields

* feat: break up app-lib/api/instance.rs

* fix: check_content_updates mismatch

* fix: updater modal cleanup w/new structure

* feat: better update all handling

* fix: remove preview_update_all

* fix: feedback on bulk update + lint

* fix: rem transitions

* fix: change to jsonb

* feat: app db backup after update

* fix: lint

* fix: sqlx prepare + use sqlx macros

* fix: lint

* fix: bugs

* feat: defuck the installing process up

* fix: bug of hell

* fix: shear

* fix: fmt

* fix: install progress spacing + change mc/content/overrides to bytes

* fix: lint

* fix: prepr

* fix: navtabs anim not working in app

* fix: worlds.vue improvements + browse page fixes

* feat: optimise queries + adapter fns

* fix: lint

* fix: lint

* feat: shared modrinth-content-management crate (#6469)

* feat: disable warnings setting

* feat: add instances shortcuts (#6329)

* Add modrinth://launch deep link to start a profile

Support external profile launching via modrinth://launch/{profile_path} for integrations such as Stream Deck.

* Change route to /launch/profile/{id} for future extensibility

* fix: ensure profile path is url decoded

* fix: URL-decode profile path from deep link

* fix: use urlencoding crate for URL decoding

* feat: implement app instance shortcuts

* feat: change windows shortcut creation to use windows api instead

* feat: implement creating a shortcut launching world/server

* format

* fmt

* fix multiline inline tables

* pnpm prepr

* feat: move create shortcut to last item

* refactor: split up shortcuts.rs for individual platforms

* refactor: turn profile launch url into url type

* use string literal and add safety comment

* pt2

* refactor: rename anything that's profile into instance

* update mac shortcut

---------

Co-authored-by: DJCheesusReal <134006619+DJCheesusReal@users.noreply.github.com>

---------

Co-authored-by: Truman Gao <106889354+tdgao@users.noreply.github.com>
Co-authored-by: DJCheesusReal <134006619+DJCheesusReal@users.noreply.github.com>
2026-06-25 21:19:29 +00:00

130 lines
3.1 KiB
SQL

CREATE TEMP TABLE finish_instance_profile_migration_validation (
error_count INTEGER NOT NULL CHECK (error_count = 0)
);
INSERT INTO finish_instance_profile_migration_validation (error_count)
SELECT COUNT(*)
FROM profiles
LEFT JOIN instances ON instances.path = profiles.path
WHERE instances.id IS NULL;
INSERT INTO finish_instance_profile_migration_validation (error_count)
SELECT COUNT(*)
FROM instances
LEFT JOIN instance_content_sets
ON instance_content_sets.id = instances.applied_content_set_id
AND instance_content_sets.instance_id = instances.id
WHERE instances.applied_content_set_id IS NULL
OR instance_content_sets.id IS NULL;
DROP TABLE finish_instance_profile_migration_validation;
DROP INDEX processes_profile_path;
ALTER TABLE processes RENAME TO processes_old;
CREATE TABLE processes (
pid INTEGER NOT NULL,
start_time INTEGER NOT NULL,
name TEXT NOT NULL,
executable TEXT NOT NULL,
instance_id TEXT NOT NULL,
post_exit_command TEXT NULL,
UNIQUE (pid),
PRIMARY KEY (pid),
FOREIGN KEY (instance_id) REFERENCES instances(id) ON DELETE CASCADE
);
INSERT INTO processes (
pid,
start_time,
name,
executable,
instance_id,
post_exit_command
)
SELECT
processes_old.pid,
processes_old.start_time,
processes_old.name,
processes_old.executable,
instances.id,
processes_old.post_exit_command
FROM processes_old
JOIN instances ON instances.path = processes_old.profile_path;
DROP TABLE processes_old;
CREATE INDEX processes_instance_id ON processes(instance_id);
DROP INDEX join_log_profile_path;
ALTER TABLE join_log RENAME TO join_log_old;
CREATE TABLE join_log (
instance_id TEXT NOT NULL,
host TEXT NOT NULL,
port INTEGER NOT NULL,
join_time INTEGER NOT NULL,
PRIMARY KEY (instance_id, host, port),
FOREIGN KEY (instance_id) REFERENCES instances(id) ON DELETE CASCADE
);
INSERT INTO join_log (
instance_id,
host,
port,
join_time
)
SELECT
instances.id,
join_log_old.host,
join_log_old.port,
join_log_old.join_time
FROM join_log_old
JOIN instances ON instances.path = join_log_old.profile_path;
DROP TABLE join_log_old;
CREATE INDEX join_log_instance_id ON join_log(instance_id);
DROP INDEX attached_world_data_profile_path;
ALTER TABLE attached_world_data RENAME TO attached_world_data_old;
CREATE TABLE attached_world_data (
instance_id TEXT NOT NULL,
world_type TEXT CHECK ( world_type in ('singleplayer', 'server') ) NOT NULL,
world_id TEXT NOT NULL,
display_status TEXT NOT NULL DEFAULT 'normal',
project_id TEXT NULL,
content_kind TEXT NULL,
PRIMARY KEY (instance_id, world_type, world_id),
FOREIGN KEY (instance_id) REFERENCES instances(id) ON DELETE CASCADE
);
INSERT INTO attached_world_data (
instance_id,
world_type,
world_id,
display_status,
project_id,
content_kind
)
SELECT
instances.id,
attached_world_data_old.world_type,
attached_world_data_old.world_id,
attached_world_data_old.display_status,
attached_world_data_old.project_id,
attached_world_data_old.content_kind
FROM attached_world_data_old
JOIN instances ON instances.path = attached_world_data_old.profile_path;
DROP TABLE attached_world_data_old;
CREATE INDEX attached_world_data_instance_id
ON attached_world_data(instance_id);
DROP TABLE profiles;