Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3b4899f785 |
Generated
+1
-1
@@ -61,7 +61,7 @@ checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "amnezia-fellow"
|
name = "amnezia-fellow"
|
||||||
version = "0.1.5"
|
version = "0.1.6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"base64 0.22.1",
|
"base64 0.22.1",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "amnezia-fellow"
|
name = "amnezia-fellow"
|
||||||
version = "0.1.6"
|
version = "0.1.7"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
description = "Amnezia VPN client manager with SSO, SQLite/PostgreSQL, and Kubernetes Secret sync"
|
description = "Amnezia VPN client manager with SSO, SQLite/PostgreSQL, and Kubernetes Secret sync"
|
||||||
|
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ async fn copy_app_data(source_db: &Database, target_db: &Database) -> cot::Resul
|
|||||||
|
|
||||||
async fn reset_postgres_sequences(db: &Database) -> cot::Result<()> {
|
async fn reset_postgres_sequences(db: &Database) -> cot::Result<()> {
|
||||||
for table in [
|
for table in [
|
||||||
"cot_session__session",
|
"cot__session",
|
||||||
"amnezia_fellow__user",
|
"amnezia_fellow__user",
|
||||||
"amnezia_fellow__oidc_link",
|
"amnezia_fellow__oidc_link",
|
||||||
"amnezia_fellow__vpn_client",
|
"amnezia_fellow__vpn_client",
|
||||||
|
|||||||
+51
-1
@@ -1031,7 +1031,57 @@ pub mod db_migrations {
|
|||||||
&[Operation::custom(create_vpn_client_indexes).build()];
|
&[Operation::custom(create_vpn_client_indexes).build()];
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const MIGRATIONS: &[&SyncDynMigration] = &[&M0005CreateVpnClient, &M0006VpnClientIndexes];
|
#[cot::db::migrations::migration_op]
|
||||||
|
async fn normalize_bigint_ids(ctx: migrations::MigrationContext<'_>) -> cot::db::Result<()> {
|
||||||
|
if ctx
|
||||||
|
.db
|
||||||
|
.raw("SELECT current_setting('server_version_num')")
|
||||||
|
.await
|
||||||
|
.is_err()
|
||||||
|
{
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
|
for sql in [
|
||||||
|
"ALTER TABLE amnezia_fellow__user ALTER COLUMN id TYPE BIGINT",
|
||||||
|
"ALTER TABLE amnezia_fellow__user \
|
||||||
|
ALTER COLUMN telegram_link_code_created_at TYPE BIGINT",
|
||||||
|
"ALTER TABLE amnezia_fellow__oidc_link ALTER COLUMN id TYPE BIGINT",
|
||||||
|
"ALTER TABLE amnezia_fellow__oidc_link ALTER COLUMN user_id TYPE BIGINT",
|
||||||
|
"ALTER TABLE amnezia_fellow__vpn_client ALTER COLUMN id TYPE BIGINT",
|
||||||
|
"ALTER TABLE amnezia_fellow__vpn_client ALTER COLUMN owner_user_id TYPE BIGINT",
|
||||||
|
] {
|
||||||
|
ctx.db.raw(sql).await?;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Copy, Clone)]
|
||||||
|
pub struct M0009NormalizeBigintIds;
|
||||||
|
|
||||||
|
impl migrations::Migration for M0009NormalizeBigintIds {
|
||||||
|
const APP_NAME: &'static str = "amnezia_fellow";
|
||||||
|
const MIGRATION_NAME: &'static str = "m_0009_normalize_bigint_ids";
|
||||||
|
const DEPENDENCIES: &'static [migrations::MigrationDependency] = &[
|
||||||
|
migrations::MigrationDependency::migration(
|
||||||
|
"amnezia_fellow",
|
||||||
|
"m_0006_vpn_client_indexes",
|
||||||
|
),
|
||||||
|
migrations::MigrationDependency::migration(
|
||||||
|
"amnezia_fellow",
|
||||||
|
"m_0008_user_telegram_link_code",
|
||||||
|
),
|
||||||
|
];
|
||||||
|
const OPERATIONS: &'static [Operation] =
|
||||||
|
&[Operation::custom(normalize_bigint_ids).build()];
|
||||||
|
}
|
||||||
|
|
||||||
|
pub const MIGRATIONS: &[&SyncDynMigration] = &[
|
||||||
|
&M0005CreateVpnClient,
|
||||||
|
&M0006VpnClientIndexes,
|
||||||
|
&M0009NormalizeBigintIds,
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|||||||
Reference in New Issue
Block a user