File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -428,6 +428,32 @@ class DatabaseHelper {
428428 } catch (e) {
429429 // Si la columna ya existe, ignorar el error
430430 }
431+ try {
432+ final result = db.select ("PRAGMA table_info(bookmarks)" );
433+
434+ final hasDescription = result.any ((row) => row['name' ] == 'description' );
435+ if (! hasDescription) {
436+ db.execute ('ALTER TABLE bookmarks ADD COLUMN description TEXT;' );
437+ }
438+
439+ final hasTimestamp = result.any ((row) => row['name' ] == 'timestamp' );
440+ if (! hasTimestamp) {
441+ // Add a timestamp column with a safe default to avoid NOT NULL issues on existing rows
442+ db.execute ("ALTER TABLE bookmarks ADD COLUMN timestamp TEXT NOT NULL DEFAULT '';" );
443+ }
444+
445+ final hasHidden = result.any ((row) => row['name' ] == 'hidden' );
446+ if (! hasHidden) {
447+ db.execute ('ALTER TABLE bookmarks ADD COLUMN hidden INTEGER NOT NULL DEFAULT 0;' );
448+ }
449+
450+ final hasTagIds = result.any ((row) => row['name' ] == 'tag_ids' );
451+ if (! hasTagIds) {
452+ db.execute ("ALTER TABLE bookmarks ADD COLUMN tag_ids TEXT DEFAULT '[]';" );
453+ }
454+ } catch (e) {
455+ // Ignorar si alguna columna ya existe o si la migración falla por compatibilidad
456+ }
431457
432458 // Migración para notebooks - deleted_at
433459 try {
You can’t perform that action at this time.
0 commit comments