Add schema migration

This commit is contained in:
WithoutPants 2026-02-05 10:53:53 +11:00
parent 08ba97bb8e
commit d7bc47dc09
2 changed files with 10 additions and 1 deletions

View file

@ -34,7 +34,7 @@ const (
cacheSizeEnv = "STASH_SQLITE_CACHE_SIZE"
)
var appSchemaVersion uint = 76
var appSchemaVersion uint = 77
//go:embed migrations/*.sql
var migrationsBox embed.FS

View file

@ -0,0 +1,9 @@
CREATE TABLE `tag_custom_fields` (
`tag_id` integer NOT NULL,
`field` varchar(64) NOT NULL,
`value` BLOB NOT NULL,
PRIMARY KEY (`tag_id`, `field`),
foreign key(`tag_id`) references `tags`(`id`) on delete CASCADE
);
CREATE INDEX `index_tag_custom_fields_field_value` ON `tag_custom_fields` (`field`, `value`);