Skip to content

Instantly share code, notes, and snippets.

View jamwt's full-sized avatar

Jamie Turner jamwt

View GitHub Profile
jobs: defineTable({
order: v.incremental(),
}).index("by_order", ["order"]),
export const processJobs = mutation({
args: {
cursor: v.incremental(),
},
const deletionWorkpool = workpool(retry by default, retry 10+ times, concurrency = 10)
// Called by the user, public & fast. You can retain the workpool
// job id if you want to be able to indicate
// if the deletion is done yet.
deleteAll -> mutation {
deletionWorkpool.enqueueAction(internal.deleteAllUserMessages, {user})
}
// Drive many small transactions clearing batches while some exist.
---
description: Guidelines for performing data migrations on convex
globs: convex/**
alwaysApply: false
---
Data migrations are really easy on Convex.
# Adding a new field
Here's the general flow for adding a new field. Let's say we have a messages table
```ts
// convex/schema.ts
#![feature(test)]
extern crate rayon;
extern crate test;
#[cfg(test)]
mod tests {
use test::Bencher;
use rayon::prelude::*;
#[bench]
BUGCHECK_STR: STATUS_ILLEGAL_INSTRUCTION
DEFAULT_BUCKET_ID: STATUS_ILLEGAL_INSTRUCTION
LAST_CONTROL_TRANSFER: from 730e1068 to 73127b68
STACK_TEXT:
0014f084 730e1068 0000004c 0014f0c4 774138e7 dropbox_watchdog!std::sys::imp::ext::ffi::{{impl}}::from_wide+0xf8
0014f9bc 002c10ae 00000000 00162307 00000006 dropbox_watchdog!spawn_monitoring_process+0x68
WARNING: Stack unwind information not available. Following frames may be wrong.
diff --git a/rust/Cargo.toml b/rust/Cargo.toml
index b24d5cf..c715446 100644
--- a/rust/Cargo.toml
+++ b/rust/Cargo.toml
@@ -6,4 +6,6 @@ authors = [ "David Shoemaker <[email protected]>" ]
[dependencies]
image = "*"
+itertools = "*"
+rayon = "*"
Before
0.80user 0.00system 0:00.81elapsed 99%CPU
After
1.62user 0.02system 0:00.26elapsed 624%CPU
[root]
name = "test_repo"
version = "0.1.0"
dependencies = [
"slog 1.0.0-alpha3 (registry+https://github.com/rust-lang/crates.io-index)",
"slog-atomic 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "crossbeam"
jamwt@dash:~/contrib/repro/test_repo$ cargo build
Unpacking slog v1.0.0-alpha3 (registry file:///home/jamwt/contrib/repro/test_repo/../registry)
Compiling slog v1.0.0-alpha3
Compiling test_repo v0.1.0 (file:///home/jamwt/contrib/repro/test_repo)
Finished debug [unoptimized + debuginfo] target(s) in 2.28 secs
jamwt@dash:~/contrib/repro/test_repo$ vi Cargo.toml
jamwt@dash:~/contrib/repro/test_repo$ cargo build
error: no matching package named `slog` found (required by `slog-atomic`)
location searched: registry https://github.com/rust-lang/crates.io-index
version required: *
jamwt@dash:~/devel/client/rust/registry$ cat index/sl/og/slog | json_pp
{
"features" : {
"release_max_level_off" : [],
"max_level_trace" : [],
"release_max_level_trace" : [],
"max_level_warn" : [],
"max_level_debug" : [],
"release_max_level_warn" : [],
"max_level_off" : [],