https://github.com/violetbuse/feather
Gleam + Sqlight as a feather
https://github.com/violetbuse/feather
Last synced: about 1 year ago
JSON representation
Gleam + Sqlight as a feather
- Host: GitHub
- URL: https://github.com/violetbuse/feather
- Owner: VioletBuse
- Created: 2024-06-26T18:57:13.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2024-08-14T10:52:14.000Z (almost 2 years ago)
- Last Synced: 2025-03-22T04:17:24.700Z (about 1 year ago)
- Language: Gleam
- Size: 10.7 KB
- Stars: 8
- Watchers: 1
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# feather
[](https://hex.pm/packages/feather)
[](https://hexdocs.pm/feather/)
```sh
gleam add feather
```
Add the following fields to your gleam.toml file:
```toml
# this can of course be anything you like
migrations_dir = "./priv/migrations"
schemafile = "./schema.sql"
```
Then run the command `gleam run -m feather -- new "Initial schema migration"` and make any changes you like.
Running the command `gleam run -m feather -- schema` will create the file ./schema.sql, (or whatever you set in your gleam.toml) with the schema of your database after all migrations have been applied.
```gleam
import feather
import gleam/result
import gleam/erlang
import sqlight
pub fn main() {
let assert Ok(priv_dir) = erlang.priv_directory("my_module_name")
use migrations <- result.try(feather.get_migrations(priv_dir <> "/migrations"))
use connection <- feather.connect(feather.Config(..feather.default_config(), file: "./database.db"))
feather.migrate(migrations, on: connection)
}
```
Further documentation can be found at .
## Development
```sh
gleam run # Run the project
gleam test # Run the tests
gleam shell # Run an Erlang shell
```