forked from retoor/devplacepy
iUUUUpdatexz
This commit is contained in:
@@ -568,10 +568,109 @@ def init_db():
|
||||
("boot_language", "none"),
|
||||
("boot_script", ""),
|
||||
("start_on_boot", 0),
|
||||
("is_workspace", 0),
|
||||
("workspace_owner_uid", ""),
|
||||
("editor_port", 0),
|
||||
("editor_host_port", 0),
|
||||
("tunnel_name", ""),
|
||||
("last_active_at", ""),
|
||||
("idle_warned_at", ""),
|
||||
("delete_warned_at", ""),
|
||||
("disk_bytes", 0),
|
||||
("disk_sampled_at", ""),
|
||||
("egress_bytes", 0),
|
||||
("request_count", 0),
|
||||
("flagged_at", ""),
|
||||
("flag_reason", ""),
|
||||
("suspended_at", ""),
|
||||
("suspended_by", ""),
|
||||
):
|
||||
if not instances.has_column(column):
|
||||
instances.create_column_by_example(column, example)
|
||||
|
||||
tunnels = get_table("tunnels")
|
||||
for column, example in (
|
||||
("uid", ""),
|
||||
("instance_uid", ""),
|
||||
("project_uid", ""),
|
||||
("user_uid", ""),
|
||||
("hostname", ""),
|
||||
("label", ""),
|
||||
("container_port", 0),
|
||||
("desired_state", "present"),
|
||||
("status", "pending"),
|
||||
("cert_status", ""),
|
||||
("cert_checked_at", ""),
|
||||
("request_count", 0),
|
||||
("bytes_out", 0),
|
||||
("last_request_at", ""),
|
||||
("last_error", ""),
|
||||
("last_synced_at", ""),
|
||||
("created_at", ""),
|
||||
("updated_at", ""),
|
||||
):
|
||||
if not tunnels.has_column(column):
|
||||
tunnels.create_column_by_example(column, example)
|
||||
|
||||
quota_rules = get_table("workspace_quota_rules")
|
||||
for column, example in (
|
||||
("uid", ""),
|
||||
("owner_kind", ""),
|
||||
("owner_id", ""),
|
||||
("label", ""),
|
||||
("max_workspaces", 0),
|
||||
("max_tunnels", 0),
|
||||
("disk_quota_mb", 0),
|
||||
("egress_quota_mb", 0),
|
||||
("idle_stop_minutes", 0),
|
||||
("retention_days", 0),
|
||||
("created_at", ""),
|
||||
("updated_at", ""),
|
||||
):
|
||||
if not quota_rules.has_column(column):
|
||||
quota_rules.create_column_by_example(column, example)
|
||||
|
||||
flags = get_table("workspace_flags")
|
||||
for column, example in (
|
||||
("uid", ""),
|
||||
("instance_uid", ""),
|
||||
("user_uid", ""),
|
||||
("kind", ""),
|
||||
("severity", "warn"),
|
||||
("detail", ""),
|
||||
("metric_value", 0.0),
|
||||
("threshold", 0.0),
|
||||
("status", "open"),
|
||||
("resolved_by", ""),
|
||||
("resolved_at", ""),
|
||||
("created_at", ""),
|
||||
("updated_at", ""),
|
||||
):
|
||||
if not flags.has_column(column):
|
||||
flags.create_column_by_example(column, example)
|
||||
|
||||
_index(db, "instances", "idx_instances_workspace", ["is_workspace", "status"])
|
||||
_index(db, "instances", "idx_instances_workspace_owner", ["workspace_owner_uid"])
|
||||
_index(db, "instances", "idx_instances_tunnel_name", ["tunnel_name"])
|
||||
_index(db, "tunnels", "idx_tunnels_hostname", ["hostname"])
|
||||
_index(db, "tunnels", "idx_tunnels_instance", ["instance_uid"])
|
||||
_index(db, "tunnels", "idx_tunnels_user", ["user_uid"])
|
||||
_index(db, "tunnels", "idx_tunnels_state", ["desired_state", "status"])
|
||||
_index(
|
||||
db,
|
||||
"workspace_quota_rules",
|
||||
"idx_workspace_quota_owner",
|
||||
["owner_kind", "owner_id"],
|
||||
)
|
||||
_index(db, "workspace_flags", "idx_workspace_flags_open", ["status", "created_at"])
|
||||
_index(
|
||||
db,
|
||||
"workspace_flags",
|
||||
"idx_workspace_flags_instance",
|
||||
["instance_uid", "kind"],
|
||||
)
|
||||
_index(db, "workspace_flags", "idx_workspace_flags_user", ["user_uid"])
|
||||
|
||||
_index(db, "instances", "idx_instances_project", ["project_uid"])
|
||||
_index(db, "instances", "idx_instances_slug", ["slug"])
|
||||
_index(db, "instances", "idx_instances_name", ["name"])
|
||||
|
||||
Reference in New Issue
Block a user