-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: changes to queries and debugging select errors
- Loading branch information
1 parent
1a72615
commit ec4e774
Showing
11 changed files
with
52 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
src/app/db/models/user.gleam | ||
src/app/db/connection.gleam | ||
src/app/controllers/sessions.gleam |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,21 @@ | ||
import app/db/connection | ||
import app/lib/logger | ||
import feather | ||
import feather/migrate as migrator | ||
|
||
pub fn migrate_to_latest() { | ||
logger.info("Fetching migrations...") | ||
|
||
let assert Ok(migrations) = migrator.get_migrations("src/app/db/migrations") | ||
|
||
logger.info("Acquiring connection...") | ||
|
||
let assert Ok(connection) = | ||
feather.connect( | ||
feather.Config(..feather.default_config(), file: connection.get_db_path()), | ||
) | ||
|
||
logger.info("Running migrations...") | ||
|
||
migrator.migrate(migrations, connection) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import gleam/string | ||
|
||
/// This defeats the whole purpose of error handling in gleam | ||
/// but it somewhat helps with collecting all errors and then debugging | ||
pub type GenericError { | ||
GenericError(message: String) | ||
} | ||
|
||
/// create a new generic error which has ambiguos error inside | ||
pub fn new(a) { | ||
GenericError(a |> string.inspect) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import wisp | ||
|
||
pub fn info(message: String) { | ||
wisp.log_notice("[Okane]: " <> message) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters