chore: Rename Projects to Templates (#880)

Customer feedback indicated projects was a confusing name.
After querying the team internally, it seemed unanimous
that it is indeed a confusing name.

Here's for a lil less confusion @ashmeer7 🥂
This commit is contained in:
Kyle Carberry
2022-04-06 12:42:40 -05:00
committed by GitHub
parent 584c8b4fc3
commit 02ad3f14f5
109 changed files with 2548 additions and 2547 deletions
@@ -1,6 +0,0 @@
DROP TABLE project_versions;
DROP TABLE projects;
DROP TYPE provisioner_type;
DROP TABLE files;
@@ -0,0 +1,6 @@
DROP TABLE template_versions;
DROP TABLE templates;
DROP TYPE provisioner_type;
DROP TABLE files;
@@ -1,4 +1,4 @@
-- Store arbitrary data like project source code or avatars.
-- Store arbitrary data like template source code or avatars.
CREATE TABLE files (
hash varchar(64) NOT NULL,
created_at timestamptz NOT NULL,
@@ -11,37 +11,37 @@ CREATE TABLE files (
CREATE TYPE provisioner_type AS ENUM ('echo', 'terraform');
-- Project defines infrastructure that your software project
-- Template defines infrastructure that your software template
-- requires for development.
CREATE TABLE projects (
CREATE TABLE templates (
id uuid NOT NULL,
created_at timestamptz NOT NULL,
updated_at timestamptz NOT NULL,
-- Projects must be scoped to an organization.
-- Templates must be scoped to an organization.
organization_id uuid NOT NULL REFERENCES organizations (id) ON DELETE CASCADE,
deleted boolean NOT NULL DEFAULT FALSE,
name varchar(64) NOT NULL,
provisioner provisioner_type NOT NULL,
-- Target's a Project Version to use for Workspaces.
-- Target's a Template Version to use for Workspaces.
-- If a Workspace doesn't match this version, it will be prompted to rebuild.
active_version_id uuid NOT NULL,
PRIMARY KEY (id),
-- Disallow projects to have the same name under
-- Disallow templates to have the same name under
-- the same organization.
UNIQUE(organization_id, name)
);
-- Enforces no active projects have the same name.
CREATE UNIQUE INDEX ON projects (organization_id, name) WHERE deleted = FALSE;
CREATE UNIQUE INDEX idx_projects_name_lower ON projects USING btree (lower(name));
-- Enforces no active templates have the same name.
CREATE UNIQUE INDEX ON templates (organization_id, name) WHERE deleted = FALSE;
CREATE UNIQUE INDEX idx_templates_name_lower ON templates USING btree (lower(name));
-- Project Versions store historical project data. When a Project Version is imported,
-- an "import" job is queued to parse parameters. A Project Version
-- Template Versions store historical template data. When a Template Version is imported,
-- an "import" job is queued to parse parameters. A Template Version
-- can only be used if the import job succeeds.
CREATE TABLE project_versions (
CREATE TABLE template_versions (
id uuid NOT NULL,
-- This should be indexed. It is intentionally nullable.
project_id uuid REFERENCES projects (id) ON DELETE CASCADE,
template_id uuid REFERENCES templates (id) ON DELETE CASCADE,
organization_id uuid NOT NULL REFERENCES organizations (id) ON DELETE CASCADE,
created_at timestamptz NOT NULL,
updated_at timestamptz NOT NULL,
@@ -51,10 +51,10 @@ CREATE TABLE project_versions (
-- Extracted from a README.md on import.
-- Maximum of 1MB.
description varchar(1048576) NOT NULL,
-- The job ID for building the project version.
-- The job ID for building the template version.
job_id uuid NOT NULL,
PRIMARY KEY (id),
-- Disallow projects to have the same build name
-- Disallow templates to have the same build name
-- multiple times.
UNIQUE(project_id, name)
UNIQUE(template_id, name)
);
@@ -5,7 +5,7 @@ CREATE TABLE workspaces (
-- Use ON DELETE RESTRICT so that we can cleanup external workspace
-- resources first.
owner_id uuid NOT NULL REFERENCES users (id) ON DELETE RESTRICT,
project_id uuid NOT NULL REFERENCES projects (id) ON DELETE RESTRICT,
template_id uuid NOT NULL REFERENCES templates (id) ON DELETE RESTRICT,
deleted boolean NOT NULL DEFAULT FALSE,
name varchar(64) NOT NULL,
PRIMARY KEY (id)
@@ -11,7 +11,7 @@ CREATE TABLE IF NOT EXISTS provisioner_daemons (
);
CREATE TYPE provisioner_job_type AS ENUM (
'project_version_import',
'template_version_import',
'workspace_build'
);
@@ -92,7 +92,7 @@ CREATE TABLE workspace_agents (
CREATE TYPE parameter_scope AS ENUM (
'organization',
'project',
'template',
'import_job',
'user',
'workspace'
@@ -107,7 +107,7 @@ CREATE TYPE parameter_source_scheme AS ENUM('none', 'data');
-- Supported schemes for a parameter destination.
CREATE TYPE parameter_destination_scheme AS ENUM('none', 'environment_variable', 'provisioner_variable');
-- Stores project version parameters parsed on import.
-- Stores template version parameters parsed on import.
-- No secrets are stored here.
--
-- All parameter validation occurs server-side to process
@@ -162,7 +162,7 @@ CREATE TABLE workspace_builds (
created_at timestamptz NOT NULL,
updated_at timestamptz NOT NULL,
workspace_id uuid NOT NULL REFERENCES workspaces (id) ON DELETE CASCADE,
project_version_id uuid NOT NULL REFERENCES project_versions (id) ON DELETE CASCADE,
template_version_id uuid NOT NULL REFERENCES template_versions (id) ON DELETE CASCADE,
name varchar(64) NOT NULL,
before_id uuid,
after_id uuid,