@@ -52,9 +52,7 @@ CREATE TABLE "projects" (
"host_user_id" INTEGER REFERENCES users (id),
"host_connection_id" INTEGER,
"host_connection_server_id" INTEGER REFERENCES servers (id) ON DELETE CASCADE,
- "unregistered" BOOLEAN NOT NULL DEFAULT FALSE,
- "hosted_project_id" INTEGER REFERENCES hosted_projects (id),
- "dev_server_project_id" INTEGER REFERENCES dev_server_projects(id)
+ "unregistered" BOOLEAN NOT NULL DEFAULT FALSE
);
CREATE INDEX "index_projects_on_host_connection_server_id" ON "projects" ("host_connection_server_id");
CREATE INDEX "index_projects_on_host_connection_id_and_host_connection_server_id" ON "projects" ("host_connection_id", "host_connection_server_id");
@@ -399,30 +397,6 @@ CREATE TABLE rate_buckets (
);
CREATE INDEX idx_user_id_rate_limit ON rate_buckets (user_id, rate_limit_name);
-CREATE TABLE hosted_projects (
- id INTEGER PRIMARY KEY AUTOINCREMENT,
- channel_id INTEGER NOT NULL REFERENCES channels(id),
- name TEXT NOT NULL,
- visibility TEXT NOT NULL,
- deleted_at TIMESTAMP NULL
-);
-CREATE INDEX idx_hosted_projects_on_channel_id ON hosted_projects (channel_id);
-CREATE UNIQUE INDEX uix_hosted_projects_on_channel_id_and_name ON hosted_projects (channel_id, name) WHERE (deleted_at IS NULL);
-
-CREATE TABLE dev_servers (
- id INTEGER PRIMARY KEY AUTOINCREMENT,
- user_id INTEGER NOT NULL REFERENCES users(id),
- name TEXT NOT NULL,
- ssh_connection_string TEXT,
- hashed_token TEXT NOT NULL
-);
-
-CREATE TABLE dev_server_projects (
- id INTEGER PRIMARY KEY AUTOINCREMENT,
- dev_server_id INTEGER NOT NULL REFERENCES dev_servers(id),
- paths TEXT NOT NULL
-);
-
CREATE TABLE IF NOT EXISTS billing_preferences (
id INTEGER PRIMARY KEY AUTOINCREMENT,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
@@ -750,49 +750,6 @@ impl Database {
Ok((project, replica_id as ReplicaId))
}
- pub async fn leave_hosted_project(
- &self,
- project_id: ProjectId,
- connection: ConnectionId,
- ) -> Result<LeftProject> {
- self.transaction(|tx| async move {
- let result = project_collaborator::Entity::delete_many()
- .filter(
- Condition::all()
- .add(project_collaborator::Column::ProjectId.eq(project_id))
- .add(project_collaborator::Column::ConnectionId.eq(connection.id as i32))
- .add(
- project_collaborator::Column::ConnectionServerId
- .eq(connection.owner_id as i32),
- ),
- )
- .exec(&*tx)
- .await?;
- if result.rows_affected == 0 {
- return Err(anyhow!("not in the project"))?;
- }
-
- let project = project::Entity::find_by_id(project_id)
- .one(&*tx)
- .await?
- .ok_or_else(|| anyhow!("no such project"))?;
- let collaborators = project
- .find_related(project_collaborator::Entity)
- .all(&*tx)
- .await?;
- let connection_ids = collaborators
- .into_iter()
- .map(|collaborator| collaborator.connection())
- .collect();
- Ok(LeftProject {
- id: project.id,
- connection_ids,
- should_unshare: false,
- })
- })
- .await
- }
-
/// Removes the given connection from the specified project.
pub async fn leave_project(
&self,