-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathTaskfile.yml
112 lines (84 loc) · 2.43 KB
/
Taskfile.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
version: "3"
#
# global vars: https://taskfile.dev/#/usage?id=variables
#
vars:
VAR1: "some-var"
# global env:
env:
ENV1: testing
# OUT_DIR: "/Users/dev/Documents/iSpace/better-go/matrix/app/try/volo-example"
DATABASE_URL: "sqlite:tmp/app.db"
# env file:
#dotenv:
# - .env
################################################################################################
tasks:
run:git:
cmds:
- cargo run --bin rs-git
run:tpl:
cmds:
- cargo run --bin rs-tpl
run:dir:
cmds:
- cargo run --bin rs-dir
run:file:
cmds:
- cargo run --bin rs-file
run:progress:
cmds:
- cargo run --bin rs-progress
run:gent:
cmds:
- cargo run --bin rs-gent
################################################################################################
install:
cmds:
- cargo install sqlx-cli # ref: https://github.com/launchbadge/sqlx/tree/main/sqlx-cli
- cargo install sea-orm-cli # ref: https://www.sea-ql.org/SeaORM/docs/generate-entity/sea-orm-cli/
init:db:
cmds:
- sqlx database drop
- sqlx database create
migrate:add:
cmds:
- sqlx migrate add app # 生成 db migration 文件, 手动编辑, 再执行 db 表创建+初始化
migrate:
cmds:
- sqlx migrate run
run:sql:
cmds:
- cargo run --bin rs-sql add "todo description" # add
- cargo run --bin rs-sql done 1 # change status
- cargo run --bin rs-sql # list all
################################################################################################
migrate:orm:init:
cmds:
- sea-orm-cli migrate init -d {{.APP_NAME}}
# - sea-orm-cli migrate generate create -d {{.APP_NAME}} # generate empty migration file
vars:
APP_NAME: "migration"
migrate:orm:model:
cmds:
- sea-orm-cli generate entity -u ${DATABASE_URL} -o {{.APP_NAME}}/src
- cd {{.APP_NAME}}; cargo init --lib;
- cd {{.APP_NAME}}; mv src/mod.rs src/lib.rs;
- cd {{.APP_NAME}}; cargo add serde@1 --features derive
- cd {{.APP_NAME}}; cargo add [email protected]
vars:
APP_NAME: "entity"
ignore_error: true
run:orm:
cmds:
- RUST_LOG=debug cargo run --bin rs-orm
################################################################################################
update:
cmds:
- cargo update
build:
cmds:
- cargo build
clean:
cmds:
- cargo clean