-
-
Notifications
You must be signed in to change notification settings - Fork 2
New classic level #29
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
Changes from all commits
65d90c2
bdb478c
8e0b2c4
3beaf5a
e7e9afa
9222218
f0d4582
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,6 +41,6 @@ class MarketHelper { | |
| static String _getCurrentOtherAppsUrl() { | ||
| // Check which URL is currently active | ||
| // The Makefile will modify this to switch between markets | ||
| return GeneralConsts.otherAppsRustoreLink; // This will be changed by make | ||
| return GeneralConsts.otherAppsGooglePlayLink; // This will be changed by make | ||
|
Comment on lines
41
to
+44
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Verify Makefile/mk scripts still target the correct token after this change
echo "=== Searching for Makefile/mk files ==="
fd -e Makefile -e mk | head -20
echo -e "\n=== Searching in Makefiles for market-related tokens ==="
rg -n "market_helper|otherAppsGooglePlayLink|otherAppsRuStoreLink|rustore|play\.google\.com" -g 'Makefile*' -g '*.mk' --max-count=20
echo -e "\n=== Checking market_helper.dart constants ==="
rg -n "otherAppsGooglePlayLink|otherAppsRuStoreLink|RuStore" lib/core/utils/market_helper.dartRepository: khlebobul/pegma Length of output: 2602 Update the Makefile sed pattern for Google Play builds to match the new default. The This no longer matches the default return statement after your change. While RuStore builds work correctly (line 39), the Google Play build logic is broken—relying on the code already being at the correct default. Update line 33 to replace 🤖 Prompt for AI Agents |
||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "board": [ | ||
| ["x", "x", "1", "1", "1", "x", "x"], | ||
| ["x", "1", "1", "1", "1", "1", "x"], | ||
| ["1", "1", "1", "1", "1", "1", "1"], | ||
| ["1", "1", "1", "0", "1", "1", "1"], | ||
| ["1", "1", "1", "1", "1", "1", "1"], | ||
| ["x", "1", "1", "1", "1", "1", "x"], | ||
| ["x", "x", "1", "1", "1", "x", "x"] | ||
| ] | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrap migration in a transaction to prevent data loss on partial failure.
The migration performs multiple DDL operations sequentially. If any statement fails after
DROP TABLE(lines 104-105) but beforeALTER TABLE ... RENAME(lines 106-107), the database will be left in an inconsistent state with potential data loss.🛡️ Proposed fix: Wrap in transaction
if (oldVersion < 6) { // Migrate level_id from INTEGER to TEXT to support fractional levels (0.1, 0.2, etc.) // Also migrate level 0 to 0.1 for users who already completed it + await db.transaction((txn) async { + // Create new tables with TEXT level_id + await txn.execute(''' + CREATE TABLE completed_levels_new ( + level_id TEXT PRIMARY KEY, + completed_at TEXT NOT NULL, + moves_count INTEGER NOT NULL + ) + '''); - // Create new tables with TEXT level_id - await db.execute(''' - CREATE TABLE completed_levels_new ( - level_id TEXT PRIMARY KEY, - completed_at TEXT NOT NULL, - moves_count INTEGER NOT NULL - ) - '''); - - await db.execute(''' - CREATE TABLE saved_games_new ( - level_id TEXT PRIMARY KEY, - board_state TEXT NOT NULL, - moves_count INTEGER NOT NULL, - saved_at TEXT NOT NULL - ) - '''); - - // Migrate data, converting level 0 to 0.1 - await db.execute(''' - INSERT INTO completed_levels_new (level_id, completed_at, moves_count) - SELECT CASE WHEN level_id = 0 THEN '0.1' ELSE CAST(level_id AS TEXT) END, - completed_at, moves_count - FROM completed_levels - '''); - - await db.execute(''' - INSERT INTO saved_games_new (level_id, board_state, moves_count, saved_at) - SELECT CASE WHEN level_id = 0 THEN '0.1' ELSE CAST(level_id AS TEXT) END, - board_state, moves_count, saved_at - FROM saved_games - '''); - - // Drop old tables and rename new ones - await db.execute('DROP TABLE completed_levels'); - await db.execute('DROP TABLE saved_games'); - await db.execute('ALTER TABLE completed_levels_new RENAME TO completed_levels'); - await db.execute('ALTER TABLE saved_games_new RENAME TO saved_games'); + await txn.execute(''' + CREATE TABLE saved_games_new ( + level_id TEXT PRIMARY KEY, + board_state TEXT NOT NULL, + moves_count INTEGER NOT NULL, + saved_at TEXT NOT NULL + ) + '''); + + // Migrate data, converting level 0 to 0.1 + await txn.execute(''' + INSERT INTO completed_levels_new (level_id, completed_at, moves_count) + SELECT CASE WHEN level_id = 0 THEN '0.1' ELSE CAST(level_id AS TEXT) END, + completed_at, moves_count + FROM completed_levels + '''); + + await txn.execute(''' + INSERT INTO saved_games_new (level_id, board_state, moves_count, saved_at) + SELECT CASE WHEN level_id = 0 THEN '0.1' ELSE CAST(level_id AS TEXT) END, + board_state, moves_count, saved_at + FROM saved_games + '''); + + // Drop old tables and rename new ones + await txn.execute('DROP TABLE completed_levels'); + await txn.execute('DROP TABLE saved_games'); + await txn.execute('ALTER TABLE completed_levels_new RENAME TO completed_levels'); + await txn.execute('ALTER TABLE saved_games_new RENAME TO saved_games'); + }); }🤖 Prompt for AI Agents