From acbef39045c4cb17441082ea04548bec3194c983 Mon Sep 17 00:00:00 2001 From: Christoph Kluge Date: Tue, 21 Feb 2023 17:33:27 +0100 Subject: [PATCH] Fix header, add migration for user.projects column --- internal/repository/migration.go | 2 +- .../repository/migrations/mysql/03_add-userprojects.down.sql | 1 + internal/repository/migrations/mysql/03_add-userprojects.up.sql | 1 + .../repository/migrations/sqlite3/03_add-userprojects.down.sql | 1 + .../repository/migrations/sqlite3/03_add-userprojects.up.sql | 1 + web/frontend/src/Header.svelte | 2 +- 6 files changed, 6 insertions(+), 2 deletions(-) create mode 100644 internal/repository/migrations/mysql/03_add-userprojects.down.sql create mode 100644 internal/repository/migrations/mysql/03_add-userprojects.up.sql create mode 100644 internal/repository/migrations/sqlite3/03_add-userprojects.down.sql create mode 100644 internal/repository/migrations/sqlite3/03_add-userprojects.up.sql diff --git a/internal/repository/migration.go b/internal/repository/migration.go index 258593d..29f6be3 100644 --- a/internal/repository/migration.go +++ b/internal/repository/migration.go @@ -17,7 +17,7 @@ import ( "github.com/golang-migrate/migrate/v4/source/iofs" ) -const supportedVersion uint = 2 +const supportedVersion uint = 3 //go:embed migrations/* var migrationFiles embed.FS diff --git a/internal/repository/migrations/mysql/03_add-userprojects.down.sql b/internal/repository/migrations/mysql/03_add-userprojects.down.sql new file mode 100644 index 0000000..e42c7d1 --- /dev/null +++ b/internal/repository/migrations/mysql/03_add-userprojects.down.sql @@ -0,0 +1 @@ +ALTER TABLE user DROP COLUMN IF EXISTS projects; \ No newline at end of file diff --git a/internal/repository/migrations/mysql/03_add-userprojects.up.sql b/internal/repository/migrations/mysql/03_add-userprojects.up.sql new file mode 100644 index 0000000..4e9c635 --- /dev/null +++ b/internal/repository/migrations/mysql/03_add-userprojects.up.sql @@ -0,0 +1 @@ +ALTER TABLE user ADD COLUMN IF NOT EXISTS projects varchar(255) NOT NULL DEFAULT "[]"; \ No newline at end of file diff --git a/internal/repository/migrations/sqlite3/03_add-userprojects.down.sql b/internal/repository/migrations/sqlite3/03_add-userprojects.down.sql new file mode 100644 index 0000000..e42c7d1 --- /dev/null +++ b/internal/repository/migrations/sqlite3/03_add-userprojects.down.sql @@ -0,0 +1 @@ +ALTER TABLE user DROP COLUMN IF EXISTS projects; \ No newline at end of file diff --git a/internal/repository/migrations/sqlite3/03_add-userprojects.up.sql b/internal/repository/migrations/sqlite3/03_add-userprojects.up.sql new file mode 100644 index 0000000..4e9c635 --- /dev/null +++ b/internal/repository/migrations/sqlite3/03_add-userprojects.up.sql @@ -0,0 +1 @@ +ALTER TABLE user ADD COLUMN IF NOT EXISTS projects varchar(255) NOT NULL DEFAULT "[]"; \ No newline at end of file diff --git a/web/frontend/src/Header.svelte b/web/frontend/src/Header.svelte index 22714d3..9fe4ec2 100644 --- a/web/frontend/src/Header.svelte +++ b/web/frontend/src/Header.svelte @@ -93,7 +93,7 @@ = 4) ? "Search jobId / username" : "Search jobId"} name="searchId"/> - + = 4) ? "Example: 'projectId:a100cd', Types are: jobId | jobName | projectId | username" | "name" : "Example: 'jobName:myjob', Types are jobId | jobName"}> {#if username}