g1t/services/projects/migrations/0001_init.sql
Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.
| Projects: what a workspace builds and runs, first on every page | 1 | -- Projects: the thing a workspace builds and runs, each with one source. |
| 2 | -- Every timestamp is RFC 3339 UTC. | |
| 3 | ||
| 4 | CREATE TABLE projects ( | |
| 5 | id TEXT PRIMARY KEY, | |
| 6 | -- The workspace's slug. | |
| 7 | workspace TEXT NOT NULL, | |
| 8 | -- Unique in the workspace: g1t.sh/<workspace>/<slug>. | |
| 9 | slug TEXT NOT NULL, | |
| 10 | name TEXT NOT NULL, | |
| 11 | description TEXT, | |
| 12 | -- hosted (a repository on g1t); mirror sources come later. | |
| 13 | source_kind TEXT NOT NULL DEFAULT 'hosted', | |
| 14 | repo_id TEXT NOT NULL, | |
| 15 | repo_namespace TEXT NOT NULL, | |
| 16 | repo_name TEXT NOT NULL, | |
| 17 | repo_private INTEGER NOT NULL DEFAULT 0, | |
| 18 | default_branch TEXT NOT NULL DEFAULT 'main', | |
| 19 | -- Where in the repository it lives; '' for all of it. | |
| 20 | root_dir TEXT NOT NULL DEFAULT '', | |
| 21 | -- The project its repository's workflows read secrets from. | |
| 22 | is_primary INTEGER NOT NULL DEFAULT 0, | |
| 23 | created_by TEXT NOT NULL, | |
| 24 | created_at TEXT NOT NULL, | |
| 25 | updated_at TEXT NOT NULL, | |
| 26 | UNIQUE (workspace, slug) | |
| 27 | ); | |
| 28 | CREATE INDEX projects_by_repo ON projects (repo_id, is_primary DESC); | |
| 29 | ||
| 30 | -- Workspaces whose existing repositories have all been given projects. | |
| 31 | CREATE TABLE backfilled ( | |
| 32 | workspace TEXT PRIMARY KEY, | |
| 33 | at TEXT NOT NULL | |
| 34 | ); |