Skip to content

Latest commit

 

History

History
58 lines (42 loc) · 1.69 KB

README.md

File metadata and controls

58 lines (42 loc) · 1.69 KB

Letters

A blog system build with rust.

Tech Stack

  • rust
    • axum: A ergonomic and modular web framework
    • tracing: Application level tracing for Rust
    • sqlx: an async, pure Rust† SQL crate featuring compile-time checked queries without a DSL.
    • serde: Serialization framework for Rust
    • thiserror: derive(Error) for struct and enum error types
    • dotenvy: A well-maintained fork of the Rust dotenv crate
    • argon2: Pure Rust implementation of the Argon2 password hashing function
    • base64: base64, in rust
    • jsonwebtoken: JWT lib in rust
    • secrecy: A simple secret-keeping library for Rust.

Usage

Migrations

  1. Install toolchain
$ cargo install sqlx-cli
  1. create .env file, like:
# .env

DATABASE_URL=mysql://mysql@localhost/db_name
  1. create/drop database
sqlx database create    # create database
sqlx database drop      # drop database
  1. create and run migrations

create migrate, will create a new file in migrations/<timestamp>-<name>.(up/down).sql:

sqlx migrate add -r <name>

then add your database scheme to this file


run migrations

sqlx migrate run

more information to read sqlx-cli document