Skip to content

Commit 8f2cd2a

Browse files
committed
Fix migration
1 parent e7c8899 commit 8f2cd2a

File tree

5 files changed

+86
-64
lines changed

5 files changed

+86
-64
lines changed

api/lib/services/migration.dart

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,35 +29,57 @@ Future<void> migrateDatabase(DatabaseService service, Database db,
2929
await service.userGroup.create(db);
3030
await db.execute("ALTER TABLE places RENAME TO resources");
3131
await db.execute("PRAGMA foreign_keys=off");
32+
33+
// Migrate events
3234
await db.transaction((txn) async {
3335
await service.event.create(txn, 'events_temp');
3436
await txn.execute(
35-
"INSERT INTO events_temp SELECT id, parentId, blocked, name, description, location, extra FROM events");
37+
"INSERT INTO events_temp SELECT id, parentId, blocked, name, description, location, extra FROM events",
38+
);
3639
await txn.execute(
37-
"INSERT INTO eventResources(eventId, resourceId) SELECT id, placeId FROM events");
40+
"INSERT INTO eventResources(eventId, resourceId) "
41+
"SELECT id, placeId FROM events WHERE placeId IS NOT NULL",
42+
);
3843
await txn.execute(
39-
"INSERT INTO eventGroups(eventId, groupId) SELECT id, groupId FROM events");
44+
"INSERT INTO eventGroups(eventId, groupId) "
45+
"SELECT id, groupId FROM events WHERE groupId IS NOT NULL",
46+
);
4047
await txn.execute("DROP TABLE events");
4148
await txn.execute("ALTER TABLE events_temp RENAME TO events");
4249
});
50+
51+
// Migrate calendarItems
4352
await db.transaction((txn) async {
4453
await service.calendarItem.create(txn, 'calendarItems_temp');
4554
await txn.execute(
46-
"INSERT INTO calendarItems_temp SELECT id, parentId, blocked, name, description, location, extra FROM calendarItems");
55+
"INSERT INTO calendarItems_temp "
56+
"SELECT id, parentId, blocked, name, description, location, extra "
57+
"FROM calendarItems",
58+
);
4759
await txn.execute(
48-
"INSERT INTO calendarItemResources(itemId, resourceId) SELECT id, placeId FROM calendarItems");
60+
"INSERT INTO calendarItemResources(itemId, resourceId) "
61+
"SELECT id, placeId FROM calendarItems WHERE placeId IS NOT NULL",
62+
);
4963
await txn.execute(
50-
"INSERT INTO calendarItemGroups(itemId, groupId) SELECT id, groupId FROM calendarItems");
64+
"INSERT INTO calendarItemGroups(itemId, groupId) "
65+
"SELECT id, groupId FROM calendarItems WHERE groupId IS NOT NULL",
66+
);
5167
await txn.execute("DROP TABLE calendarItems");
5268
await txn
5369
.execute("ALTER TABLE calendarItems_temp RENAME TO calendarItems");
5470
});
71+
72+
// Migrate users
5573
await db.transaction((txn) async {
5674
await service.user.create(txn, 'users_temp');
5775
await txn.execute(
58-
"INSERT INTO users_temp SELECT id, name, email, description, phone, image FROM users");
76+
"INSERT INTO users_temp "
77+
"SELECT id, name, email, description, phone, image FROM users",
78+
);
5979
await txn.execute(
60-
"INSERT INTO userGroups(userId, groupId) SELECT id, groupId FROM users");
80+
"INSERT INTO userGroups(userId, groupId) "
81+
"SELECT id, groupId FROM users WHERE groupId IS NOT NULL",
82+
);
6183
await txn.execute("DROP TABLE users");
6284
await txn.execute("ALTER TABLE users_temp RENAME TO users");
6385
});

app/lib/pages/events/event.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class EventDialog extends StatelessWidget {
5151
title: Text(create
5252
? AppLocalizations.of(context).createEvent
5353
: AppLocalizations.of(context).editEvent),
54-
constraints: const BoxConstraints(maxWidth: 600, maxHeight: 800),
54+
constraints: const BoxConstraints(maxWidth: 600, maxHeight: 600),
5555
content: DefaultTabController(
5656
length: tabs ? 5 : 1,
5757
child: Column(

app/pubspec.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -262,10 +262,10 @@ packages:
262262
dependency: transitive
263263
description:
264264
name: dev_build
265-
sha256: f658f2fbf601b40d103fb9cb8db277da0a2022173950aa2aadf0f8cbcdf7c8c3
265+
sha256: "6e5251015d8fd2f5597615cef58c9f7e69035085520de97fd055c02ecfa5afa6"
266266
url: "https://pub.dev"
267267
source: hosted
268-
version: "1.1.2+5"
268+
version: "1.1.2+6"
269269
dynamic_color:
270270
dependency: "direct main"
271271
description:
@@ -876,10 +876,10 @@ packages:
876876
dependency: transitive
877877
description:
878878
name: process_run
879-
sha256: "01a48e04fbb489d1e4610ed361f6b3f21aea0966dfa0ff9227e9c4095cd6d3fb"
879+
sha256: "6ec839cdd3e6de4685318e7686cd4abb523c3d3a55af0e8d32a12ae19bc66622"
880880
url: "https://pub.dev"
881881
source: hosted
882-
version: "1.2.3"
882+
version: "1.2.4"
883883
provider:
884884
dependency: transitive
885885
description:

docs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"@phosphor-icons/react": "^2.1.7",
1717
"@types/react": "^19.0.10",
1818
"@types/react-dom": "^19.0.4",
19-
"astro": "^5.4.1",
19+
"astro": "^5.4.2",
2020
"react": "^19.0.0",
2121
"react-dom": "^19.0.0",
2222
"remark-gemoji": "^8.0.0",

0 commit comments

Comments
 (0)