oauth2
This commit is contained in:
@@ -30,6 +30,7 @@ mod m20260616_160000_add_parent_to_categories;
|
||||
mod m20260617_000001_add_carrier_to_shipping_methods;
|
||||
mod m20260617_000002_add_shipment_to_orders;
|
||||
mod m20260617_000003_add_phone_to_orders;
|
||||
mod m20260618_000001_o_auth2_sessions;
|
||||
pub struct Migrator;
|
||||
|
||||
#[async_trait::async_trait]
|
||||
@@ -64,6 +65,7 @@ impl MigratorTrait for Migrator {
|
||||
Box::new(m20260617_000001_add_carrier_to_shipping_methods::Migration),
|
||||
Box::new(m20260617_000002_add_shipment_to_orders::Migration),
|
||||
Box::new(m20260617_000003_add_phone_to_orders::Migration),
|
||||
Box::new(m20260618_000001_o_auth2_sessions::Migration),
|
||||
// inject-above (do not remove this comment)
|
||||
]
|
||||
}
|
||||
|
||||
29
migration/src/m20260618_000001_o_auth2_sessions.rs
Normal file
29
migration/src/m20260618_000001_o_auth2_sessions.rs
Normal file
@@ -0,0 +1,29 @@
|
||||
use loco_rs::schema::*;
|
||||
use sea_orm_migration::prelude::*;
|
||||
|
||||
#[derive(DeriveMigrationName)]
|
||||
pub struct Migration;
|
||||
|
||||
#[async_trait::async_trait]
|
||||
impl MigrationTrait for Migration {
|
||||
async fn up(&self, m: &SchemaManager) -> Result<(), DbErr> {
|
||||
// OAuth2 session store used by loco-oauth2 to correlate the provider's
|
||||
// access token with a local user during the callback flow. `user` adds
|
||||
// a user_id FK to the users table.
|
||||
create_table(
|
||||
m,
|
||||
"o_auth2_sessions",
|
||||
&[
|
||||
("id", ColType::PkAuto),
|
||||
("session_id", ColType::StringUniq),
|
||||
("expires_at", ColType::TimestampWithTimeZone),
|
||||
],
|
||||
&[("user", "")],
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
async fn down(&self, m: &SchemaManager) -> Result<(), DbErr> {
|
||||
drop_table(m, "o_auth2_sessions").await
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user