Bump up dependency versions (#62)

* bump up dependency versions

* fix ci.yml

* turn off incremental compilation

* bump up sqlx version

* fix rust

* remove unused features

* add profile

* optimize proc macro

* default features false in database-tree

* remove sqlx from database-tree

* remove --release

* fix

* bump up opt-level 2

* 1

* sqlx 3

* remove profile

* remove windows gnu

* remove windows-gnu

* cache dependencies

* remove windows gnu

* fix typo
pull/63/head
Takayuki Maeda 3 years ago committed by GitHub
parent 07357f2a3b
commit 1437f71717
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -14,6 +14,9 @@ on:
- 'LICENSE'
- '**.md'
env:
CARGO_INCREMENTAL: 0
jobs:
format:
name: Format
@ -23,14 +26,6 @@ jobs:
- name: Cargo fmt
run: cargo fmt --all -- --check
check:
name: Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Cargo check
run: cargo check
lint:
name: Lint
runs-on: ubuntu-latest
@ -58,30 +53,73 @@ jobs:
unit_tests:
name: Unit Tests
runs-on: ${{ matrix.os }}
env:
# For some builds, we use cross to test on 32-bit and big-endian
# systems.
CARGO: cargo
# When CARGO is set to CROSS, this is set to `--target matrix.target`.
TARGET_FLAGS: ""
# When CARGO is set to CROSS, TARGET_DIR includes matrix.target.
TARGET_DIR: ./target
# Emit backtraces on panics.
RUST_BACKTRACE: 1
RUST_MIN_SRV: "1.43.1"
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
needs: check
build: [linux, linux-arm, macos, win-msvc, win32-msvc]
include:
- build: linux
os: ubuntu-18.04
rust: stable
target: x86_64-unknown-linux-musl
- build: linux-arm
os: ubuntu-18.04
rust: stable
target: arm-unknown-linux-gnueabihf
- build: macos
os: macos-latest
rust: stable
target: x86_64-apple-darwin
- build: win-msvc
os: windows-2019
rust: stable
target: x86_64-pc-windows-msvc
- build: win32-msvc
os: windows-2019
rust: stable
target: i686-pc-windows-msvc
steps:
- uses: actions/checkout@v2
- name: Cache cargo registry
if: runner.os != 'macOS'
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v1
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
if: runner.os != 'macOS'
uses: actions/cache@v1
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- name: Run Tests
run: cargo test --workspace -- --skip=e2e --color always
toolchain: ${{ matrix.rust }}
profile: minimal
override: true
target: ${{ matrix.target }}
- name: Use Cross
shell: bash
run: |
cargo install cross
echo "CARGO=cross" >> $GITHUB_ENV
echo "TARGET_FLAGS=--target ${{ matrix.target }}" >> $GITHUB_ENV
echo "TARGET_DIR=./target/${{ matrix.target }}" >> $GITHUB_ENV
- name: Show command used for Cargo
run: |
echo "cargo command is: ${{ env.CARGO }}"
echo "target flag is: ${{ env.TARGET_FLAGS }}"
echo "target dir is: ${{ env.TARGET_DIR }}"
- name: Cache Dependencies
uses: Swatinem/rust-cache@v1
- name: Build
run: ${{ env.CARGO }} build --verbose ${{ env.TARGET_FLAGS }}
- name: Run tests
run: ${{ env.CARGO }} test --verbose --workspace ${{ env.TARGET_FLAGS }}

@ -22,7 +22,7 @@ jobs:
strategy:
fail-fast: false
matrix:
build: [linux, linux-arm, macos, win-msvc, win-gnu, win32-msvc]
build: [linux, linux-arm, macos, win-msvc, win32-msvc]
include:
- build: linux
os: ubuntu-18.04
@ -40,10 +40,6 @@ jobs:
os: windows-2019
rust: nightly
target: x86_64-pc-windows-msvc
- build: win-gnu
os: windows-2019
rust: nightly-x86_64-gnu
target: x86_64-pc-windows-gnu
- build: win32-msvc
os: windows-2019
rust: nightly

549
Cargo.lock generated

File diff suppressed because it is too large Load Diff

@ -15,13 +15,13 @@ members=[
]
[dependencies]
tui = { version = "0.14.0", features = ["crossterm"], default-features = false }
crossterm = "0.19"
tui = { version = "0.15.0", features = ["crossterm"], default-features = false }
crossterm = "0.20"
anyhow = "1.0.38"
unicode-width = "0.1"
sqlx = { version = "0.4.1", features = ["mysql", "postgres", "sqlite", "chrono", "runtime-tokio-rustls", "decimal", "json"] }
sqlx = { version = "0.5.6", features = ["mysql", "postgres", "sqlite", "chrono", "runtime-tokio-rustls", "decimal", "json"], default-features = false }
chrono = "0.4"
tokio = { version = "0.2.22", features = ["full"] }
tokio = { version = "1.11.0", features = ["full"] }
futures = "0.3.5"
serde_json = "1.0"
serde = "1.0"

@ -11,6 +11,5 @@ description = "Database tree structure"
[dependencies]
thiserror = "1.0"
sqlx = { version = "0.4.1", features = ["mysql", "chrono", "runtime-tokio-rustls"] }
chrono = "0.4"
anyhow = "1.0.38"

@ -50,16 +50,11 @@ pub struct Schema {
pub tables: Vec<Table>,
}
#[derive(sqlx::FromRow, Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq)]
pub struct Table {
#[sqlx(rename = "Name")]
pub name: String,
#[sqlx(rename = "Create_time")]
pub create_time: Option<chrono::DateTime<chrono::Utc>>,
#[sqlx(rename = "Update_time")]
pub update_time: Option<chrono::DateTime<chrono::Utc>>,
#[sqlx(rename = "Engine")]
pub engine: Option<String>,
#[sqlx(default)]
pub schema: Option<String>,
}

@ -158,10 +158,18 @@ impl Pool for MySqlPool {
}
async fn get_tables(&self, database: String) -> anyhow::Result<Vec<Child>> {
let tables =
sqlx::query_as::<_, Table>(format!("SHOW TABLE STATUS FROM `{}`", database).as_str())
.fetch_all(&self.pool)
.await?;
let query = format!("SHOW TABLE STATUS FROM `{}`", database);
let mut rows = sqlx::query(query.as_str()).fetch(&self.pool);
let mut tables = vec![];
while let Some(row) = rows.try_next().await? {
tables.push(Table {
name: row.try_get("Name")?,
create_time: row.try_get("Create_time")?,
update_time: row.try_get("Update_time")?,
engine: row.try_get("Engine")?,
schema: None,
})
}
Ok(tables.into_iter().map(|table| table.into()).collect())
}

Loading…
Cancel
Save