add more migration info at start

This commit is contained in:
Ruben Fiszel
2023-10-30 15:17:32 +01:00
parent 76a736aee6
commit cd01734735
4 changed files with 44 additions and 1 deletions
@@ -0,0 +1,20 @@
{
"db_name": "PostgreSQL",
"query": "select version from _sqlx_migrations order by version desc limit 1;",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "version",
"type_info": "Int8"
}
],
"parameters": {
"Left": []
},
"nullable": [
false
]
},
"hash": "f8696ade96d00b7e6660c44d7443c17feccb538ea39eca9db7d8f36dfd61aec6"
}
+22
View File
@@ -198,9 +198,31 @@ async fn main() -> anyhow::Result<()> {
None
};
let last_mig_version =
sqlx::query_scalar!("select version from _sqlx_migrations order by version desc limit 1;")
.fetch_optional(&db)
.await
.ok()
.flatten();
tracing::info!(
"Last migration version: {last_mig_version:?}. Starting potential migration of the db if first connection on a new windmill version (can take a while depending on the migration) ...",
);
// migration code to avoid break
windmill_api::migrate_db(&db).await?;
let last_mig_version =
sqlx::query_scalar!("select version from _sqlx_migrations order by version desc limit 1;")
.fetch_optional(&db)
.await
.ok()
.flatten();
tracing::info!(
"Completed potential migration of the db. Last migration version: {last_mig_version:?}",
);
let (tx, rx) = tokio::sync::broadcast::channel::<()>(3);
let shutdown_signal = windmill_common::shutdown_signal(tx.clone(), rx.resubscribe());
+1
View File
@@ -328,6 +328,7 @@ async fn ee_license() -> String {
async fn openapi() -> &'static str {
include_str!("../openapi-deref.yaml")
}
pub async fn migrate_db(db: &DB) -> anyhow::Result<()> {
db::migrate(db).await?;
Ok(())
@@ -178,7 +178,7 @@
code={JSON.stringify($flowStore, null, 4)}
lang="json"
on:change={(e) => {
const code = e.detail
const code = e.detail.code
try {
$flowStore = JSON.parse(code)
} catch (e) {