Rust Sqlx

sqlx-cli

创建 migration

1
sqlx migrate add categories
1
2
3
4
5
6
7
-- Add migration script here
CREATE TABLE IF NOT EXISTS categories(
   id INT PRIMARY KEY DEFAULT AUTO_INCREMENT,
   type_id INT UNIQUE NOT NULL,
   parent_id INT NOT NULL,
   name TEXT UNIQUE NOT NULL,
  );

运行 migration

1
sqlx migrate run
Licensed under CC BY-NC-SA 4.0