Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrations from versions to version_targets #30

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions migrations/sql/000023_migrate_versions_to_targets.down.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
--Mod Targets--
DELETE FROM version_targets
WHERE EXISTS (
SELECT 1
FROM versions
WHERE
version_targets.version_id = versions.id AND
version_targets.platform = 'Windows' AND
version_targets.key = versions.key AND
version_targets.hash = versions.hash AND
version_targets.size = versions.size
);

--SML Targets--
DELETE FROM sml_version_targets
WHERE EXISTS (
SELECT 1
FROM sml_versions
WHERE
sml_version_targets.version_id = sml_versions.id AND
sml_version_targets.platform = 'Windows' AND
sml_version_targets.link = sml_versions.link
);
10 changes: 10 additions & 0 deletions migrations/sql/000023_migrate_versions_to_targets.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
-- Mod Targets --
INSERT INTO version_targets (version_id, target_name, key, hash, size)
SELECT id, 'Windows', key, hash, size
FROM versions;

-- SML Targets --
INSERT INTO sml_version_targets (version_id, target_name, link)
SELECT id, 'Windows', link
FROM sml_versions
WHERE version LIKE '3%';