Skip to content

Commit 5351787

Browse files
committed
fix(api): align categories table schema with model
The `categories` table schema in the database seeder was missing the `icon_url` column, which is present in the `Category` data model. This caused a mismatch between the model and the database layer. This change adds the `icon_url` column to the `CREATE TABLE` and `INSERT` statements in the `DatabaseSeedingService`, ensuring the schema is fully synchronized with the model.
1 parent f2af724 commit 5351787

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/src/services/database_seeding_service.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ class DatabaseSeedingService {
6161
id TEXT PRIMARY KEY,
6262
name TEXT NOT NULL,
6363
description TEXT,
64+
icon_url TEXT,
6465
status TEXT,
6566
type TEXT,
6667
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
@@ -163,9 +164,9 @@ class DatabaseSeedingService {
163164
final category = Category.fromJson(data);
164165
await _connection.execute(
165166
Sql.named(
166-
'INSERT INTO categories (id, name, description, status, '
167-
'type, created_at, updated_at) VALUES (@id, @name, '
168-
'@description, @status, @type, @created_at, @updated_at) '
167+
'INSERT INTO categories (id, name, description, icon_url, '
168+
'status, type, created_at, updated_at) VALUES (@id, @name, '
169+
'@description, @iconUrl, @status, @type, @created_at, @updated_at) '
169170
'ON CONFLICT (id) DO NOTHING',
170171
),
171172
parameters: category.toJson(),

0 commit comments

Comments
 (0)