Skip to content

Commit

Permalink
fix: no need drop the evalution table for migration
Browse files Browse the repository at this point in the history
  • Loading branch information
duyhungtnn committed Jul 12, 2023
1 parent c259101 commit 7dad940
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Bucketeer.xcodeproj/xcshareddata/xcschemes/Example.xcscheme
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@
<EnvironmentVariables>
<EnvironmentVariable
key = "API_KEY"
value = "stub"
value = "68f36f74aed68a63c6a0de5cf2de2f343c3714c0d1be4083f8fa679a39644a7c"
isEnabled = "YES">
</EnvironmentVariable>
<EnvironmentVariable
key = "API_ENDPOINT"
value = "stub"
value = "https://api-dev.bucketeer.jp"
isEnabled = "YES">
</EnvironmentVariable>
</EnvironmentVariables>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ final class Migration2to3: Migration {
}

func migration() throws {
try db.exec(query: "DROP TABLE IF EXISTS Evaluations")
let evaluationTable = SQLite.Table(entity: EvaluationEntity())
let evaluationSql = evaluationTable.sqlToCreate()
try db.exec(query: evaluationSql)
try db.exec(query: "DELETE FROM Evaluations")
}
}
2 changes: 1 addition & 1 deletion BucketeerTests/MigrationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ AND (name NOT LIKE 'sqlite_%' AND name NOT LIKE 'ios_%')
.mock1
]
try dao.put(userId: "user1", evaluations: mocks)
// Run migrate , it will drop `evaluations` table
// Run migrate , it will delete all data from `evaluations` table
try Migration2to3(db: db).migration()
let sql = """
SELECT id FROM Evaluations
Expand Down

0 comments on commit 7dad940

Please sign in to comment.