
Replace old used-to-be-GORM datastructures (#104305) with sqlc-generated structs. This also makes it possible to use more specific structs that are more taylored to the specific queries, increasing efficiency. This commit deals with the worker sleep schedule. Functional changes are kept to a minimum, as the API still serves the same data. Because this work covers so much of Flamenco's code, it's been split up into different commits. Each commit brings Flamenco to a state where it compiles and unit tests pass. Only the result of the final commit has actually been tested properly. Ref: #104343
119 lines
5.4 KiB
YAML
119 lines
5.4 KiB
YAML
version: "2"
|
|
sql:
|
|
- engine: "sqlite"
|
|
schema: "internal/manager/persistence/sqlc/schema.sql"
|
|
queries: "internal/manager/persistence/sqlc/query_jobs.sql"
|
|
gen:
|
|
go:
|
|
out: "internal/manager/persistence/sqlc"
|
|
overrides:
|
|
- db_type: "jsonb"
|
|
go_type:
|
|
import: "encoding/json"
|
|
type: "RawMessage"
|
|
- column: jobs.status
|
|
go_type: { type: "JobStatus", import: "projects.blender.org/studio/flamenco/pkg/api" }
|
|
- column: tasks.status
|
|
go_type: { type: "TaskStatus", import: "projects.blender.org/studio/flamenco/pkg/api" }
|
|
- column: workers.status
|
|
go_type: { type: "WorkerStatus", import: "projects.blender.org/studio/flamenco/pkg/api" }
|
|
- column: workers.status_requested
|
|
go_type: { type: "WorkerStatus", import: "projects.blender.org/studio/flamenco/pkg/api" }
|
|
- column: sleep_schedules.start_time
|
|
go_type: { type: "TimeOfDay", import: "projects.blender.org/studio/flamenco/pkg/time_of_day" }
|
|
- column: sleep_schedules.end_time
|
|
go_type: { type: "TimeOfDay", import: "projects.blender.org/studio/flamenco/pkg/time_of_day" }
|
|
rename:
|
|
uuid: "UUID"
|
|
uuids: "UUIDs"
|
|
jobuuid: "JobUUID"
|
|
taskUUID: "TaskUUID"
|
|
workeruuid: "WorkerUUID"
|
|
- engine: "sqlite"
|
|
schema: "internal/manager/persistence/sqlc/schema.sql"
|
|
queries: "internal/manager/persistence/sqlc/query_workers.sql"
|
|
gen:
|
|
go:
|
|
out: "internal/manager/persistence/sqlc"
|
|
overrides:
|
|
- db_type: "jsonb"
|
|
go_type:
|
|
import: "encoding/json"
|
|
type: "RawMessage"
|
|
- column: jobs.status
|
|
go_type: { type: "JobStatus", import: "projects.blender.org/studio/flamenco/pkg/api" }
|
|
- column: tasks.status
|
|
go_type: { type: "TaskStatus", import: "projects.blender.org/studio/flamenco/pkg/api" }
|
|
- column: workers.status
|
|
go_type: { type: "WorkerStatus", import: "projects.blender.org/studio/flamenco/pkg/api" }
|
|
- column: workers.status_requested
|
|
go_type: { type: "WorkerStatus", import: "projects.blender.org/studio/flamenco/pkg/api" }
|
|
- column: sleep_schedules.start_time
|
|
go_type: { type: "TimeOfDay", import: "projects.blender.org/studio/flamenco/pkg/time_of_day" }
|
|
- column: sleep_schedules.end_time
|
|
go_type: { type: "TimeOfDay", import: "projects.blender.org/studio/flamenco/pkg/time_of_day" }
|
|
rename:
|
|
uuid: "UUID"
|
|
uuids: "UUIDs"
|
|
jobuuid: "JobUUID"
|
|
taskUUID: "TaskUUID"
|
|
workeruuid: "WorkerUUID"
|
|
- engine: "sqlite"
|
|
schema: "internal/manager/persistence/sqlc/schema.sql"
|
|
queries: "internal/manager/persistence/sqlc/query_task_scheduler.sql"
|
|
gen:
|
|
go:
|
|
out: "internal/manager/persistence/sqlc"
|
|
overrides:
|
|
- db_type: "jsonb"
|
|
go_type:
|
|
import: "encoding/json"
|
|
type: "RawMessage"
|
|
- column: jobs.status
|
|
go_type: { type: "JobStatus", import: "projects.blender.org/studio/flamenco/pkg/api" }
|
|
- column: tasks.status
|
|
go_type: { type: "TaskStatus", import: "projects.blender.org/studio/flamenco/pkg/api" }
|
|
- column: workers.status
|
|
go_type: { type: "WorkerStatus", import: "projects.blender.org/studio/flamenco/pkg/api" }
|
|
- column: workers.status_requested
|
|
go_type: { type: "WorkerStatus", import: "projects.blender.org/studio/flamenco/pkg/api" }
|
|
- column: sleep_schedules.start_time
|
|
go_type: { type: "TimeOfDay", import: "projects.blender.org/studio/flamenco/pkg/time_of_day" }
|
|
- column: sleep_schedules.end_time
|
|
go_type: { type: "TimeOfDay", import: "projects.blender.org/studio/flamenco/pkg/time_of_day" }
|
|
rename:
|
|
uuid: "UUID"
|
|
uuids: "UUIDs"
|
|
jobuuid: "JobUUID"
|
|
taskUUID: "TaskUUID"
|
|
workeruuid: "WorkerUUID"
|
|
- engine: "sqlite"
|
|
schema: "internal/worker/persistence/sqlc/schema.sql"
|
|
queries: "internal/worker/persistence/sqlc/query.sql"
|
|
gen:
|
|
go:
|
|
out: "internal/worker/persistence/sqlc"
|
|
overrides:
|
|
- db_type: "jsonb"
|
|
go_type:
|
|
import: "encoding/json"
|
|
type: "RawMessage"
|
|
- column: jobs.status
|
|
go_type: { type: "JobStatus", import: "projects.blender.org/studio/flamenco/pkg/api" }
|
|
- column: tasks.status
|
|
go_type: { type: "TaskStatus", import: "projects.blender.org/studio/flamenco/pkg/api" }
|
|
- column: workers.status
|
|
go_type: { type: "WorkerStatus", import: "projects.blender.org/studio/flamenco/pkg/api" }
|
|
- column: workers.status_requested
|
|
go_type: { type: "WorkerStatus", import: "projects.blender.org/studio/flamenco/pkg/api" }
|
|
- column: sleep_schedules.start_time
|
|
go_type: { type: "TimeOfDay", import: "projects.blender.org/studio/flamenco/pkg/time_of_day" }
|
|
- column: sleep_schedules.end_time
|
|
go_type: { type: "TimeOfDay", import: "projects.blender.org/studio/flamenco/pkg/time_of_day" }
|
|
rename:
|
|
uuid: "UUID"
|
|
uuids: "UUIDs"
|
|
jobuuid: "JobUUID"
|
|
taskUUID: "TaskUUID"
|
|
workeruuid: "WorkerUUID"
|