Whoops (#4011)
Fixes a spelling mistake I made in the database schema 😬
Release Notes:
- n/a
This commit is contained in:
commit
e3c9c602f9
6 changed files with 13 additions and 12 deletions
|
@ -37,7 +37,7 @@ CREATE INDEX "index_contacts_user_id_b" ON "contacts" ("user_id_b");
|
||||||
CREATE TABLE "rooms" (
|
CREATE TABLE "rooms" (
|
||||||
"id" INTEGER PRIMARY KEY AUTOINCREMENT,
|
"id" INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
"live_kit_room" VARCHAR NOT NULL,
|
"live_kit_room" VARCHAR NOT NULL,
|
||||||
"enviroment" VARCHAR,
|
"environment" VARCHAR,
|
||||||
"channel_id" INTEGER REFERENCES channels (id) ON DELETE CASCADE
|
"channel_id" INTEGER REFERENCES channels (id) ON DELETE CASCADE
|
||||||
);
|
);
|
||||||
CREATE UNIQUE INDEX "index_rooms_on_channel_id" ON "rooms" ("channel_id");
|
CREATE UNIQUE INDEX "index_rooms_on_channel_id" ON "rooms" ("channel_id");
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
ALTER TABLE rooms ADD COLUMN environment TEXT;
|
|
@ -1180,7 +1180,7 @@ impl Database {
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
let room_id = if let Some(room) = room {
|
let room_id = if let Some(room) = room {
|
||||||
if let Some(env) = room.enviroment {
|
if let Some(env) = room.environment {
|
||||||
if &env != environment {
|
if &env != environment {
|
||||||
Err(anyhow!("must join using the {} release", env))?;
|
Err(anyhow!("must join using the {} release", env))?;
|
||||||
}
|
}
|
||||||
|
@ -1190,7 +1190,7 @@ impl Database {
|
||||||
let result = room::Entity::insert(room::ActiveModel {
|
let result = room::Entity::insert(room::ActiveModel {
|
||||||
channel_id: ActiveValue::Set(Some(channel_id)),
|
channel_id: ActiveValue::Set(Some(channel_id)),
|
||||||
live_kit_room: ActiveValue::Set(live_kit_room.to_string()),
|
live_kit_room: ActiveValue::Set(live_kit_room.to_string()),
|
||||||
enviroment: ActiveValue::Set(Some(environment.to_string())),
|
environment: ActiveValue::Set(Some(environment.to_string())),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
})
|
})
|
||||||
.exec(&*tx)
|
.exec(&*tx)
|
||||||
|
|
|
@ -112,7 +112,7 @@ impl Database {
|
||||||
self.transaction(|tx| async move {
|
self.transaction(|tx| async move {
|
||||||
let room = room::ActiveModel {
|
let room = room::ActiveModel {
|
||||||
live_kit_room: ActiveValue::set(live_kit_room.into()),
|
live_kit_room: ActiveValue::set(live_kit_room.into()),
|
||||||
enviroment: ActiveValue::set(Some(release_channel.to_string())),
|
environment: ActiveValue::set(Some(release_channel.to_string())),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
}
|
}
|
||||||
.insert(&*tx)
|
.insert(&*tx)
|
||||||
|
@ -299,28 +299,28 @@ impl Database {
|
||||||
room_id: RoomId,
|
room_id: RoomId,
|
||||||
user_id: UserId,
|
user_id: UserId,
|
||||||
connection: ConnectionId,
|
connection: ConnectionId,
|
||||||
enviroment: &str,
|
environment: &str,
|
||||||
) -> Result<RoomGuard<JoinRoom>> {
|
) -> Result<RoomGuard<JoinRoom>> {
|
||||||
self.room_transaction(room_id, |tx| async move {
|
self.room_transaction(room_id, |tx| async move {
|
||||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
|
||||||
enum QueryChannelIdAndEnviroment {
|
enum QueryChannelIdAndEnvironment {
|
||||||
ChannelId,
|
ChannelId,
|
||||||
Enviroment,
|
Environment,
|
||||||
}
|
}
|
||||||
|
|
||||||
let (channel_id, release_channel): (Option<ChannelId>, Option<String>) =
|
let (channel_id, release_channel): (Option<ChannelId>, Option<String>) =
|
||||||
room::Entity::find()
|
room::Entity::find()
|
||||||
.select_only()
|
.select_only()
|
||||||
.column(room::Column::ChannelId)
|
.column(room::Column::ChannelId)
|
||||||
.column(room::Column::Enviroment)
|
.column(room::Column::Environment)
|
||||||
.filter(room::Column::Id.eq(room_id))
|
.filter(room::Column::Id.eq(room_id))
|
||||||
.into_values::<_, QueryChannelIdAndEnviroment>()
|
.into_values::<_, QueryChannelIdAndEnvironment>()
|
||||||
.one(&*tx)
|
.one(&*tx)
|
||||||
.await?
|
.await?
|
||||||
.ok_or_else(|| anyhow!("no such room"))?;
|
.ok_or_else(|| anyhow!("no such room"))?;
|
||||||
|
|
||||||
if let Some(release_channel) = release_channel {
|
if let Some(release_channel) = release_channel {
|
||||||
if &release_channel != enviroment {
|
if &release_channel != environment {
|
||||||
Err(anyhow!("must join using the {} release", release_channel))?;
|
Err(anyhow!("must join using the {} release", release_channel))?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ pub struct Model {
|
||||||
pub id: RoomId,
|
pub id: RoomId,
|
||||||
pub live_kit_room: String,
|
pub live_kit_room: String,
|
||||||
pub channel_id: Option<ChannelId>,
|
pub channel_id: Option<ChannelId>,
|
||||||
pub enviroment: Option<String>,
|
pub environment: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||||
|
|
|
@ -56,7 +56,7 @@ We use Vercel for all of our web deployments and some backend things. If you sig
|
||||||
|
|
||||||
### Environment Variables
|
### Environment Variables
|
||||||
|
|
||||||
You can get access to many of our shared enviroment variables through 1Password and Vercel. For 1Password search the value you are looking for, or sort by passwords or API credentials.
|
You can get access to many of our shared environment variables through 1Password and Vercel. For 1Password search the value you are looking for, or sort by passwords or API credentials.
|
||||||
|
|
||||||
For Vercel, go to `settings` -> `Environment Variables` (either on the entire org, or on a specific project depending on where it is shared.) For a given Vercel project if you have their CLI installed you can use `vercel pull` or `vercel env` to pull values down directly. More on those in their [CLI docs](https://vercel.com/docs/cli/env).
|
For Vercel, go to `settings` -> `Environment Variables` (either on the entire org, or on a specific project depending on where it is shared.) For a given Vercel project if you have their CLI installed you can use `vercel pull` or `vercel env` to pull values down directly. More on those in their [CLI docs](https://vercel.com/docs/cli/env).
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue