Skip to content

Commit

Permalink
Merge pull request #24 from expo-starter/chore/upgrade-sqljs
Browse files Browse the repository at this point in the history
upgrading sqljs
  • Loading branch information
AchrafBn authored Sep 16, 2024
2 parents 0dcd073 + 84ef638 commit b8c2586
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 6 deletions.
6 changes: 6 additions & 0 deletions app/(tabs)/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ function ScreenContent() {
</Text>
<Text className="text-sm">
If you change the schema, you need to run{" "}
<Text className="text-sm font-mono text-muted-foreground bg-muted">
bun db:generate
</Text>
<Text className="text-sm px-1">
then
</Text>
<Text className="text-sm font-mono text-muted-foreground bg-muted">
bun migrate
</Text>
Expand Down
2 changes: 0 additions & 2 deletions app/habits/archive.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ export default function Home() {
})
.where(eq(habitTable.id, habitId))
.execute();
console.log("restore")
} catch (error) {
console.error("error", error);
}
Expand All @@ -56,7 +55,6 @@ export default function Home() {
{
text: 'Continue',
onPress: () => {
console.log("pressed")
// try {
// await db?.delete(habitTable).where(eq(habitTable.id, habitId)).execute();
// } catch (error) {
Expand Down
Binary file modified bun.lockb
Binary file not shown.
1 change: 0 additions & 1 deletion db/drizzle.web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { useDatabase } from "./provider";
import { useEffect, useReducer } from "react";

export const initialize = async (): Promise<SQLJsDatabase> => {
console.log("initialze web");
const sqlPromise = initSqlJs({
locateFile: (file) => `https://sql.js.org/dist/${file}`,
});
Expand Down
7 changes: 7 additions & 0 deletions db/migrations/meta/_journal.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
"when": 1719918496003,
"tag": "0001_absurd_blonde_phantom",
"breakpoints": true
},
{
"idx": 2,
"version": "6",
"when": 1726505292364,
"tag": "0002_short_dagger",
"breakpoints": true
}
]
}
4 changes: 3 additions & 1 deletion db/migrations/migrations.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
import journal from './meta/_journal.json';
import m0000 from './0000_cultured_lizard.sql';
import m0001 from './0001_absurd_blonde_phantom.sql';
import m0002 from './0002_short_dagger.sql';

export default {
journal,
migrations: {
m0000,
m0001
m0001,
m0002
}
}

3 changes: 2 additions & 1 deletion drizzle.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ export default {
out: './db/migrations',
driver: 'expo',
dialect: 'sqlite',
} satisfies Config;

}satisfies Config;
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"web": "expo start -c --web",
"export": "expo export -p web",
"format": "biome check --no-errors-on-unmatched --apply .",
"db:generate": "bun drizzle-kit generate",
"migrate": "bun ./db/migrate.ts",
"db:studio": "bun drizzle-kit studio"
},
Expand Down Expand Up @@ -68,7 +69,7 @@
"react-native-screens": "3.31.1",
"react-native-svg": "15.3.0",
"react-native-web": "~0.19.6",
"sql.js": "^1.10.3",
"sql.js": "^1.11.0",
"tailwind-merge": "^2.2.1",
"tailwindcss-animate": "^1.0.7",
"zod": "^3.23.6",
Expand Down
Binary file modified public/database.sqlite
Binary file not shown.

0 comments on commit b8c2586

Please sign in to comment.