Detailed changes
@@ -1,20 +0,0 @@
-CREATE TABLE IF NOT EXISTS "sessions" (
- "id" VARCHAR NOT NULL PRIMARY KEY,
- "expires" TIMESTAMP WITH TIME ZONE NULL,
- "session" TEXT NOT NULL
-);
-
-CREATE TABLE IF NOT EXISTS "users" (
- "id" SERIAL PRIMARY KEY,
- "github_login" VARCHAR,
- "admin" BOOLEAN
-);
-
-CREATE UNIQUE INDEX "index_users_github_login" ON "users" ("github_login");
-
-CREATE TABLE IF NOT EXISTS "signups" (
- "id" SERIAL PRIMARY KEY,
- "github_login" VARCHAR,
- "email_address" VARCHAR,
- "about" TEXT
-);
@@ -1,7 +0,0 @@
-CREATE TABLE IF NOT EXISTS "access_tokens" (
- "id" SERIAL PRIMARY KEY,
- "user_id" INTEGER REFERENCES users (id),
- "hash" VARCHAR(128)
-);
-
-CREATE INDEX "index_access_tokens_user_id" ON "access_tokens" ("user_id");
@@ -1,46 +0,0 @@
-CREATE TABLE IF NOT EXISTS "orgs" (
- "id" SERIAL PRIMARY KEY,
- "name" VARCHAR NOT NULL,
- "slug" VARCHAR NOT NULL
-);
-
-CREATE UNIQUE INDEX "index_orgs_slug" ON "orgs" ("slug");
-
-CREATE TABLE IF NOT EXISTS "org_memberships" (
- "id" SERIAL PRIMARY KEY,
- "org_id" INTEGER REFERENCES orgs (id) NOT NULL,
- "user_id" INTEGER REFERENCES users (id) NOT NULL,
- "admin" BOOLEAN NOT NULL
-);
-
-CREATE INDEX "index_org_memberships_user_id" ON "org_memberships" ("user_id");
-CREATE UNIQUE INDEX "index_org_memberships_org_id_and_user_id" ON "org_memberships" ("org_id", "user_id");
-
-CREATE TABLE IF NOT EXISTS "channels" (
- "id" SERIAL PRIMARY KEY,
- "owner_id" INTEGER NOT NULL,
- "owner_is_user" BOOLEAN NOT NULL,
- "name" VARCHAR NOT NULL
-);
-
-CREATE UNIQUE INDEX "index_channels_owner_and_name" ON "channels" ("owner_is_user", "owner_id", "name");
-
-CREATE TABLE IF NOT EXISTS "channel_memberships" (
- "id" SERIAL PRIMARY KEY,
- "channel_id" INTEGER REFERENCES channels (id) NOT NULL,
- "user_id" INTEGER REFERENCES users (id) NOT NULL,
- "admin" BOOLEAN NOT NULL
-);
-
-CREATE INDEX "index_channel_memberships_user_id" ON "channel_memberships" ("user_id");
-CREATE UNIQUE INDEX "index_channel_memberships_channel_id_and_user_id" ON "channel_memberships" ("channel_id", "user_id");
-
-CREATE TABLE IF NOT EXISTS "channel_messages" (
- "id" SERIAL PRIMARY KEY,
- "channel_id" INTEGER REFERENCES channels (id) NOT NULL,
- "sender_id" INTEGER REFERENCES users (id) NOT NULL,
- "body" TEXT NOT NULL,
- "sent_at" TIMESTAMP
-);
-
-CREATE INDEX "index_channel_messages_channel_id" ON "channel_messages" ("channel_id");
@@ -1,4 +0,0 @@
-ALTER TABLE "channel_messages"
-ADD "nonce" UUID NOT NULL DEFAULT gen_random_uuid();
-
-CREATE UNIQUE INDEX "index_channel_messages_nonce" ON "channel_messages" ("nonce");
@@ -1,4 +0,0 @@
-ALTER TABLE "signups"
- ADD "wants_releases" BOOLEAN,
- ADD "wants_updates" BOOLEAN,
- ADD "wants_community" BOOLEAN;
@@ -1 +0,0 @@
-DROP TABLE IF EXISTS "signups";
@@ -1,2 +0,0 @@
-CREATE EXTENSION IF NOT EXISTS pg_trgm;
-CREATE INDEX trigram_index_users_on_github_login ON users USING GIN(github_login gin_trgm_ops);
@@ -1,11 +0,0 @@
-CREATE TABLE IF NOT EXISTS "contacts" (
- "id" SERIAL PRIMARY KEY,
- "user_id_a" INTEGER REFERENCES users (id) NOT NULL,
- "user_id_b" INTEGER REFERENCES users (id) NOT NULL,
- "a_to_b" BOOLEAN NOT NULL,
- "should_notify" BOOLEAN NOT NULL,
- "accepted" BOOLEAN NOT NULL
-);
-
-CREATE UNIQUE INDEX "index_contacts_user_ids" ON "contacts" ("user_id_a", "user_id_b");
-CREATE INDEX "index_contacts_user_id_b" ON "contacts" ("user_id_b");
@@ -1,9 +0,0 @@
-ALTER TABLE users
-ADD email_address VARCHAR(255) DEFAULT NULL,
-ADD invite_code VARCHAR(64),
-ADD invite_count INTEGER NOT NULL DEFAULT 0,
-ADD inviter_id INTEGER REFERENCES users (id),
-ADD connected_once BOOLEAN NOT NULL DEFAULT false,
-ADD created_at TIMESTAMP NOT NULL DEFAULT NOW();
-
-CREATE UNIQUE INDEX "index_invite_code_users" ON "users" ("invite_code");
@@ -1,6 +0,0 @@
-ALTER TABLE contacts DROP CONSTRAINT contacts_user_id_a_fkey;
-ALTER TABLE contacts DROP CONSTRAINT contacts_user_id_b_fkey;
-ALTER TABLE contacts ADD CONSTRAINT contacts_user_id_a_fkey FOREIGN KEY (user_id_a) REFERENCES users(id) ON DELETE CASCADE;
-ALTER TABLE contacts ADD CONSTRAINT contacts_user_id_b_fkey FOREIGN KEY (user_id_b) REFERENCES users(id) ON DELETE CASCADE;
-ALTER TABLE users DROP CONSTRAINT users_inviter_id_fkey;
-ALTER TABLE users ADD CONSTRAINT users_inviter_id_fkey FOREIGN KEY (inviter_id) REFERENCES users(id) ON DELETE SET NULL;
@@ -1,24 +0,0 @@
-CREATE TABLE IF NOT EXISTS "projects" (
- "id" SERIAL PRIMARY KEY,
- "host_user_id" INTEGER REFERENCES users (id) NOT NULL,
- "unregistered" BOOLEAN NOT NULL DEFAULT false
-);
-
-CREATE TABLE IF NOT EXISTS "worktree_extensions" (
- "id" SERIAL PRIMARY KEY,
- "project_id" INTEGER REFERENCES projects (id) NOT NULL,
- "worktree_id" INTEGER NOT NULL,
- "extension" VARCHAR(255),
- "count" INTEGER NOT NULL
-);
-
-CREATE TABLE IF NOT EXISTS "project_activity_periods" (
- "id" SERIAL PRIMARY KEY,
- "duration_millis" INTEGER NOT NULL,
- "ended_at" TIMESTAMP NOT NULL,
- "user_id" INTEGER REFERENCES users (id) NOT NULL,
- "project_id" INTEGER REFERENCES projects (id) NOT NULL
-);
-
-CREATE INDEX "index_project_activity_periods_on_ended_at" ON "project_activity_periods" ("ended_at");
-CREATE UNIQUE INDEX "index_worktree_extensions_on_project_id_and_worktree_id_and_extension" ON "worktree_extensions" ("project_id", "worktree_id", "extension");
@@ -1,27 +0,0 @@
-CREATE TABLE IF NOT EXISTS "signups" (
- "id" SERIAL PRIMARY KEY,
- "email_address" VARCHAR NOT NULL,
- "email_confirmation_code" VARCHAR(64) NOT NULL,
- "email_confirmation_sent" BOOLEAN NOT NULL,
- "created_at" TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
- "device_id" VARCHAR,
- "user_id" INTEGER REFERENCES users (id) ON DELETE CASCADE,
- "inviting_user_id" INTEGER REFERENCES users (id) ON DELETE SET NULL,
-
- "platform_mac" BOOLEAN NOT NULL,
- "platform_linux" BOOLEAN NOT NULL,
- "platform_windows" BOOLEAN NOT NULL,
- "platform_unknown" BOOLEAN NOT NULL,
-
- "editor_features" VARCHAR[],
- "programming_languages" VARCHAR[]
-);
-
-CREATE UNIQUE INDEX "index_signups_on_email_address" ON "signups" ("email_address");
-CREATE INDEX "index_signups_on_email_confirmation_sent" ON "signups" ("email_confirmation_sent");
-
-ALTER TABLE "users"
- ADD "github_user_id" INTEGER;
-
-CREATE INDEX "index_users_on_email_address" ON "users" ("email_address");
-CREATE INDEX "index_users_on_github_user_id" ON "users" ("github_user_id");
@@ -1,2 +0,0 @@
-ALTER TABLE "users"
- ADD "metrics_id" uuid NOT NULL DEFAULT gen_random_uuid();
@@ -1,90 +0,0 @@
-CREATE TABLE IF NOT EXISTS "rooms" (
- "id" SERIAL PRIMARY KEY,
- "live_kit_room" VARCHAR NOT NULL
-);
-
-ALTER TABLE "projects"
- ADD "room_id" INTEGER REFERENCES rooms (id),
- ADD "host_connection_id" INTEGER,
- ADD "host_connection_epoch" UUID;
-CREATE INDEX "index_projects_on_host_connection_epoch" ON "projects" ("host_connection_epoch");
-
-CREATE TABLE "worktrees" (
- "project_id" INTEGER NOT NULL REFERENCES projects (id) ON DELETE CASCADE,
- "id" INT8 NOT NULL,
- "root_name" VARCHAR NOT NULL,
- "abs_path" VARCHAR NOT NULL,
- "visible" BOOL NOT NULL,
- "scan_id" INT8 NOT NULL,
- "is_complete" BOOL NOT NULL,
- PRIMARY KEY(project_id, id)
-);
-CREATE INDEX "index_worktrees_on_project_id" ON "worktrees" ("project_id");
-
-CREATE TABLE "worktree_entries" (
- "project_id" INTEGER NOT NULL,
- "worktree_id" INT8 NOT NULL,
- "id" INT8 NOT NULL,
- "is_dir" BOOL NOT NULL,
- "path" VARCHAR NOT NULL,
- "inode" INT8 NOT NULL,
- "mtime_seconds" INT8 NOT NULL,
- "mtime_nanos" INTEGER NOT NULL,
- "is_symlink" BOOL NOT NULL,
- "is_ignored" BOOL NOT NULL,
- PRIMARY KEY(project_id, worktree_id, id),
- FOREIGN KEY(project_id, worktree_id) REFERENCES worktrees (project_id, id) ON DELETE CASCADE
-);
-CREATE INDEX "index_worktree_entries_on_project_id" ON "worktree_entries" ("project_id");
-CREATE INDEX "index_worktree_entries_on_project_id_and_worktree_id" ON "worktree_entries" ("project_id", "worktree_id");
-
-CREATE TABLE "worktree_diagnostic_summaries" (
- "project_id" INTEGER NOT NULL,
- "worktree_id" INT8 NOT NULL,
- "path" VARCHAR NOT NULL,
- "language_server_id" INT8 NOT NULL,
- "error_count" INTEGER NOT NULL,
- "warning_count" INTEGER NOT NULL,
- PRIMARY KEY(project_id, worktree_id, path),
- FOREIGN KEY(project_id, worktree_id) REFERENCES worktrees (project_id, id) ON DELETE CASCADE
-);
-CREATE INDEX "index_worktree_diagnostic_summaries_on_project_id" ON "worktree_diagnostic_summaries" ("project_id");
-CREATE INDEX "index_worktree_diagnostic_summaries_on_project_id_and_worktree_id" ON "worktree_diagnostic_summaries" ("project_id", "worktree_id");
-
-CREATE TABLE "language_servers" (
- "project_id" INTEGER NOT NULL REFERENCES projects (id) ON DELETE CASCADE,
- "id" INT8 NOT NULL,
- "name" VARCHAR NOT NULL,
- PRIMARY KEY(project_id, id)
-);
-CREATE INDEX "index_language_servers_on_project_id" ON "language_servers" ("project_id");
-
-CREATE TABLE "project_collaborators" (
- "id" SERIAL PRIMARY KEY,
- "project_id" INTEGER NOT NULL REFERENCES projects (id) ON DELETE CASCADE,
- "connection_id" INTEGER NOT NULL,
- "connection_epoch" UUID NOT NULL,
- "user_id" INTEGER NOT NULL,
- "replica_id" INTEGER NOT NULL,
- "is_host" BOOLEAN NOT NULL
-);
-CREATE INDEX "index_project_collaborators_on_project_id" ON "project_collaborators" ("project_id");
-CREATE UNIQUE INDEX "index_project_collaborators_on_project_id_and_replica_id" ON "project_collaborators" ("project_id", "replica_id");
-CREATE INDEX "index_project_collaborators_on_connection_epoch" ON "project_collaborators" ("connection_epoch");
-
-CREATE TABLE "room_participants" (
- "id" SERIAL PRIMARY KEY,
- "room_id" INTEGER NOT NULL REFERENCES rooms (id),
- "user_id" INTEGER NOT NULL REFERENCES users (id),
- "answering_connection_id" INTEGER,
- "answering_connection_epoch" UUID,
- "location_kind" INTEGER,
- "location_project_id" INTEGER,
- "initial_project_id" INTEGER,
- "calling_user_id" INTEGER NOT NULL REFERENCES users (id),
- "calling_connection_id" INTEGER NOT NULL,
- "calling_connection_epoch" UUID NOT NULL
-);
-CREATE UNIQUE INDEX "index_room_participants_on_user_id" ON "room_participants" ("user_id");
-CREATE INDEX "index_room_participants_on_answering_connection_epoch" ON "room_participants" ("answering_connection_epoch");
-CREATE INDEX "index_room_participants_on_calling_connection_epoch" ON "room_participants" ("calling_connection_epoch");
@@ -1,2 +0,0 @@
-ALTER TABLE "signups"
- ADD "added_to_mailing_list" BOOLEAN NOT NULL DEFAULT FALSE;
@@ -1,7 +0,0 @@
-ALTER TABLE "room_participants"
- ADD "answering_connection_lost" BOOLEAN NOT NULL DEFAULT FALSE;
-
-CREATE INDEX "index_project_collaborators_on_connection_id" ON "project_collaborators" ("connection_id");
-CREATE UNIQUE INDEX "index_project_collaborators_on_project_id_connection_id_and_epoch" ON "project_collaborators" ("project_id", "connection_id", "connection_epoch");
-CREATE INDEX "index_room_participants_on_answering_connection_id" ON "room_participants" ("answering_connection_id");
-CREATE UNIQUE INDEX "index_room_participants_on_answering_connection_id_and_answering_connection_epoch" ON "room_participants" ("answering_connection_id", "answering_connection_epoch");
@@ -1 +0,0 @@
-CREATE INDEX "index_room_participants_on_room_id" ON "room_participants" ("room_id");
@@ -1,30 +0,0 @@
-CREATE TABLE servers (
- id SERIAL PRIMARY KEY,
- environment VARCHAR NOT NULL
-);
-
-DROP TABLE worktree_extensions;
-DROP TABLE project_activity_periods;
-DELETE from projects;
-ALTER TABLE projects
- DROP COLUMN host_connection_epoch,
- ADD COLUMN host_connection_server_id INTEGER REFERENCES servers (id) ON DELETE CASCADE;
-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");
-
-DELETE FROM project_collaborators;
-ALTER TABLE project_collaborators
- DROP COLUMN connection_epoch,
- ADD COLUMN connection_server_id INTEGER NOT NULL REFERENCES servers (id) ON DELETE CASCADE;
-CREATE INDEX "index_project_collaborators_on_connection_server_id" ON "project_collaborators" ("connection_server_id");
-CREATE UNIQUE INDEX "index_project_collaborators_on_project_id_connection_id_and_server_id" ON "project_collaborators" ("project_id", "connection_id", "connection_server_id");
-
-DELETE FROM room_participants;
-ALTER TABLE room_participants
- DROP COLUMN answering_connection_epoch,
- DROP COLUMN calling_connection_epoch,
- ADD COLUMN answering_connection_server_id INTEGER REFERENCES servers (id) ON DELETE CASCADE,
- ADD COLUMN calling_connection_server_id INTEGER REFERENCES servers (id) ON DELETE SET NULL;
-CREATE INDEX "index_room_participants_on_answering_connection_server_id" ON "room_participants" ("answering_connection_server_id");
-CREATE INDEX "index_room_participants_on_calling_connection_server_id" ON "room_participants" ("calling_connection_server_id");
-CREATE UNIQUE INDEX "index_room_participants_on_answering_connection_id_and_answering_connection_server_id" ON "room_participants" ("answering_connection_id", "answering_connection_server_id");
@@ -1,3 +0,0 @@
-ALTER TABLE "worktree_entries"
- ADD COLUMN "scan_id" INT8,
- ADD COLUMN "is_deleted" BOOL;
@@ -1,3 +0,0 @@
-ALTER TABLE worktrees
- ALTER COLUMN is_complete SET DEFAULT FALSE,
- ADD COLUMN completed_scan_id INT8;
@@ -1,15 +0,0 @@
-CREATE TABLE IF NOT EXISTS "followers" (
- "id" SERIAL PRIMARY KEY,
- "room_id" INTEGER NOT NULL REFERENCES rooms (id) ON DELETE CASCADE,
- "project_id" INTEGER NOT NULL REFERENCES projects (id) ON DELETE CASCADE,
- "leader_connection_server_id" INTEGER NOT NULL REFERENCES servers (id) ON DELETE CASCADE,
- "leader_connection_id" INTEGER NOT NULL,
- "follower_connection_server_id" INTEGER NOT NULL REFERENCES servers (id) ON DELETE CASCADE,
- "follower_connection_id" INTEGER NOT NULL
-);
-
-CREATE UNIQUE INDEX
- "index_followers_on_project_id_and_leader_connection_server_id_and_leader_connection_id_and_follower_connection_server_id_and_follower_connection_id"
-ON "followers" ("project_id", "leader_connection_server_id", "leader_connection_id", "follower_connection_server_id", "follower_connection_id");
-
-CREATE INDEX "index_followers_on_room_id" ON "followers" ("room_id");
@@ -1,13 +0,0 @@
-CREATE TABLE "worktree_repositories" (
- "project_id" INTEGER NOT NULL,
- "worktree_id" INT8 NOT NULL,
- "work_directory_id" INT8 NOT NULL,
- "scan_id" INT8 NOT NULL,
- "branch" VARCHAR,
- "is_deleted" BOOL NOT NULL,
- PRIMARY KEY(project_id, worktree_id, work_directory_id),
- FOREIGN KEY(project_id, worktree_id) REFERENCES worktrees (project_id, id) ON DELETE CASCADE,
- FOREIGN KEY(project_id, worktree_id, work_directory_id) REFERENCES worktree_entries (project_id, worktree_id, id) ON DELETE CASCADE
-);
-CREATE INDEX "index_worktree_repositories_on_project_id" ON "worktree_repositories" ("project_id");
-CREATE INDEX "index_worktree_repositories_on_project_id_and_worktree_id" ON "worktree_repositories" ("project_id", "worktree_id");
@@ -1,15 +0,0 @@
-CREATE TABLE "worktree_repository_statuses" (
- "project_id" INTEGER NOT NULL,
- "worktree_id" INT8 NOT NULL,
- "work_directory_id" INT8 NOT NULL,
- "repo_path" VARCHAR NOT NULL,
- "status" INT8 NOT NULL,
- "scan_id" INT8 NOT NULL,
- "is_deleted" BOOL NOT NULL,
- PRIMARY KEY(project_id, worktree_id, work_directory_id, repo_path),
- FOREIGN KEY(project_id, worktree_id) REFERENCES worktrees (project_id, id) ON DELETE CASCADE,
- FOREIGN KEY(project_id, worktree_id, work_directory_id) REFERENCES worktree_entries (project_id, worktree_id, id) ON DELETE CASCADE
-);
-CREATE INDEX "index_wt_repos_statuses_on_project_id" ON "worktree_repository_statuses" ("project_id");
-CREATE INDEX "index_wt_repos_statuses_on_project_id_and_wt_id" ON "worktree_repository_statuses" ("project_id", "worktree_id");
-CREATE INDEX "index_wt_repos_statuses_on_project_id_and_wt_id_and_wd_id" ON "worktree_repository_statuses" ("project_id", "worktree_id", "work_directory_id");
@@ -1,10 +0,0 @@
-CREATE TABLE "worktree_settings_files" (
- "project_id" INTEGER NOT NULL,
- "worktree_id" INT8 NOT NULL,
- "path" VARCHAR NOT NULL,
- "content" TEXT NOT NULL,
- PRIMARY KEY(project_id, worktree_id, path),
- FOREIGN KEY(project_id, worktree_id) REFERENCES worktrees (project_id, id) ON DELETE CASCADE
-);
-CREATE INDEX "index_settings_files_on_project_id" ON "worktree_settings_files" ("project_id");
-CREATE INDEX "index_settings_files_on_project_id_and_wt_id" ON "worktree_settings_files" ("project_id", "worktree_id");
@@ -1,2 +0,0 @@
-ALTER TABLE "worktree_entries"
-ADD "git_status" INT8;
@@ -1,2 +0,0 @@
-ALTER TABLE "worktree_entries"
-ADD "is_external" BOOL NOT NULL DEFAULT FALSE;
@@ -1,30 +0,0 @@
-DROP TABLE "channel_messages";
-DROP TABLE "channel_memberships";
-DROP TABLE "org_memberships";
-DROP TABLE "orgs";
-DROP TABLE "channels";
-
-CREATE TABLE "channels" (
- "id" SERIAL PRIMARY KEY,
- "name" VARCHAR NOT NULL,
- "created_at" TIMESTAMP NOT NULL DEFAULT now()
-);
-
-CREATE TABLE "channel_paths" (
- "id_path" VARCHAR NOT NULL PRIMARY KEY,
- "channel_id" INTEGER NOT NULL REFERENCES channels (id) ON DELETE CASCADE
-);
-CREATE INDEX "index_channel_paths_on_channel_id" ON "channel_paths" ("channel_id");
-
-CREATE TABLE "channel_members" (
- "id" SERIAL PRIMARY KEY,
- "channel_id" INTEGER NOT NULL REFERENCES channels (id) ON DELETE CASCADE,
- "user_id" INTEGER NOT NULL REFERENCES users (id) ON DELETE CASCADE,
- "admin" BOOLEAN NOT NULL DEFAULT false,
- "accepted" BOOLEAN NOT NULL DEFAULT false,
- "updated_at" TIMESTAMP NOT NULL DEFAULT now()
-);
-
-CREATE UNIQUE INDEX "index_channel_members_on_channel_id_and_user_id" ON "channel_members" ("channel_id", "user_id");
-
-ALTER TABLE rooms ADD COLUMN "channel_id" INTEGER REFERENCES channels (id) ON DELETE CASCADE;
@@ -1,40 +0,0 @@
-CREATE TABLE "buffers" (
- "id" SERIAL PRIMARY KEY,
- "channel_id" INTEGER NOT NULL REFERENCES channels (id) ON DELETE CASCADE,
- "epoch" INTEGER NOT NULL DEFAULT 0
-);
-
-CREATE INDEX "index_buffers_on_channel_id" ON "buffers" ("channel_id");
-
-CREATE TABLE "buffer_operations" (
- "buffer_id" INTEGER NOT NULL REFERENCES buffers (id) ON DELETE CASCADE,
- "epoch" INTEGER NOT NULL,
- "replica_id" INTEGER NOT NULL,
- "lamport_timestamp" INTEGER NOT NULL,
- "value" BYTEA NOT NULL,
- PRIMARY KEY(buffer_id, epoch, lamport_timestamp, replica_id)
-);
-
-CREATE TABLE "buffer_snapshots" (
- "buffer_id" INTEGER NOT NULL REFERENCES buffers (id) ON DELETE CASCADE,
- "epoch" INTEGER NOT NULL,
- "text" TEXT NOT NULL,
- "operation_serialization_version" INTEGER NOT NULL,
- PRIMARY KEY(buffer_id, epoch)
-);
-
-CREATE TABLE "channel_buffer_collaborators" (
- "id" SERIAL PRIMARY KEY,
- "channel_id" INTEGER NOT NULL REFERENCES channels (id) ON DELETE CASCADE,
- "connection_id" INTEGER NOT NULL,
- "connection_server_id" INTEGER NOT NULL REFERENCES servers (id) ON DELETE CASCADE,
- "connection_lost" BOOLEAN NOT NULL DEFAULT FALSE,
- "user_id" INTEGER NOT NULL REFERENCES users (id) ON DELETE CASCADE,
- "replica_id" INTEGER NOT NULL
-);
-
-CREATE INDEX "index_channel_buffer_collaborators_on_channel_id" ON "channel_buffer_collaborators" ("channel_id");
-CREATE UNIQUE INDEX "index_channel_buffer_collaborators_on_channel_id_and_replica_id" ON "channel_buffer_collaborators" ("channel_id", "replica_id");
-CREATE INDEX "index_channel_buffer_collaborators_on_connection_server_id" ON "channel_buffer_collaborators" ("connection_server_id");
-CREATE INDEX "index_channel_buffer_collaborators_on_connection_id" ON "channel_buffer_collaborators" ("connection_id");
-CREATE UNIQUE INDEX "index_channel_buffer_collaborators_on_channel_id_connection_id_and_server_id" ON "channel_buffer_collaborators" ("channel_id", "connection_id", "connection_server_id");
@@ -1,16 +0,0 @@
-CREATE TABLE "feature_flags" (
- "id" SERIAL PRIMARY KEY,
- "flag" VARCHAR(255) NOT NULL UNIQUE
-);
-
-CREATE UNIQUE INDEX "index_feature_flags" ON "feature_flags" ("id");
-
-CREATE TABLE "user_features" (
- "user_id" INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,
- "feature_id" INTEGER NOT NULL REFERENCES feature_flags(id) ON DELETE CASCADE,
- PRIMARY KEY (user_id, feature_id)
-);
-
-CREATE UNIQUE INDEX "index_user_features_user_id_and_feature_id" ON "user_features" ("user_id", "feature_id");
-CREATE INDEX "index_user_features_on_user_id" ON "user_features" ("user_id");
-CREATE INDEX "index_user_features_on_feature_id" ON "user_features" ("feature_id");
@@ -1,19 +0,0 @@
-CREATE TABLE IF NOT EXISTS "channel_messages" (
- "id" SERIAL PRIMARY KEY,
- "channel_id" INTEGER NOT NULL REFERENCES channels (id) ON DELETE CASCADE,
- "sender_id" INTEGER NOT NULL REFERENCES users (id),
- "body" TEXT NOT NULL,
- "sent_at" TIMESTAMP,
- "nonce" UUID NOT NULL
-);
-CREATE INDEX "index_channel_messages_on_channel_id" ON "channel_messages" ("channel_id");
-CREATE UNIQUE INDEX "index_channel_messages_on_nonce" ON "channel_messages" ("nonce");
-
-CREATE TABLE IF NOT EXISTS "channel_chat_participants" (
- "id" SERIAL PRIMARY KEY,
- "user_id" INTEGER NOT NULL REFERENCES users (id),
- "channel_id" INTEGER NOT NULL REFERENCES channels (id) ON DELETE CASCADE,
- "connection_id" INTEGER NOT NULL,
- "connection_server_id" INTEGER NOT NULL REFERENCES servers (id) ON DELETE CASCADE
-);
-CREATE INDEX "index_channel_chat_participants_on_channel_id" ON "channel_chat_participants" ("channel_id");
@@ -1,19 +0,0 @@
-CREATE TABLE IF NOT EXISTS "observed_buffer_edits" (
- "user_id" INTEGER NOT NULL REFERENCES users (id) ON DELETE CASCADE,
- "buffer_id" INTEGER NOT NULL REFERENCES buffers (id) ON DELETE CASCADE,
- "epoch" INTEGER NOT NULL,
- "lamport_timestamp" INTEGER NOT NULL,
- "replica_id" INTEGER NOT NULL,
- PRIMARY KEY (user_id, buffer_id)
-);
-
-CREATE UNIQUE INDEX "index_observed_buffer_user_and_buffer_id" ON "observed_buffer_edits" ("user_id", "buffer_id");
-
-CREATE TABLE IF NOT EXISTS "observed_channel_messages" (
- "user_id" INTEGER NOT NULL REFERENCES users (id) ON DELETE CASCADE,
- "channel_id" INTEGER NOT NULL REFERENCES channels (id) ON DELETE CASCADE,
- "channel_message_id" INTEGER NOT NULL,
- PRIMARY KEY (user_id, channel_id)
-);
-
-CREATE UNIQUE INDEX "index_observed_channel_messages_user_and_channel_id" ON "observed_channel_messages" ("user_id", "channel_id");
@@ -1 +0,0 @@
-ALTER TABLE room_participants ADD COLUMN participant_index INTEGER;
@@ -1,22 +0,0 @@
-CREATE TABLE "notification_kinds" (
- "id" SERIAL PRIMARY KEY,
- "name" VARCHAR NOT NULL
-);
-
-CREATE UNIQUE INDEX "index_notification_kinds_on_name" ON "notification_kinds" ("name");
-
-CREATE TABLE notifications (
- "id" SERIAL PRIMARY KEY,
- "created_at" TIMESTAMP NOT NULL DEFAULT now(),
- "recipient_id" INTEGER NOT NULL REFERENCES users (id) ON DELETE CASCADE,
- "kind" INTEGER NOT NULL REFERENCES notification_kinds (id),
- "entity_id" INTEGER,
- "content" TEXT,
- "is_read" BOOLEAN NOT NULL DEFAULT FALSE,
- "response" BOOLEAN
-);
-
-CREATE INDEX
- "index_notifications_on_recipient_id_is_read_kind_entity_id"
- ON "notifications"
- ("recipient_id", "is_read", "kind", "entity_id");
@@ -1 +0,0 @@
-ALTER TABLE rooms ADD COLUMN enviroment TEXT;
@@ -1 +0,0 @@
-CREATE UNIQUE INDEX "index_rooms_on_channel_id" ON "rooms" ("channel_id");
@@ -1,4 +0,0 @@
-ALTER TABLE channel_members ADD COLUMN role TEXT;
-UPDATE channel_members SET role = CASE WHEN admin THEN 'admin' ELSE 'member' END;
-
-ALTER TABLE channels ADD COLUMN visibility TEXT NOT NULL DEFAULT 'members';
@@ -1,8 +0,0 @@
--- Add migration script here
-
-ALTER TABLE projects
- DROP CONSTRAINT projects_room_id_fkey,
- ADD CONSTRAINT projects_room_id_fkey
- FOREIGN KEY (room_id)
- REFERENCES rooms (id)
- ON DELETE CASCADE;
@@ -1,11 +0,0 @@
-CREATE TABLE "channel_message_mentions" (
- "message_id" INTEGER NOT NULL REFERENCES channel_messages (id) ON DELETE CASCADE,
- "start_offset" INTEGER NOT NULL,
- "end_offset" INTEGER NOT NULL,
- "user_id" INTEGER NOT NULL REFERENCES users (id) ON DELETE CASCADE,
- PRIMARY KEY(message_id, start_offset)
-);
-
--- We use 'on conflict update' with this index, so it should be per-user.
-CREATE UNIQUE INDEX "index_channel_messages_on_sender_id_nonce" ON "channel_messages" ("sender_id", "nonce");
-DROP INDEX "index_channel_messages_on_nonce";
@@ -1,12 +0,0 @@
-ALTER TABLE channels ADD COLUMN parent_path TEXT;
-
-UPDATE channels
-SET parent_path = substr(
- channel_paths.id_path,
- 2,
- length(channel_paths.id_path) - length('/' || channel_paths.channel_id::text || '/')
-)
-FROM channel_paths
-WHERE channel_paths.channel_id = channels.id;
-
-CREATE INDEX "index_channels_on_parent_path" ON "channels" ("parent_path");
@@ -1 +0,0 @@
-ALTER TABLE room_participants ADD COLUMN role TEXT;
@@ -1 +0,0 @@
-ALTER TABLE rooms ADD COLUMN environment TEXT;
@@ -1 +0,0 @@
-ALTER TABLE access_tokens ADD COLUMN impersonated_user_id integer;
@@ -1,5 +0,0 @@
-CREATE TABLE contributors (
- user_id INTEGER REFERENCES users(id),
- signed_at TIMESTAMP NOT NULL DEFAULT NOW(),
- PRIMARY KEY (user_id)
-);
@@ -1 +0,0 @@
-ALTER TABLE "channels" ADD COLUMN "requires_zed_cla" BOOLEAN NOT NULL DEFAULT FALSE;
@@ -1,4 +0,0 @@
--- Add migration script here
-
-DROP INDEX index_channels_on_parent_path;
-CREATE INDEX index_channels_on_parent_path ON channels (parent_path text_pattern_ops);
@@ -1 +0,0 @@
-ALTER TABLE channel_messages ADD reply_to_message_id INTEGER DEFAULT NULL
@@ -1,3 +0,0 @@
--- Add migration script here
-
-ALTER TABLE room_participants ADD COLUMN in_call BOOL NOT NULL DEFAULT FALSE;
@@ -1,4 +0,0 @@
--- Add migration script here
-ALTER TABLE rooms DROP COLUMN enviroment;
-ALTER TABLE rooms DROP COLUMN environment;
-ALTER TABLE room_participants DROP COLUMN in_call;
@@ -1,22 +0,0 @@
-CREATE TABLE IF NOT EXISTS extensions (
- id SERIAL PRIMARY KEY,
- name TEXT NOT NULL,
- external_id TEXT NOT NULL,
- latest_version TEXT NOT NULL,
- total_download_count BIGINT NOT NULL DEFAULT 0
-);
-
-CREATE TABLE IF NOT EXISTS extension_versions (
- extension_id INTEGER REFERENCES extensions(id),
- version TEXT NOT NULL,
- published_at TIMESTAMP NOT NULL DEFAULT now(),
- authors TEXT NOT NULL,
- repository TEXT NOT NULL,
- description TEXT NOT NULL,
- download_count BIGINT NOT NULL DEFAULT 0,
- PRIMARY KEY(extension_id, version)
-);
-
-CREATE UNIQUE INDEX "index_extensions_external_id" ON "extensions" ("external_id");
-CREATE INDEX "trigram_index_extensions_name" ON "extensions" USING GIN(name gin_trgm_ops);
-CREATE INDEX "index_extensions_total_download_count" ON "extensions" ("total_download_count");
@@ -1,11 +0,0 @@
-CREATE TABLE IF NOT EXISTS rate_buckets (
- user_id INT NOT NULL,
- rate_limit_name VARCHAR(255) NOT NULL,
- token_count INT NOT NULL,
- last_refill TIMESTAMP WITHOUT TIME ZONE NOT NULL,
- PRIMARY KEY (user_id, rate_limit_name),
- CONSTRAINT fk_user
- FOREIGN KEY (user_id) REFERENCES users(id)
-);
-
-CREATE INDEX idx_user_id_rate_limit ON rate_buckets (user_id, rate_limit_name);
@@ -1 +0,0 @@
-ALTER TABLE channel_messages ADD edited_at TIMESTAMP DEFAULT NULL;
@@ -1,11 +0,0 @@
--- Add migration script here
-
-CREATE TABLE hosted_projects (
- id INT PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
- channel_id INT 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);
@@ -1,3 +0,0 @@
--- Add migration script here
-
-CREATE UNIQUE INDEX uix_channels_parent_path_name ON channels(parent_path, name) WHERE (parent_path IS NOT NULL AND parent_path != '');
@@ -1,3 +0,0 @@
--- Add migration script here
-ALTER TABLE projects ALTER COLUMN host_user_id DROP NOT NULL;
-ALTER TABLE projects ADD COLUMN hosted_project_id INTEGER REFERENCES hosted_projects(id) UNIQUE NULL;
@@ -1,17 +0,0 @@
--- Add migration script here
-
-ALTER TABLE buffers ADD COLUMN latest_operation_epoch INTEGER;
-ALTER TABLE buffers ADD COLUMN latest_operation_lamport_timestamp INTEGER;
-ALTER TABLE buffers ADD COLUMN latest_operation_replica_id INTEGER;
-
-WITH ops AS (
- SELECT DISTINCT ON (buffer_id) buffer_id, epoch, lamport_timestamp, replica_id
- FROM buffer_operations
- ORDER BY buffer_id, epoch DESC, lamport_timestamp DESC, replica_id DESC
-)
-UPDATE buffers
-SET latest_operation_epoch = ops.epoch,
- latest_operation_lamport_timestamp = ops.lamport_timestamp,
- latest_operation_replica_id = ops.replica_id
-FROM ops
-WHERE buffers.id = ops.buffer_id;
@@ -1,4 +0,0 @@
--- Add migration script here
-
-ALTER TABLE channel_members ALTER role SET NOT NULL;
-ALTER TABLE channel_members DROP COLUMN admin;
@@ -1,2 +0,0 @@
--- Add migration script here
-ALTER TABLE channels ALTER parent_path SET NOT NULL;
@@ -1,2 +0,0 @@
--- Add migration script here
-ALTER TABLE extension_versions ADD COLUMN schema_version INTEGER NOT NULL DEFAULT 0;
@@ -1,7 +0,0 @@
-CREATE TABLE dev_servers (
- id INT PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
- channel_id INT NOT NULL REFERENCES channels(id),
- name TEXT NOT NULL,
- hashed_token TEXT NOT NULL
-);
-CREATE INDEX idx_dev_servers_on_channel_id ON dev_servers (channel_id);
@@ -1 +0,0 @@
-ALTER TABLE extension_versions ADD COLUMN wasm_api_version TEXT;
@@ -1,9 +0,0 @@
-CREATE TABLE remote_projects (
- id INT PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
- channel_id INT NOT NULL REFERENCES channels(id),
- dev_server_id INT NOT NULL REFERENCES dev_servers(id),
- name TEXT NOT NULL,
- path TEXT NOT NULL
-);
-
-ALTER TABLE projects ADD COLUMN remote_project_id INTEGER REFERENCES remote_projects(id);
@@ -1,9 +0,0 @@
-CREATE TABLE IF NOT EXISTS "embeddings" (
- "model" TEXT,
- "digest" BYTEA,
- "dimensions" FLOAT4[1536],
- "retrieved_at" TIMESTAMP NOT NULL DEFAULT now(),
- PRIMARY KEY ("model", "digest")
-);
-
-CREATE INDEX IF NOT EXISTS "idx_retrieved_at_on_embeddings" ON "embeddings" ("retrieved_at");
@@ -1,7 +0,0 @@
-DELETE FROM remote_projects;
-DELETE FROM dev_servers;
-
-ALTER TABLE dev_servers DROP COLUMN channel_id;
-ALTER TABLE dev_servers ADD COLUMN user_id INT NOT NULL REFERENCES users(id);
-
-ALTER TABLE remote_projects DROP COLUMN channel_id;
@@ -1,3 +0,0 @@
-ALTER TABLE remote_projects DROP COLUMN name;
-ALTER TABLE remote_projects
-ADD CONSTRAINT unique_path_constraint UNIQUE(dev_server_id, path);
@@ -1,11 +0,0 @@
-CREATE TABLE dev_server_projects (
- id INT PRIMARY KEY GENERATED ALWAYS AS IDENTITY (START WITH 100),
- dev_server_id INT NOT NULL REFERENCES dev_servers(id) ON DELETE CASCADE,
- path TEXT NOT NULL
-);
-INSERT INTO dev_server_projects OVERRIDING SYSTEM VALUE SELECT * FROM remote_projects;
-
-ALTER TABLE dev_server_projects ADD CONSTRAINT uix_dev_server_projects_dev_server_id_path UNIQUE(dev_server_id, path);
-
-ALTER TABLE projects ADD COLUMN dev_server_project_id INTEGER REFERENCES dev_server_projects(id);
-UPDATE projects SET dev_server_project_id = remote_project_id;
@@ -1,2 +0,0 @@
-ALTER TABLE projects DROP COLUMN remote_project_id;
-DROP TABLE remote_projects;
@@ -1 +0,0 @@
-ALTER TABLE dev_servers ADD COLUMN ssh_connection_string TEXT;
@@ -1,4 +0,0 @@
-ALTER TABLE dev_server_projects ADD COLUMN paths JSONB NULL;
-UPDATE dev_server_projects SET paths = to_json(ARRAY[path]);
-ALTER TABLE dev_server_projects ALTER COLUMN paths SET NOT NULL;
-ALTER TABLE dev_server_projects ALTER COLUMN path DROP NOT NULL;
@@ -1,12 +0,0 @@
-CREATE TABLE IF NOT EXISTS billing_subscriptions (
- id SERIAL PRIMARY KEY,
- created_at TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT now(),
- user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,
- stripe_customer_id TEXT NOT NULL,
- stripe_subscription_id TEXT NOT NULL,
- stripe_subscription_status TEXT NOT NULL
-);
-
-CREATE INDEX "ix_billing_subscriptions_on_user_id" ON billing_subscriptions (user_id);
-CREATE INDEX "ix_billing_subscriptions_on_stripe_customer_id" ON billing_subscriptions (stripe_customer_id);
-CREATE UNIQUE INDEX "uix_billing_subscriptions_on_stripe_subscription_id" ON billing_subscriptions (stripe_subscription_id);
@@ -1,18 +0,0 @@
-CREATE TABLE IF NOT EXISTS billing_customers (
- id SERIAL PRIMARY KEY,
- created_at TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT now(),
- user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,
- stripe_customer_id TEXT NOT NULL
-);
-
-CREATE UNIQUE INDEX "uix_billing_customers_on_user_id" ON billing_customers (user_id);
-CREATE UNIQUE INDEX "uix_billing_customers_on_stripe_customer_id" ON billing_customers (stripe_customer_id);
-
--- Make `billing_subscriptions` reference `billing_customers` instead of having its
--- own `user_id` and `stripe_customer_id`.
-DROP INDEX IF EXISTS "ix_billing_subscriptions_on_user_id";
-DROP INDEX IF EXISTS "ix_billing_subscriptions_on_stripe_customer_id";
-ALTER TABLE billing_subscriptions DROP COLUMN user_id;
-ALTER TABLE billing_subscriptions DROP COLUMN stripe_customer_id;
-ALTER TABLE billing_subscriptions ADD COLUMN billing_customer_id INTEGER NOT NULL REFERENCES billing_customers (id) ON DELETE CASCADE;
-CREATE INDEX "ix_billing_subscriptions_on_billing_customer_id" ON billing_subscriptions (billing_customer_id);
@@ -1,2 +0,0 @@
-ALTER TABLE billing_customers ADD COLUMN last_stripe_event_id TEXT;
-ALTER TABLE billing_subscriptions ADD COLUMN last_stripe_event_id TEXT;
@@ -1,11 +0,0 @@
-ALTER TABLE billing_customers DROP COLUMN last_stripe_event_id;
-ALTER TABLE billing_subscriptions DROP COLUMN last_stripe_event_id;
-
-CREATE TABLE IF NOT EXISTS processed_stripe_events (
- stripe_event_id TEXT PRIMARY KEY,
- stripe_event_type TEXT NOT NULL,
- stripe_event_created_timestamp BIGINT NOT NULL,
- processed_at TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT now()
-);
-
-CREATE INDEX "ix_processed_stripe_events_on_stripe_event_created_timestamp" ON processed_stripe_events (stripe_event_created_timestamp);
@@ -1 +0,0 @@
-ALTER TABLE billing_subscriptions ADD COLUMN stripe_cancel_at TIMESTAMP WITHOUT TIME ZONE;
@@ -1 +0,0 @@
-ALTER TABLE users ADD accepted_tos_at TIMESTAMP WITHOUT TIME ZONE;
@@ -1 +0,0 @@
-ALTER TABLE "users" ADD COLUMN "github_user_created_at" TIMESTAMP WITHOUT TIME ZONE;
@@ -1 +0,0 @@
-alter table feature_flags add column enabled_for_all boolean not null default false;
@@ -1,4 +0,0 @@
-alter table users alter column github_user_id set not null;
-
-drop index index_users_on_github_user_id;
-create unique index uix_users_on_github_user_id on users (github_user_id);
@@ -1,2 +0,0 @@
-ALTER TABLE "worktree_entries"
-ADD "is_fifo" BOOL NOT NULL DEFAULT FALSE;
@@ -1 +0,0 @@
-ALTER TABLE "worktree_settings_files" ADD COLUMN "kind" VARCHAR;
@@ -1,8 +0,0 @@
-create table if not exists billing_preferences (
- id serial primary key,
- created_at timestamp without time zone not null default now(),
- user_id integer not null references users(id) on delete cascade,
- max_monthly_llm_usage_spending_in_cents integer not null
-);
-
-create unique index "uix_billing_preferences_on_user_id" on billing_preferences (user_id);
@@ -1,2 +0,0 @@
-ALTER TABLE worktree_entries ADD COLUMN canonical_path text;
-ALTER TABLE worktree_entries ALTER COLUMN is_symlink SET DEFAULT false;
@@ -1 +0,0 @@
-alter table users add column custom_llm_monthly_allowance_in_cents integer;
@@ -1,6 +0,0 @@
-ALTER TABLE projects DROP COLUMN dev_server_project_id;
-ALTER TABLE projects DROP COLUMN hosted_project_id;
-
-DROP TABLE hosted_projects;
-DROP TABLE dev_server_projects;
-DROP TABLE dev_servers;
@@ -1,11 +0,0 @@
-CREATE TABLE IF NOT EXISTS "breakpoints" (
- "id" SERIAL PRIMARY KEY,
- "project_id" INTEGER NOT NULL REFERENCES projects (id) ON DELETE CASCADE,
- "position" INTEGER NOT NULL,
- "log_message" TEXT NULL,
- "worktree_id" BIGINT NOT NULL,
- "path" TEXT NOT NULL,
- "kind" VARCHAR NOT NULL
-);
-
-CREATE INDEX "index_breakpoints_on_project_id" ON "breakpoints" ("project_id");
@@ -1,2 +0,0 @@
-alter table billing_subscriptions
-add column stripe_cancellation_reason text;
@@ -1,13 +0,0 @@
-ALTER TABLE worktree_repository_statuses
-ADD COLUMN status_kind INTEGER,
-ADD COLUMN first_status INTEGER,
-ADD COLUMN second_status INTEGER;
-
-UPDATE worktree_repository_statuses
-SET
- status_kind = 0;
-
-ALTER TABLE worktree_repository_statuses
-ALTER COLUMN status_kind
-SET
- NOT NULL;
@@ -1 +0,0 @@
-ALTER TABLE users ADD COLUMN name TEXT;
@@ -1,2 +0,0 @@
-alter table billing_customers
-add column has_overdue_invoices bool not null default false;
@@ -1,10 +0,0 @@
-alter table extension_versions
-add column provides_themes bool not null default false,
-add column provides_icon_themes bool not null default false,
-add column provides_languages bool not null default false,
-add column provides_grammars bool not null default false,
-add column provides_language_servers bool not null default false,
-add column provides_context_servers bool not null default false,
-add column provides_slash_commands bool not null default false,
-add column provides_indexed_docs_providers bool not null default false,
-add column provides_snippets bool not null default false;
@@ -1,2 +0,0 @@
-ALTER TABLE worktree_repositories
-ADD COLUMN current_merge_conflicts VARCHAR NULL;
@@ -1,2 +0,0 @@
-ALTER TABLE worktree_repositories
-ADD COLUMN worktree_repositories VARCHAR NULL;
@@ -1 +0,0 @@
-ALTER TABLE worktree_repositories ADD COLUMN branch_summary TEXT NULL;
@@ -1,32 +0,0 @@
-CREATE TABLE "project_repositories" (
- "project_id" INTEGER NOT NULL,
- "abs_path" VARCHAR,
- "id" INT8 NOT NULL,
- "legacy_worktree_id" INT8,
- "entry_ids" VARCHAR,
- "branch" VARCHAR,
- "scan_id" INT8 NOT NULL,
- "is_deleted" BOOL NOT NULL,
- "current_merge_conflicts" VARCHAR,
- "branch_summary" VARCHAR,
- PRIMARY KEY (project_id, id)
-);
-
-CREATE INDEX "index_project_repositories_on_project_id" ON "project_repositories" ("project_id");
-
-CREATE TABLE "project_repository_statuses" (
- "project_id" INTEGER NOT NULL,
- "repository_id" INT8 NOT NULL,
- "repo_path" VARCHAR NOT NULL,
- "status" INT8 NOT NULL,
- "status_kind" INT4 NOT NULL,
- "first_status" INT4 NULL,
- "second_status" INT4 NULL,
- "scan_id" INT8 NOT NULL,
- "is_deleted" BOOL NOT NULL,
- PRIMARY KEY (project_id, repository_id, repo_path)
-);
-
-CREATE INDEX "index_project_repos_statuses_on_project_id" ON "project_repository_statuses" ("project_id");
-
-CREATE INDEX "index_project_repos_statuses_on_project_id_and_repo_id" ON "project_repository_statuses" ("project_id", "repository_id");
@@ -1,4 +0,0 @@
-alter table billing_subscriptions
- add column kind text,
- add column stripe_current_period_start bigint,
- add column stripe_current_period_end bigint;
@@ -1,2 +0,0 @@
-alter table billing_customers
- add column trial_started_at timestamp without time zone;
@@ -1,2 +0,0 @@
-alter table project_repositories
- add column head_commit_details varchar;
@@ -1,3 +0,0 @@
-alter table billing_preferences
- add column model_request_overages_enabled bool not null default false,
- add column model_request_overages_spend_limit_in_cents integer not null default 0;
@@ -1,16 +0,0 @@
--- Add channel_order column to channels table with default value
-ALTER TABLE channels ADD COLUMN channel_order INTEGER NOT NULL DEFAULT 1;
-
--- Update channel_order for existing channels using ROW_NUMBER for deterministic ordering
-UPDATE channels
-SET channel_order = (
- SELECT ROW_NUMBER() OVER (
- PARTITION BY parent_path
- ORDER BY name, id
- )
- FROM channels c2
- WHERE c2.id = channels.id
-);
-
--- Create index for efficient ordering queries
-CREATE INDEX "index_channels_on_parent_path_and_order" ON "channels" ("parent_path", "channel_order");
@@ -1,4 +0,0 @@
-alter table project_collaborators
- add column committer_name varchar;
-alter table project_collaborators
- add column committer_email varchar;
@@ -1,2 +0,0 @@
-alter table extension_versions
-add column provides_debug_adapters bool not null default false
@@ -1,2 +0,0 @@
-alter table extension_versions
-add column provides_agent_servers bool not null default false
@@ -1,25 +0,0 @@
-DELETE FROM project_repositories
-WHERE project_id NOT IN (SELECT id FROM projects);
-
-ALTER TABLE project_repositories
- ADD CONSTRAINT fk_project_repositories_project_id
- FOREIGN KEY (project_id)
- REFERENCES projects (id)
- ON DELETE CASCADE
- NOT VALID;
-
-ALTER TABLE project_repositories
- VALIDATE CONSTRAINT fk_project_repositories_project_id;
-
-DELETE FROM project_repository_statuses
-WHERE project_id NOT IN (SELECT id FROM projects);
-
-ALTER TABLE project_repository_statuses
- ADD CONSTRAINT fk_project_repository_statuses_project_id
- FOREIGN KEY (project_id)
- REFERENCES projects (id)
- ON DELETE CASCADE
- NOT VALID;
-
-ALTER TABLE project_repository_statuses
- VALIDATE CONSTRAINT fk_project_repository_statuses_project_id;
@@ -1,3 +0,0 @@
-ALTER TABLE access_tokens DROP CONSTRAINT access_tokens_user_id_fkey;
-ALTER TABLE access_tokens ADD CONSTRAINT access_tokens_user_id_fkey
- FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;
@@ -1,5 +0,0 @@
-ALTER TABLE language_servers
- ADD COLUMN capabilities TEXT NOT NULL DEFAULT '{}';
-
-ALTER TABLE language_servers
- ALTER COLUMN capabilities DROP DEFAULT;
@@ -1,2 +0,0 @@
-alter table users
-alter column admin set not null;
@@ -1,2 +0,0 @@
-alter table billing_customers
- add column orb_customer_id text;
@@ -1 +0,0 @@
-drop table rate_buckets;
@@ -1 +0,0 @@
-ALTER TABLE "project_repositories" ADD COLUMN "merge_message" VARCHAR;
@@ -1,2 +0,0 @@
-alter table billing_subscriptions
- add column orb_subscription_id text;
@@ -1,3 +0,0 @@
-alter table billing_subscriptions
- alter column stripe_subscription_id drop not null,
- alter column stripe_subscription_status drop not null;
@@ -1,4 +0,0 @@
-alter table billing_subscriptions
- add column orb_subscription_status text,
- add column orb_current_billing_period_start_date timestamp without time zone,
- add column orb_current_billing_period_end_date timestamp without time zone;
@@ -1,2 +0,0 @@
-ALTER TABLE language_servers
- ADD COLUMN worktree_id BIGINT;
@@ -1,2 +0,0 @@
-alter table billing_subscriptions
- add column orb_cancellation_date timestamp without time zone;
@@ -1,2 +0,0 @@
-alter table billing_customers
- add column orb_portal_url text;
@@ -1 +0,0 @@
-ALTER TABLE projects ADD COLUMN windows_paths BOOLEAN DEFAULT FALSE;
@@ -1,3 +0,0 @@
-alter table billing_subscriptions
- add column token_spend_in_cents integer,
- add column token_spend_in_cents_updated_at timestamp without time zone;
@@ -1,2 +0,0 @@
-ALTER TABLE "worktree_entries"
-ADD "is_hidden" BOOL NOT NULL DEFAULT FALSE;
@@ -1,3 +0,0 @@
-drop table observed_channel_messages;
-drop table channel_message_mentions;
-drop table channel_messages;
@@ -1 +0,0 @@
-drop table embeddings;
@@ -1,4 +0,0 @@
-alter table billing_customers
- add column external_id text;
-
-create unique index uix_billing_customers_on_external_id on billing_customers (external_id);
@@ -1,2 +0,0 @@
-ALTER TABLE "project_repositories" ADD COLUMN "remote_upstream_url" VARCHAR;
-ALTER TABLE "project_repositories" ADD COLUMN "remote_origin_url" VARCHAR;
@@ -0,0 +1,899 @@
+CREATE EXTENSION IF NOT EXISTS pg_trgm WITH SCHEMA public;
+
+CREATE TABLE public.access_tokens (
+ id integer NOT NULL,
+ user_id integer,
+ hash character varying(128),
+ impersonated_user_id integer
+);
+
+CREATE SEQUENCE public.access_tokens_id_seq
+ AS integer
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE public.access_tokens_id_seq OWNED BY public.access_tokens.id;
+
+CREATE TABLE public.breakpoints (
+ id integer NOT NULL,
+ project_id integer NOT NULL,
+ "position" integer NOT NULL,
+ log_message text,
+ worktree_id bigint NOT NULL,
+ path text NOT NULL,
+ kind character varying NOT NULL
+);
+
+CREATE SEQUENCE public.breakpoints_id_seq
+ AS integer
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE public.breakpoints_id_seq OWNED BY public.breakpoints.id;
+
+CREATE TABLE public.buffer_operations (
+ buffer_id integer NOT NULL,
+ epoch integer NOT NULL,
+ replica_id integer NOT NULL,
+ lamport_timestamp integer NOT NULL,
+ value bytea NOT NULL
+);
+
+CREATE TABLE public.buffer_snapshots (
+ buffer_id integer NOT NULL,
+ epoch integer NOT NULL,
+ text text NOT NULL,
+ operation_serialization_version integer NOT NULL
+);
+
+CREATE TABLE public.buffers (
+ id integer NOT NULL,
+ channel_id integer NOT NULL,
+ epoch integer DEFAULT 0 NOT NULL,
+ latest_operation_epoch integer,
+ latest_operation_lamport_timestamp integer,
+ latest_operation_replica_id integer
+);
+
+CREATE SEQUENCE public.buffers_id_seq
+ AS integer
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE public.buffers_id_seq OWNED BY public.buffers.id;
+
+CREATE TABLE public.channel_buffer_collaborators (
+ id integer NOT NULL,
+ channel_id integer NOT NULL,
+ connection_id integer NOT NULL,
+ connection_server_id integer NOT NULL,
+ connection_lost boolean DEFAULT false NOT NULL,
+ user_id integer NOT NULL,
+ replica_id integer NOT NULL
+);
+
+CREATE SEQUENCE public.channel_buffer_collaborators_id_seq
+ AS integer
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE public.channel_buffer_collaborators_id_seq OWNED BY public.channel_buffer_collaborators.id;
+
+CREATE TABLE public.channel_chat_participants (
+ id integer NOT NULL,
+ user_id integer NOT NULL,
+ channel_id integer NOT NULL,
+ connection_id integer NOT NULL,
+ connection_server_id integer NOT NULL
+);
+
+CREATE SEQUENCE public.channel_chat_participants_id_seq
+ AS integer
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE public.channel_chat_participants_id_seq OWNED BY public.channel_chat_participants.id;
+
+CREATE TABLE public.channel_members (
+ id integer NOT NULL,
+ channel_id integer NOT NULL,
+ user_id integer NOT NULL,
+ accepted boolean DEFAULT false NOT NULL,
+ updated_at timestamp without time zone DEFAULT now() NOT NULL,
+ role text NOT NULL
+);
+
+CREATE SEQUENCE public.channel_members_id_seq
+ AS integer
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE public.channel_members_id_seq OWNED BY public.channel_members.id;
+
+CREATE TABLE public.channels (
+ id integer NOT NULL,
+ name character varying NOT NULL,
+ created_at timestamp without time zone DEFAULT now() NOT NULL,
+ visibility text DEFAULT 'members'::text NOT NULL,
+ parent_path text NOT NULL,
+ requires_zed_cla boolean DEFAULT false NOT NULL,
+ channel_order integer DEFAULT 1 NOT NULL
+);
+
+CREATE SEQUENCE public.channels_id_seq
+ AS integer
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE public.channels_id_seq OWNED BY public.channels.id;
+
+CREATE TABLE public.contacts (
+ id integer NOT NULL,
+ user_id_a integer NOT NULL,
+ user_id_b integer NOT NULL,
+ a_to_b boolean NOT NULL,
+ should_notify boolean NOT NULL,
+ accepted boolean NOT NULL
+);
+
+CREATE SEQUENCE public.contacts_id_seq
+ AS integer
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE public.contacts_id_seq OWNED BY public.contacts.id;
+
+CREATE TABLE public.contributors (
+ user_id integer NOT NULL,
+ signed_at timestamp without time zone DEFAULT now() NOT NULL
+);
+
+CREATE TABLE public.extension_versions (
+ extension_id integer NOT NULL,
+ version text NOT NULL,
+ published_at timestamp without time zone DEFAULT now() NOT NULL,
+ authors text NOT NULL,
+ repository text NOT NULL,
+ description text NOT NULL,
+ download_count bigint DEFAULT 0 NOT NULL,
+ schema_version integer DEFAULT 0 NOT NULL,
+ wasm_api_version text,
+ provides_themes boolean DEFAULT false NOT NULL,
+ provides_icon_themes boolean DEFAULT false NOT NULL,
+ provides_languages boolean DEFAULT false NOT NULL,
+ provides_grammars boolean DEFAULT false NOT NULL,
+ provides_language_servers boolean DEFAULT false NOT NULL,
+ provides_context_servers boolean DEFAULT false NOT NULL,
+ provides_slash_commands boolean DEFAULT false NOT NULL,
+ provides_indexed_docs_providers boolean DEFAULT false NOT NULL,
+ provides_snippets boolean DEFAULT false NOT NULL,
+ provides_debug_adapters boolean DEFAULT false NOT NULL,
+ provides_agent_servers boolean DEFAULT false NOT NULL
+);
+
+CREATE TABLE public.extensions (
+ id integer NOT NULL,
+ name text NOT NULL,
+ external_id text NOT NULL,
+ latest_version text NOT NULL,
+ total_download_count bigint DEFAULT 0 NOT NULL
+);
+
+CREATE SEQUENCE public.extensions_id_seq
+ AS integer
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE public.extensions_id_seq OWNED BY public.extensions.id;
+
+CREATE TABLE public.feature_flags (
+ id integer NOT NULL,
+ flag character varying(255) NOT NULL,
+ enabled_for_all boolean DEFAULT false NOT NULL
+);
+
+CREATE SEQUENCE public.feature_flags_id_seq
+ AS integer
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE public.feature_flags_id_seq OWNED BY public.feature_flags.id;
+
+CREATE TABLE public.followers (
+ id integer NOT NULL,
+ room_id integer NOT NULL,
+ project_id integer NOT NULL,
+ leader_connection_server_id integer NOT NULL,
+ leader_connection_id integer NOT NULL,
+ follower_connection_server_id integer NOT NULL,
+ follower_connection_id integer NOT NULL
+);
+
+CREATE SEQUENCE public.followers_id_seq
+ AS integer
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE public.followers_id_seq OWNED BY public.followers.id;
+
+CREATE TABLE public.language_servers (
+ project_id integer NOT NULL,
+ id bigint NOT NULL,
+ name character varying NOT NULL,
+ capabilities text NOT NULL,
+ worktree_id bigint
+);
+
+CREATE TABLE public.notification_kinds (
+ id integer NOT NULL,
+ name character varying NOT NULL
+);
+
+CREATE SEQUENCE public.notification_kinds_id_seq
+ AS integer
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE public.notification_kinds_id_seq OWNED BY public.notification_kinds.id;
+
+CREATE TABLE public.notifications (
+ id integer NOT NULL,
+ created_at timestamp without time zone DEFAULT now() NOT NULL,
+ recipient_id integer NOT NULL,
+ kind integer NOT NULL,
+ entity_id integer,
+ content text,
+ is_read boolean DEFAULT false NOT NULL,
+ response boolean
+);
+
+CREATE SEQUENCE public.notifications_id_seq
+ AS integer
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE public.notifications_id_seq OWNED BY public.notifications.id;
+
+CREATE TABLE public.observed_buffer_edits (
+ user_id integer NOT NULL,
+ buffer_id integer NOT NULL,
+ epoch integer NOT NULL,
+ lamport_timestamp integer NOT NULL,
+ replica_id integer NOT NULL
+);
+
+CREATE TABLE public.project_collaborators (
+ id integer NOT NULL,
+ project_id integer NOT NULL,
+ connection_id integer NOT NULL,
+ user_id integer NOT NULL,
+ replica_id integer NOT NULL,
+ is_host boolean NOT NULL,
+ connection_server_id integer NOT NULL,
+ committer_name character varying,
+ committer_email character varying
+);
+
+CREATE SEQUENCE public.project_collaborators_id_seq
+ AS integer
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE public.project_collaborators_id_seq OWNED BY public.project_collaborators.id;
+
+CREATE TABLE public.project_repositories (
+ project_id integer NOT NULL,
+ abs_path character varying,
+ id bigint NOT NULL,
+ legacy_worktree_id bigint,
+ entry_ids character varying,
+ branch character varying,
+ scan_id bigint NOT NULL,
+ is_deleted boolean NOT NULL,
+ current_merge_conflicts character varying,
+ branch_summary character varying,
+ head_commit_details character varying,
+ merge_message character varying
+);
+
+CREATE TABLE public.project_repository_statuses (
+ project_id integer NOT NULL,
+ repository_id bigint NOT NULL,
+ repo_path character varying NOT NULL,
+ status bigint NOT NULL,
+ status_kind integer NOT NULL,
+ first_status integer,
+ second_status integer,
+ scan_id bigint NOT NULL,
+ is_deleted boolean NOT NULL
+);
+
+CREATE TABLE public.projects (
+ id integer NOT NULL,
+ host_user_id integer,
+ unregistered boolean DEFAULT false NOT NULL,
+ room_id integer,
+ host_connection_id integer,
+ host_connection_server_id integer,
+ windows_paths boolean DEFAULT false
+);
+
+CREATE SEQUENCE public.projects_id_seq
+ AS integer
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE public.projects_id_seq OWNED BY public.projects.id;
+
+CREATE TABLE public.room_participants (
+ id integer NOT NULL,
+ room_id integer NOT NULL,
+ user_id integer NOT NULL,
+ answering_connection_id integer,
+ location_kind integer,
+ location_project_id integer,
+ initial_project_id integer,
+ calling_user_id integer NOT NULL,
+ calling_connection_id integer NOT NULL,
+ answering_connection_lost boolean DEFAULT false NOT NULL,
+ answering_connection_server_id integer,
+ calling_connection_server_id integer,
+ participant_index integer,
+ role text
+);
+
+CREATE SEQUENCE public.room_participants_id_seq
+ AS integer
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE public.room_participants_id_seq OWNED BY public.room_participants.id;
+
+CREATE TABLE public.rooms (
+ id integer NOT NULL,
+ live_kit_room character varying NOT NULL,
+ channel_id integer
+);
+
+CREATE SEQUENCE public.rooms_id_seq
+ AS integer
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE public.rooms_id_seq OWNED BY public.rooms.id;
+
+CREATE TABLE public.servers (
+ id integer NOT NULL,
+ environment character varying NOT NULL
+);
+
+CREATE SEQUENCE public.servers_id_seq
+ AS integer
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE public.servers_id_seq OWNED BY public.servers.id;
+
+CREATE TABLE public.user_features (
+ user_id integer NOT NULL,
+ feature_id integer NOT NULL
+);
+
+CREATE TABLE public.users (
+ id integer NOT NULL,
+ github_login character varying,
+ admin boolean NOT NULL,
+ email_address character varying(255) DEFAULT NULL::character varying,
+ invite_code character varying(64),
+ invite_count integer DEFAULT 0 NOT NULL,
+ inviter_id integer,
+ connected_once boolean DEFAULT false NOT NULL,
+ created_at timestamp without time zone DEFAULT now() NOT NULL,
+ github_user_id integer NOT NULL,
+ metrics_id uuid DEFAULT gen_random_uuid() NOT NULL,
+ accepted_tos_at timestamp without time zone,
+ github_user_created_at timestamp without time zone,
+ custom_llm_monthly_allowance_in_cents integer,
+ name text
+);
+
+CREATE SEQUENCE public.users_id_seq
+ AS integer
+ START WITH 1
+ INCREMENT BY 1
+ NO MINVALUE
+ NO MAXVALUE
+ CACHE 1;
+
+ALTER SEQUENCE public.users_id_seq OWNED BY public.users.id;
+
+CREATE TABLE public.worktree_diagnostic_summaries (
+ project_id integer NOT NULL,
+ worktree_id bigint NOT NULL,
+ path character varying NOT NULL,
+ language_server_id bigint NOT NULL,
+ error_count integer NOT NULL,
+ warning_count integer NOT NULL
+);
+
+CREATE TABLE public.worktree_entries (
+ project_id integer NOT NULL,
+ worktree_id bigint NOT NULL,
+ id bigint NOT NULL,
+ is_dir boolean NOT NULL,
+ path character varying NOT NULL,
+ inode bigint NOT NULL,
+ mtime_seconds bigint NOT NULL,
+ mtime_nanos integer NOT NULL,
+ is_symlink boolean DEFAULT false NOT NULL,
+ is_ignored boolean NOT NULL,
+ scan_id bigint,
+ is_deleted boolean,
+ git_status bigint,
+ is_external boolean DEFAULT false NOT NULL,
+ is_fifo boolean DEFAULT false NOT NULL,
+ canonical_path text,
+ is_hidden boolean DEFAULT false NOT NULL
+);
+
+CREATE TABLE public.worktree_settings_files (
+ project_id integer NOT NULL,
+ worktree_id bigint NOT NULL,
+ path character varying NOT NULL,
+ content text NOT NULL,
+ kind character varying
+);
+
+CREATE TABLE public.worktrees (
+ project_id integer NOT NULL,
+ id bigint NOT NULL,
+ root_name character varying NOT NULL,
+ abs_path character varying NOT NULL,
+ visible boolean NOT NULL,
+ scan_id bigint NOT NULL,
+ is_complete boolean DEFAULT false NOT NULL,
+ completed_scan_id bigint
+);
+
+ALTER TABLE ONLY public.access_tokens ALTER COLUMN id SET DEFAULT nextval('public.access_tokens_id_seq'::regclass);
+
+ALTER TABLE ONLY public.breakpoints ALTER COLUMN id SET DEFAULT nextval('public.breakpoints_id_seq'::regclass);
+
+ALTER TABLE ONLY public.buffers ALTER COLUMN id SET DEFAULT nextval('public.buffers_id_seq'::regclass);
+
+ALTER TABLE ONLY public.channel_buffer_collaborators ALTER COLUMN id SET DEFAULT nextval('public.channel_buffer_collaborators_id_seq'::regclass);
+
+ALTER TABLE ONLY public.channel_chat_participants ALTER COLUMN id SET DEFAULT nextval('public.channel_chat_participants_id_seq'::regclass);
+
+ALTER TABLE ONLY public.channel_members ALTER COLUMN id SET DEFAULT nextval('public.channel_members_id_seq'::regclass);
+
+ALTER TABLE ONLY public.channels ALTER COLUMN id SET DEFAULT nextval('public.channels_id_seq'::regclass);
+
+ALTER TABLE ONLY public.contacts ALTER COLUMN id SET DEFAULT nextval('public.contacts_id_seq'::regclass);
+
+ALTER TABLE ONLY public.extensions ALTER COLUMN id SET DEFAULT nextval('public.extensions_id_seq'::regclass);
+
+ALTER TABLE ONLY public.feature_flags ALTER COLUMN id SET DEFAULT nextval('public.feature_flags_id_seq'::regclass);
+
+ALTER TABLE ONLY public.followers ALTER COLUMN id SET DEFAULT nextval('public.followers_id_seq'::regclass);
+
+ALTER TABLE ONLY public.notification_kinds ALTER COLUMN id SET DEFAULT nextval('public.notification_kinds_id_seq'::regclass);
+
+ALTER TABLE ONLY public.notifications ALTER COLUMN id SET DEFAULT nextval('public.notifications_id_seq'::regclass);
+
+ALTER TABLE ONLY public.project_collaborators ALTER COLUMN id SET DEFAULT nextval('public.project_collaborators_id_seq'::regclass);
+
+ALTER TABLE ONLY public.projects ALTER COLUMN id SET DEFAULT nextval('public.projects_id_seq'::regclass);
+
+ALTER TABLE ONLY public.room_participants ALTER COLUMN id SET DEFAULT nextval('public.room_participants_id_seq'::regclass);
+
+ALTER TABLE ONLY public.rooms ALTER COLUMN id SET DEFAULT nextval('public.rooms_id_seq'::regclass);
+
+ALTER TABLE ONLY public.servers ALTER COLUMN id SET DEFAULT nextval('public.servers_id_seq'::regclass);
+
+ALTER TABLE ONLY public.users ALTER COLUMN id SET DEFAULT nextval('public.users_id_seq'::regclass);
+
+ALTER TABLE ONLY public.access_tokens
+ ADD CONSTRAINT access_tokens_pkey PRIMARY KEY (id);
+
+ALTER TABLE ONLY public.breakpoints
+ ADD CONSTRAINT breakpoints_pkey PRIMARY KEY (id);
+
+ALTER TABLE ONLY public.buffer_operations
+ ADD CONSTRAINT buffer_operations_pkey PRIMARY KEY (buffer_id, epoch, lamport_timestamp, replica_id);
+
+ALTER TABLE ONLY public.buffer_snapshots
+ ADD CONSTRAINT buffer_snapshots_pkey PRIMARY KEY (buffer_id, epoch);
+
+ALTER TABLE ONLY public.buffers
+ ADD CONSTRAINT buffers_pkey PRIMARY KEY (id);
+
+ALTER TABLE ONLY public.channel_buffer_collaborators
+ ADD CONSTRAINT channel_buffer_collaborators_pkey PRIMARY KEY (id);
+
+ALTER TABLE ONLY public.channel_chat_participants
+ ADD CONSTRAINT channel_chat_participants_pkey PRIMARY KEY (id);
+
+ALTER TABLE ONLY public.channel_members
+ ADD CONSTRAINT channel_members_pkey PRIMARY KEY (id);
+
+ALTER TABLE ONLY public.channels
+ ADD CONSTRAINT channels_pkey PRIMARY KEY (id);
+
+ALTER TABLE ONLY public.contacts
+ ADD CONSTRAINT contacts_pkey PRIMARY KEY (id);
+
+ALTER TABLE ONLY public.contributors
+ ADD CONSTRAINT contributors_pkey PRIMARY KEY (user_id);
+
+ALTER TABLE ONLY public.extension_versions
+ ADD CONSTRAINT extension_versions_pkey PRIMARY KEY (extension_id, version);
+
+ALTER TABLE ONLY public.extensions
+ ADD CONSTRAINT extensions_pkey PRIMARY KEY (id);
+
+ALTER TABLE ONLY public.feature_flags
+ ADD CONSTRAINT feature_flags_flag_key UNIQUE (flag);
+
+ALTER TABLE ONLY public.feature_flags
+ ADD CONSTRAINT feature_flags_pkey PRIMARY KEY (id);
+
+ALTER TABLE ONLY public.followers
+ ADD CONSTRAINT followers_pkey PRIMARY KEY (id);
+
+ALTER TABLE ONLY public.language_servers
+ ADD CONSTRAINT language_servers_pkey PRIMARY KEY (project_id, id);
+
+ALTER TABLE ONLY public.notification_kinds
+ ADD CONSTRAINT notification_kinds_pkey PRIMARY KEY (id);
+
+ALTER TABLE ONLY public.notifications
+ ADD CONSTRAINT notifications_pkey PRIMARY KEY (id);
+
+ALTER TABLE ONLY public.observed_buffer_edits
+ ADD CONSTRAINT observed_buffer_edits_pkey PRIMARY KEY (user_id, buffer_id);
+
+ALTER TABLE ONLY public.project_collaborators
+ ADD CONSTRAINT project_collaborators_pkey PRIMARY KEY (id);
+
+ALTER TABLE ONLY public.project_repositories
+ ADD CONSTRAINT project_repositories_pkey PRIMARY KEY (project_id, id);
+
+ALTER TABLE ONLY public.project_repository_statuses
+ ADD CONSTRAINT project_repository_statuses_pkey PRIMARY KEY (project_id, repository_id, repo_path);
+
+ALTER TABLE ONLY public.projects
+ ADD CONSTRAINT projects_pkey PRIMARY KEY (id);
+
+ALTER TABLE ONLY public.room_participants
+ ADD CONSTRAINT room_participants_pkey PRIMARY KEY (id);
+
+ALTER TABLE ONLY public.rooms
+ ADD CONSTRAINT rooms_pkey PRIMARY KEY (id);
+
+ALTER TABLE ONLY public.servers
+ ADD CONSTRAINT servers_pkey PRIMARY KEY (id);
+
+ALTER TABLE ONLY public.user_features
+ ADD CONSTRAINT user_features_pkey PRIMARY KEY (user_id, feature_id);
+
+ALTER TABLE ONLY public.users
+ ADD CONSTRAINT users_pkey PRIMARY KEY (id);
+
+ALTER TABLE ONLY public.worktree_diagnostic_summaries
+ ADD CONSTRAINT worktree_diagnostic_summaries_pkey PRIMARY KEY (project_id, worktree_id, path);
+
+ALTER TABLE ONLY public.worktree_entries
+ ADD CONSTRAINT worktree_entries_pkey PRIMARY KEY (project_id, worktree_id, id);
+
+ALTER TABLE ONLY public.worktree_settings_files
+ ADD CONSTRAINT worktree_settings_files_pkey PRIMARY KEY (project_id, worktree_id, path);
+
+ALTER TABLE ONLY public.worktrees
+ ADD CONSTRAINT worktrees_pkey PRIMARY KEY (project_id, id);
+
+CREATE INDEX index_access_tokens_user_id ON public.access_tokens USING btree (user_id);
+
+CREATE INDEX index_breakpoints_on_project_id ON public.breakpoints USING btree (project_id);
+
+CREATE INDEX index_buffers_on_channel_id ON public.buffers USING btree (channel_id);
+
+CREATE INDEX index_channel_buffer_collaborators_on_channel_id ON public.channel_buffer_collaborators USING btree (channel_id);
+
+CREATE UNIQUE INDEX index_channel_buffer_collaborators_on_channel_id_and_replica_id ON public.channel_buffer_collaborators USING btree (channel_id, replica_id);
+
+CREATE UNIQUE INDEX index_channel_buffer_collaborators_on_channel_id_connection_id_ ON public.channel_buffer_collaborators USING btree (channel_id, connection_id, connection_server_id);
+
+CREATE INDEX index_channel_buffer_collaborators_on_connection_id ON public.channel_buffer_collaborators USING btree (connection_id);
+
+CREATE INDEX index_channel_buffer_collaborators_on_connection_server_id ON public.channel_buffer_collaborators USING btree (connection_server_id);
+
+CREATE INDEX index_channel_chat_participants_on_channel_id ON public.channel_chat_participants USING btree (channel_id);
+
+CREATE UNIQUE INDEX index_channel_members_on_channel_id_and_user_id ON public.channel_members USING btree (channel_id, user_id);
+
+CREATE INDEX index_channels_on_parent_path ON public.channels USING btree (parent_path text_pattern_ops);
+
+CREATE INDEX index_channels_on_parent_path_and_order ON public.channels USING btree (parent_path, channel_order);
+
+CREATE INDEX index_contacts_user_id_b ON public.contacts USING btree (user_id_b);
+
+CREATE UNIQUE INDEX index_contacts_user_ids ON public.contacts USING btree (user_id_a, user_id_b);
+
+CREATE UNIQUE INDEX index_extensions_external_id ON public.extensions USING btree (external_id);
+
+CREATE INDEX index_extensions_total_download_count ON public.extensions USING btree (total_download_count);
+
+CREATE UNIQUE INDEX index_feature_flags ON public.feature_flags USING btree (id);
+
+CREATE UNIQUE INDEX index_followers_on_project_id_and_leader_connection_server_id_a ON public.followers USING btree (project_id, leader_connection_server_id, leader_connection_id, follower_connection_server_id, follower_connection_id);
+
+CREATE INDEX index_followers_on_room_id ON public.followers USING btree (room_id);
+
+CREATE UNIQUE INDEX index_invite_code_users ON public.users USING btree (invite_code);
+
+CREATE INDEX index_language_servers_on_project_id ON public.language_servers USING btree (project_id);
+
+CREATE UNIQUE INDEX index_notification_kinds_on_name ON public.notification_kinds USING btree (name);
+
+CREATE INDEX index_notifications_on_recipient_id_is_read_kind_entity_id ON public.notifications USING btree (recipient_id, is_read, kind, entity_id);
+
+CREATE UNIQUE INDEX index_observed_buffer_user_and_buffer_id ON public.observed_buffer_edits USING btree (user_id, buffer_id);
+
+CREATE INDEX index_project_collaborators_on_connection_id ON public.project_collaborators USING btree (connection_id);
+
+CREATE INDEX index_project_collaborators_on_connection_server_id ON public.project_collaborators USING btree (connection_server_id);
+
+CREATE INDEX index_project_collaborators_on_project_id ON public.project_collaborators USING btree (project_id);
+
+CREATE UNIQUE INDEX index_project_collaborators_on_project_id_and_replica_id ON public.project_collaborators USING btree (project_id, replica_id);
+
+CREATE UNIQUE INDEX index_project_collaborators_on_project_id_connection_id_and_ser ON public.project_collaborators USING btree (project_id, connection_id, connection_server_id);
+
+CREATE INDEX index_project_repos_statuses_on_project_id ON public.project_repository_statuses USING btree (project_id);
+
+CREATE INDEX index_project_repos_statuses_on_project_id_and_repo_id ON public.project_repository_statuses USING btree (project_id, repository_id);
+
+CREATE INDEX index_project_repositories_on_project_id ON public.project_repositories USING btree (project_id);
+
+CREATE INDEX index_projects_on_host_connection_id_and_host_connection_server ON public.projects USING btree (host_connection_id, host_connection_server_id);
+
+CREATE INDEX index_projects_on_host_connection_server_id ON public.projects USING btree (host_connection_server_id);
+
+CREATE INDEX index_room_participants_on_answering_connection_id ON public.room_participants USING btree (answering_connection_id);
+
+CREATE UNIQUE INDEX index_room_participants_on_answering_connection_id_and_answerin ON public.room_participants USING btree (answering_connection_id, answering_connection_server_id);
+
+CREATE INDEX index_room_participants_on_answering_connection_server_id ON public.room_participants USING btree (answering_connection_server_id);
+
+CREATE INDEX index_room_participants_on_calling_connection_server_id ON public.room_participants USING btree (calling_connection_server_id);
+
+CREATE INDEX index_room_participants_on_room_id ON public.room_participants USING btree (room_id);
+
+CREATE UNIQUE INDEX index_room_participants_on_user_id ON public.room_participants USING btree (user_id);
+
+CREATE UNIQUE INDEX index_rooms_on_channel_id ON public.rooms USING btree (channel_id);
+
+CREATE INDEX index_settings_files_on_project_id ON public.worktree_settings_files USING btree (project_id);
+
+CREATE INDEX index_settings_files_on_project_id_and_wt_id ON public.worktree_settings_files USING btree (project_id, worktree_id);
+
+CREATE INDEX index_user_features_on_feature_id ON public.user_features USING btree (feature_id);
+
+CREATE INDEX index_user_features_on_user_id ON public.user_features USING btree (user_id);
+
+CREATE UNIQUE INDEX index_user_features_user_id_and_feature_id ON public.user_features USING btree (user_id, feature_id);
+
+CREATE UNIQUE INDEX index_users_github_login ON public.users USING btree (github_login);
+
+CREATE INDEX index_users_on_email_address ON public.users USING btree (email_address);
+
+CREATE INDEX index_worktree_diagnostic_summaries_on_project_id ON public.worktree_diagnostic_summaries USING btree (project_id);
+
+CREATE INDEX index_worktree_diagnostic_summaries_on_project_id_and_worktree_ ON public.worktree_diagnostic_summaries USING btree (project_id, worktree_id);
+
+CREATE INDEX index_worktree_entries_on_project_id ON public.worktree_entries USING btree (project_id);
+
+CREATE INDEX index_worktree_entries_on_project_id_and_worktree_id ON public.worktree_entries USING btree (project_id, worktree_id);
+
+CREATE INDEX index_worktrees_on_project_id ON public.worktrees USING btree (project_id);
+
+CREATE INDEX trigram_index_extensions_name ON public.extensions USING gin (name public.gin_trgm_ops);
+
+CREATE INDEX trigram_index_users_on_github_login ON public.users USING gin (github_login public.gin_trgm_ops);
+
+CREATE UNIQUE INDEX uix_channels_parent_path_name ON public.channels USING btree (parent_path, name) WHERE ((parent_path IS NOT NULL) AND (parent_path <> ''::text));
+
+CREATE UNIQUE INDEX uix_users_on_github_user_id ON public.users USING btree (github_user_id);
+
+ALTER TABLE ONLY public.access_tokens
+ ADD CONSTRAINT access_tokens_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;
+
+ALTER TABLE ONLY public.breakpoints
+ ADD CONSTRAINT breakpoints_project_id_fkey FOREIGN KEY (project_id) REFERENCES public.projects(id) ON DELETE CASCADE;
+
+ALTER TABLE ONLY public.buffer_operations
+ ADD CONSTRAINT buffer_operations_buffer_id_fkey FOREIGN KEY (buffer_id) REFERENCES public.buffers(id) ON DELETE CASCADE;
+
+ALTER TABLE ONLY public.buffer_snapshots
+ ADD CONSTRAINT buffer_snapshots_buffer_id_fkey FOREIGN KEY (buffer_id) REFERENCES public.buffers(id) ON DELETE CASCADE;
+
+ALTER TABLE ONLY public.buffers
+ ADD CONSTRAINT buffers_channel_id_fkey FOREIGN KEY (channel_id) REFERENCES public.channels(id) ON DELETE CASCADE;
+
+ALTER TABLE ONLY public.channel_buffer_collaborators
+ ADD CONSTRAINT channel_buffer_collaborators_channel_id_fkey FOREIGN KEY (channel_id) REFERENCES public.channels(id) ON DELETE CASCADE;
+
+ALTER TABLE ONLY public.channel_buffer_collaborators
+ ADD CONSTRAINT channel_buffer_collaborators_connection_server_id_fkey FOREIGN KEY (connection_server_id) REFERENCES public.servers(id) ON DELETE CASCADE;
+
+ALTER TABLE ONLY public.channel_buffer_collaborators
+ ADD CONSTRAINT channel_buffer_collaborators_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;
+
+ALTER TABLE ONLY public.channel_chat_participants
+ ADD CONSTRAINT channel_chat_participants_channel_id_fkey FOREIGN KEY (channel_id) REFERENCES public.channels(id) ON DELETE CASCADE;
+
+ALTER TABLE ONLY public.channel_chat_participants
+ ADD CONSTRAINT channel_chat_participants_connection_server_id_fkey FOREIGN KEY (connection_server_id) REFERENCES public.servers(id) ON DELETE CASCADE;
+
+ALTER TABLE ONLY public.channel_chat_participants
+ ADD CONSTRAINT channel_chat_participants_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
+
+ALTER TABLE ONLY public.channel_members
+ ADD CONSTRAINT channel_members_channel_id_fkey FOREIGN KEY (channel_id) REFERENCES public.channels(id) ON DELETE CASCADE;
+
+ALTER TABLE ONLY public.channel_members
+ ADD CONSTRAINT channel_members_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;
+
+ALTER TABLE ONLY public.contacts
+ ADD CONSTRAINT contacts_user_id_a_fkey FOREIGN KEY (user_id_a) REFERENCES public.users(id) ON DELETE CASCADE;
+
+ALTER TABLE ONLY public.contacts
+ ADD CONSTRAINT contacts_user_id_b_fkey FOREIGN KEY (user_id_b) REFERENCES public.users(id) ON DELETE CASCADE;
+
+ALTER TABLE ONLY public.contributors
+ ADD CONSTRAINT contributors_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
+
+ALTER TABLE ONLY public.extension_versions
+ ADD CONSTRAINT extension_versions_extension_id_fkey FOREIGN KEY (extension_id) REFERENCES public.extensions(id);
+
+ALTER TABLE ONLY public.project_repositories
+ ADD CONSTRAINT fk_project_repositories_project_id FOREIGN KEY (project_id) REFERENCES public.projects(id) ON DELETE CASCADE;
+
+ALTER TABLE ONLY public.project_repository_statuses
+ ADD CONSTRAINT fk_project_repository_statuses_project_id FOREIGN KEY (project_id) REFERENCES public.projects(id) ON DELETE CASCADE;
+
+ALTER TABLE ONLY public.followers
+ ADD CONSTRAINT followers_follower_connection_server_id_fkey FOREIGN KEY (follower_connection_server_id) REFERENCES public.servers(id) ON DELETE CASCADE;
+
+ALTER TABLE ONLY public.followers
+ ADD CONSTRAINT followers_leader_connection_server_id_fkey FOREIGN KEY (leader_connection_server_id) REFERENCES public.servers(id) ON DELETE CASCADE;
+
+ALTER TABLE ONLY public.followers
+ ADD CONSTRAINT followers_project_id_fkey FOREIGN KEY (project_id) REFERENCES public.projects(id) ON DELETE CASCADE;
+
+ALTER TABLE ONLY public.followers
+ ADD CONSTRAINT followers_room_id_fkey FOREIGN KEY (room_id) REFERENCES public.rooms(id) ON DELETE CASCADE;
+
+ALTER TABLE ONLY public.language_servers
+ ADD CONSTRAINT language_servers_project_id_fkey FOREIGN KEY (project_id) REFERENCES public.projects(id) ON DELETE CASCADE;
+
+ALTER TABLE ONLY public.notifications
+ ADD CONSTRAINT notifications_kind_fkey FOREIGN KEY (kind) REFERENCES public.notification_kinds(id);
+
+ALTER TABLE ONLY public.notifications
+ ADD CONSTRAINT notifications_recipient_id_fkey FOREIGN KEY (recipient_id) REFERENCES public.users(id) ON DELETE CASCADE;
+
+ALTER TABLE ONLY public.observed_buffer_edits
+ ADD CONSTRAINT observed_buffer_edits_buffer_id_fkey FOREIGN KEY (buffer_id) REFERENCES public.buffers(id) ON DELETE CASCADE;
+
+ALTER TABLE ONLY public.observed_buffer_edits
+ ADD CONSTRAINT observed_buffer_edits_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;
+
+ALTER TABLE ONLY public.project_collaborators
+ ADD CONSTRAINT project_collaborators_connection_server_id_fkey FOREIGN KEY (connection_server_id) REFERENCES public.servers(id) ON DELETE CASCADE;
+
+ALTER TABLE ONLY public.project_collaborators
+ ADD CONSTRAINT project_collaborators_project_id_fkey FOREIGN KEY (project_id) REFERENCES public.projects(id) ON DELETE CASCADE;
+
+ALTER TABLE ONLY public.projects
+ ADD CONSTRAINT projects_host_connection_server_id_fkey FOREIGN KEY (host_connection_server_id) REFERENCES public.servers(id) ON DELETE CASCADE;
+
+ALTER TABLE ONLY public.projects
+ ADD CONSTRAINT projects_host_user_id_fkey FOREIGN KEY (host_user_id) REFERENCES public.users(id);
+
+ALTER TABLE ONLY public.projects
+ ADD CONSTRAINT projects_room_id_fkey FOREIGN KEY (room_id) REFERENCES public.rooms(id) ON DELETE CASCADE;
+
+ALTER TABLE ONLY public.room_participants
+ ADD CONSTRAINT room_participants_answering_connection_server_id_fkey FOREIGN KEY (answering_connection_server_id) REFERENCES public.servers(id) ON DELETE CASCADE;
+
+ALTER TABLE ONLY public.room_participants
+ ADD CONSTRAINT room_participants_calling_connection_server_id_fkey FOREIGN KEY (calling_connection_server_id) REFERENCES public.servers(id) ON DELETE SET NULL;
+
+ALTER TABLE ONLY public.room_participants
+ ADD CONSTRAINT room_participants_calling_user_id_fkey FOREIGN KEY (calling_user_id) REFERENCES public.users(id);
+
+ALTER TABLE ONLY public.room_participants
+ ADD CONSTRAINT room_participants_room_id_fkey FOREIGN KEY (room_id) REFERENCES public.rooms(id);
+
+ALTER TABLE ONLY public.room_participants
+ ADD CONSTRAINT room_participants_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id);
+
+ALTER TABLE ONLY public.rooms
+ ADD CONSTRAINT rooms_channel_id_fkey FOREIGN KEY (channel_id) REFERENCES public.channels(id) ON DELETE CASCADE;
+
+ALTER TABLE ONLY public.user_features
+ ADD CONSTRAINT user_features_feature_id_fkey FOREIGN KEY (feature_id) REFERENCES public.feature_flags(id) ON DELETE CASCADE;
+
+ALTER TABLE ONLY public.user_features
+ ADD CONSTRAINT user_features_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;
+
+ALTER TABLE ONLY public.users
+ ADD CONSTRAINT users_inviter_id_fkey FOREIGN KEY (inviter_id) REFERENCES public.users(id) ON DELETE SET NULL;
+
+ALTER TABLE ONLY public.worktree_diagnostic_summaries
+ ADD CONSTRAINT worktree_diagnostic_summaries_project_id_worktree_id_fkey FOREIGN KEY (project_id, worktree_id) REFERENCES public.worktrees(project_id, id) ON DELETE CASCADE;
+
+ALTER TABLE ONLY public.worktree_entries
+ ADD CONSTRAINT worktree_entries_project_id_worktree_id_fkey FOREIGN KEY (project_id, worktree_id) REFERENCES public.worktrees(project_id, id) ON DELETE CASCADE;
+
+ALTER TABLE ONLY public.worktree_settings_files
+ ADD CONSTRAINT worktree_settings_files_project_id_worktree_id_fkey FOREIGN KEY (project_id, worktree_id) REFERENCES public.worktrees(project_id, id) ON DELETE CASCADE;
+
+ALTER TABLE ONLY public.worktrees
+ ADD CONSTRAINT worktrees_project_id_fkey FOREIGN KEY (project_id) REFERENCES public.projects(id) ON DELETE CASCADE;
@@ -1,19 +0,0 @@
-create table if not exists providers (
- id serial primary key,
- name text not null
-);
-
-create unique index uix_providers_on_name on providers (name);
-
-create table if not exists models (
- id serial primary key,
- provider_id integer not null references providers (id) on delete cascade,
- name text not null,
- max_requests_per_minute integer not null,
- max_tokens_per_minute integer not null,
- max_tokens_per_day integer not null
-);
-
-create unique index uix_models_on_provider_id_name on models (provider_id, name);
-create index ix_models_on_provider_id on models (provider_id);
-create index ix_models_on_name on models (name);
@@ -1,19 +0,0 @@
-create table usage_measures (
- id serial primary key,
- name text not null
-);
-
-create unique index uix_usage_measures_on_name on usage_measures (name);
-
-create table if not exists usages (
- id serial primary key,
- user_id integer not null,
- model_id integer not null references models (id) on delete cascade,
- measure_id integer not null references usage_measures (id) on delete cascade,
- timestamp timestamp without time zone not null,
- buckets bigint[] not null
-);
-
-create index ix_usages_on_user_id on usages (user_id);
-create index ix_usages_on_model_id on usages (model_id);
-create unique index uix_usages_on_user_id_model_id_measure_id on usages (user_id, model_id, measure_id);
@@ -1,4 +0,0 @@
-ALTER TABLE models
- ALTER COLUMN max_requests_per_minute TYPE bigint,
- ALTER COLUMN max_tokens_per_minute TYPE bigint,
- ALTER COLUMN max_tokens_per_day TYPE bigint;
@@ -1,3 +0,0 @@
-ALTER TABLE models
- ADD COLUMN price_per_million_input_tokens integer NOT NULL DEFAULT 0,
- ADD COLUMN price_per_million_output_tokens integer NOT NULL DEFAULT 0;
@@ -1 +0,0 @@
-alter table usages add column is_staff boolean not null default false;
@@ -1,9 +0,0 @@
-create table lifetime_usages (
- id serial primary key,
- user_id integer not null,
- model_id integer not null references models (id) on delete cascade,
- input_tokens bigint not null default 0,
- output_tokens bigint not null default 0
-);
-
-create unique index uix_lifetime_usages_on_user_id_model_id on lifetime_usages (user_id, model_id);
@@ -1,7 +0,0 @@
-create table revoked_access_tokens (
- id serial primary key,
- jti text not null,
- revoked_at timestamp without time zone not null default now()
-);
-
-create unique index uix_revoked_access_tokens_on_jti on revoked_access_tokens (jti);
@@ -1,11 +0,0 @@
-alter table models
- add column price_per_million_cache_creation_input_tokens integer not null default 0,
- add column price_per_million_cache_read_input_tokens integer not null default 0;
-
-alter table usages
- add column cache_creation_input_tokens_this_month bigint not null default 0,
- add column cache_read_input_tokens_this_month bigint not null default 0;
-
-alter table lifetime_usages
- add column cache_creation_input_tokens bigint not null default 0,
- add column cache_read_input_tokens bigint not null default 0;
@@ -1,3 +0,0 @@
-alter table usages
- drop column cache_creation_input_tokens_this_month,
- drop column cache_read_input_tokens_this_month;
@@ -1,13 +0,0 @@
-create table monthly_usages (
- id serial primary key,
- user_id integer not null,
- model_id integer not null references models (id) on delete cascade,
- month integer not null,
- year integer not null,
- input_tokens bigint not null default 0,
- cache_creation_input_tokens bigint not null default 0,
- cache_read_input_tokens bigint not null default 0,
- output_tokens bigint not null default 0
-);
-
-create unique index uix_monthly_usages_on_user_id_model_id_month_year on monthly_usages (user_id, model_id, month, year);
@@ -1,12 +0,0 @@
-create table billing_events (
- id serial primary key,
- idempotency_key uuid not null default gen_random_uuid(),
- user_id integer not null,
- model_id integer not null references models (id) on delete cascade,
- input_tokens bigint not null default 0,
- input_cache_creation_tokens bigint not null default 0,
- input_cache_read_tokens bigint not null default 0,
- output_tokens bigint not null default 0
-);
-
-create index uix_billing_events_on_user_id_model_id on billing_events (user_id, model_id);
@@ -1,3 +0,0 @@
-alter table models
- add column max_input_tokens_per_minute bigint not null default 0,
- add column max_output_tokens_per_minute bigint not null default 0;
@@ -1,10 +0,0 @@
-create table subscription_usages (
- id serial primary key,
- user_id integer not null,
- period_start_at timestamp without time zone not null,
- period_end_at timestamp without time zone not null,
- model_requests int not null default 0,
- edit_predictions int not null default 0
-);
-
-create unique index uix_subscription_usages_on_user_id_start_at_end_at on subscription_usages (user_id, period_start_at, period_end_at);
@@ -1,4 +0,0 @@
-alter table subscription_usages
- add column plan text not null;
-
-create index ix_subscription_usages_on_plan on subscription_usages (plan);
@@ -1,8 +0,0 @@
-create table subscription_usage_meters (
- id serial primary key,
- subscription_usage_id integer not null references subscription_usages (id) on delete cascade,
- model_id integer not null references models (id) on delete cascade,
- requests integer not null default 0
-);
-
-create unique index uix_subscription_usage_meters_on_subscription_usage_model on subscription_usage_meters (subscription_usage_id, model_id);
@@ -1,6 +0,0 @@
-alter table subscription_usage_meters
- add column mode text not null default 'normal';
-
-drop index uix_subscription_usage_meters_on_subscription_usage_model;
-
-create unique index uix_subscription_usage_meters_on_subscription_usage_model_mode on subscription_usage_meters (subscription_usage_id, model_id, mode);
@@ -1,23 +0,0 @@
-create table subscription_usages_v2 (
- id uuid primary key,
- user_id integer not null,
- period_start_at timestamp without time zone not null,
- period_end_at timestamp without time zone not null,
- plan text not null,
- model_requests int not null default 0,
- edit_predictions int not null default 0
-);
-
-create unique index uix_subscription_usages_v2_on_user_id_start_at_end_at on subscription_usages_v2 (user_id, period_start_at, period_end_at);
-
-create index ix_subscription_usages_v2_on_plan on subscription_usages_v2 (plan);
-
-create table subscription_usage_meters_v2 (
- id uuid primary key,
- subscription_usage_id uuid not null references subscription_usages_v2 (id) on delete cascade,
- model_id integer not null references models (id) on delete cascade,
- mode text not null,
- requests integer not null default 0
-);
-
-create unique index uix_subscription_usage_meters_v2_on_usage_model_mode on subscription_usage_meters_v2 (subscription_usage_id, model_id, mode);
@@ -1,2 +0,0 @@
-drop table subscription_usage_meters;
-drop table subscription_usages;
@@ -1,2 +0,0 @@
-drop table monthly_usages;
-drop table lifetime_usages;
@@ -1 +0,0 @@
-drop table billing_events;
@@ -11,16 +11,12 @@ extend-exclude = [
"crates/theme/src/icon_theme.rs",
"crates/extensions_ui/src/extension_suggest.rs",
- # Some countries codes are flagged as typos.
- "crates/anthropic/src/supported_countries.rs",
- "crates/google_ai/src/supported_countries.rs",
- "crates/open_ai/src/supported_countries.rs",
-
# Some mock data is flagged as typos.
"crates/assistant_tools/src/web_search_tool.rs",
- # Stripe IDs are flagged as typos.
- "crates/collab/src/db/tests/processed_stripe_event_tests.rs",
+ # Suppress false positives in database schema.
+ "crates/collab/migrations/20251208000000_test_schema.sql",
+
# Not our typos.
"crates/livekit_api/",
# Vim makes heavy use of partial typing tables.
@@ -63,8 +59,6 @@ extend-ignore-re = [
'cl\[ist]',
'\[lan\]guage',
'"ba"',
- # :/ crates/collab/migrations/20231009181554_add_release_channel_to_rooms.sql
- "COLUMN enviroment",
"doas",
# ProtoLS crate with tree-sitter Protobuf grammar.
"protols",