Skip to content

Commit bf58529

Browse files
ldanilekConvex, Inc.
authored andcommitted
stop using _modules.by_deleted (#25075)
the `deleted` field is always false. but we can't delete it yet because we're still accessing the table with the `by_deleted` index. remove all usages of `by_deleted` index. GitOrigin-RevId: 76c9957c94886a61aa7f83974524142e5a12d105
1 parent a187697 commit bf58529

File tree

3 files changed

+4
-17
lines changed

3 files changed

+4
-17
lines changed

crates/model/src/modules/mod.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ use common::{
1313
BinaryKey,
1414
Interval,
1515
},
16-
maybe_val,
1716
query::{
1817
IndexRange,
1918
IndexRangeExpression,
@@ -166,15 +165,7 @@ impl<'a, RT: Runtime> ModuleModel<'a, RT> {
166165
pub async fn get_all_metadata(
167166
&mut self,
168167
) -> anyhow::Result<Vec<ParsedDocument<ModuleMetadata>>> {
169-
let index_range = IndexRange {
170-
index_name: MODULE_INDEX_BY_DELETED.clone(),
171-
range: vec![IndexRangeExpression::Eq(
172-
DELETED_FIELD.clone(),
173-
maybe_val!(false),
174-
)],
175-
order: Order::Asc,
176-
};
177-
let index_query = Query::index_range(index_range);
168+
let index_query = Query::full_table_scan(MODULES_TABLE.clone(), Order::Asc);
178169
let mut query_stream = ResolvedQuery::new(self.tx, index_query)?;
179170

180171
let mut modules = Vec::new();

npm-packages/system-udfs/convex/_system/frontend/modules.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const getSourceCode = queryPrivateSystem({
1313
handler: async ({ db }, { path }): Promise<string | null> => {
1414
const module = await db
1515
.query("_modules")
16-
.withIndex("by_deleted", (q) => q.eq("deleted", false).eq("path", path))
16+
.withIndex("by_path", (q) => q.eq("path", path))
1717
.unique();
1818
if (!module) {
1919
return null;
@@ -53,9 +53,7 @@ export const list = queryPrivateSystem({
5353
args: {},
5454
handler: async ({ db }): Promise<[string, Module][]> => {
5555
const result: [string, Module][] = [];
56-
for await (const module of db
57-
.query("_modules")
58-
.withIndex("by_deleted", (q) => q.eq("deleted", false))) {
56+
for await (const module of db.query("_modules")) {
5957
if (module.path.startsWith("_")) {
6058
continue;
6159
}

npm-packages/system-udfs/convex/schema.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,9 +275,7 @@ export default defineSchema({
275275
path: v.string(),
276276
latestVersion: v.int64(),
277277
deleted: v.boolean(),
278-
})
279-
.index("by_path", ["path"])
280-
.index("by_deleted", ["deleted", "path"]),
278+
}).index("by_path", ["path"]),
281279
_module_versions: defineTable({
282280
module_id: v.id("_modules"),
283281
source: v.string(),

0 commit comments

Comments
 (0)