Skip to content

Create database schema for Auto ON/OFF #270

Closed
@misskniss

Description

@misskniss
  • Cleanup: remove column workspace_auto_off from table organizations

  • Add columns to table workspace

    • autostart_enabled:bool default false
    • autostop_enabled:bool default false
    • autostart_at:timestamp with time zone default '0001-01-01- 00:00:00+00::timestamptz NOTE: this will include the user’s timezone
    • autostop_at:timestamp with time zone default '0001-01-01- 00:00:00+00::timestamptz NOTE: this will include the user’s timezone
  • Add methods to querier.go:

    • SetWorkspaceAutoStartEnabled(ctx context.Context, workspaceid string, when time.Time) error
    • SetWorkspaceAutoStartDisabled(ctx context.Context, workspaceid string) error
    • SetWorkspaceAutoStopEnabled(ctx context.Context, workspaceid string, when time.Time) error
    • SetWorkspaceAutoStopDisabled(ctx context.Context, workspaceid string) error
  • Changes:

    • Instead of a time.Time, will use a crontab-style representation for schedules. See create cron-style library or wrapper for workspace autostart / autostop #817.
    • autostart_at and autostop_at will be renamed autostart_schedule and autostop_schedule respectively.
    • autostart_schedule and autostop_schedule will allow NULL values, allowing autostart_enabled and autostop_enabled to be removed.
    • We only need the UpdateWorkspaceAutostart and UpdateWorkspaceAutostop methods, passing nil as the schedule can be semantically equivalent to DisableWorkspaceAuto{Stop,Start}.

Metadata

Metadata

Assignees

Labels

apiArea: HTTP API

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions