feat: mod make to work with only db-sqlx-sqlite workspace

This commit is contained in:
Aravinth Manivannan 2022-04-12 17:46:53 +05:30
parent da88e6f0b4
commit e124cb6348
Signed by: realaravinth
GPG key ID: AD9F0F08E855ED88

View file

@ -1,3 +1,9 @@
define test_sqlite_db
cd db/db-sqlx-sqlite &&\
DATABASE_URL=${SQLITE_DATABASE_URL}\
cargo test --no-fail-fast
endef
default: ## Debug build default: ## Debug build
cargo build cargo build
@ -12,12 +18,12 @@ coverage: migrate ## Generate coverage report in HTML format
cargo tarpaulin -t 1200 --out Html --skip-clean --all-features --no-fail-fast #--workspace=database/db-sqlx-postgres,database/db-sqlx-sqlite,. cargo tarpaulin -t 1200 --out Html --skip-clean --all-features --no-fail-fast #--workspace=database/db-sqlx-postgres,database/db-sqlx-sqlite,.
check: ## Check for syntax errors on all workspaces check: ## Check for syntax errors on all workspaces
cargo check --workspace --tests --all-features
cd db/migrator && cargo check --tests --all-features
cd db/db-sqlx-sqlite &&\
DATABASE_URL=${SQLITE_DATABASE_URL}\
cargo check cargo check
# cd db/db-sqlx-sqlite &&\ cd db/db-core/ && cargo check
# DATABASE_URL=${SQLITE_DATABASE_URL}\
# cargo check
# cd db/db-core/ && cargo check
# cd db/migrator && cargo check
dev-env: ## Download development dependencies dev-env: ## Download development dependencies
cargo fetch cargo fetch
@ -43,18 +49,19 @@ run: default ## Run debug build
cargo run cargo run
migrate: ## run migrations migrate: ## run migrations
echo TODO: add migrations @-rm -rf db/db-sqlx-sqlite/tmp && mkdir db/db-sqlx-sqlite/tmp
# @-rm -rf database/db-sqlx-sqlite/tmp && mkdir database/db-sqlx-sqlite/tmp cd db/migrator && cargo run
# cd database/migrator && cargo run # echo TODO: add migrations
sqlx-offline-data: ## prepare sqlx offline data sqlx-offline-data: ## prepare sqlx offline data
cargo sqlx prepare --database-url=${POSTGRES_DATABASE_URL} -- --bin gitpad \ cd db/db-sqlx-sqlite/ \
&& DATABASE_URL=${SQLITE_DATABASE_URL} cargo sqlx prepare
# cargo sqlx prepare --database-url=${POSTGRES_DATABASE_URL} -- --bin starchart \
--all-features --all-features
test: migrate ## Run tests test: migrate ## Run tests
$(call test_sqlite_db)
cargo test --no-fail-fast cargo test --no-fail-fast
# cd db/db-sqlx-sqlite &&\
# DATABASE_URL=${SQLITE_DATABASE_URL}\
# cd database/db-sqlx-postgres &&\ # cd database/db-sqlx-postgres &&\
# DATABASE_URL=${POSTGRES_DATABASE_URL}\ # DATABASE_URL=${POSTGRES_DATABASE_URL}\
# cargo test --no-fail-fast # cargo test --no-fail-fast