mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-08 07:35:01 +03:00
e1ae0d46da
This PR adds a REST API to the collab server for searching and downloading extensions. Previously, we had implemented this API in zed.dev directly, but this implementation is better, because we use the collab database to store the download counts for extensions. Release Notes: - N/A --------- Co-authored-by: Marshall Bowers <elliott.codes@gmail.com> Co-authored-by: Marshall <marshall@zed.dev> Co-authored-by: Conrad <conrad@zed.dev>
23 lines
836 B
SQL
23 lines
836 B
SQL
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");
|