♻️ refactor: migrate note

This commit is contained in:
Dominic Harris 2022-04-05 08:35:21 -04:00
parent fab8762c1e
commit 622c93cab4
No known key found for this signature in database
GPG Key ID: 93CCF85F3E2A4F65
1 changed files with 9 additions and 0 deletions

View File

@ -32,6 +32,15 @@ pub struct AppState {
pub async fn migrations(pool: &PgPool) -> Result<(), sqlx::Error> {
let migrator = Migrator::new(Path::new("./migrations")).await?;
/*
To move database over to SQLx managed migrations do the following:
1. Run `ALTER TABLE pastes RENAME TO old_pastes` in PSQL
2. Start the backend to create the new managed tables
3. Run `INSERT INTO pastes SELECT * from old_pastes;` and `DROP TABLE old_pastes;` in PSQL
*/
// TODO: This is a hacky solution but it works for now
// it doesnt work lol
// if let Err(e) = migrator.run(pool).await {