Skip to content

Commit

Permalink
Merge branch 'master' into cursor-pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
billy1624 committed Jun 20, 2022
2 parents f422f34 + 091a91f commit 88c4268
Show file tree
Hide file tree
Showing 38 changed files with 474 additions and 98 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.html.tera linguist-language=HTML
14 changes: 7 additions & 7 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ jobs:
toolchain: stable
override: true

- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
Expand Down Expand Up @@ -176,7 +176,7 @@ jobs:
toolchain: stable
override: true

- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
Expand Down Expand Up @@ -215,7 +215,7 @@ jobs:
toolchain: stable
override: true

- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
Expand Down Expand Up @@ -380,7 +380,7 @@ jobs:
toolchain: stable
override: true

- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
Expand Down Expand Up @@ -449,7 +449,7 @@ jobs:
toolchain: stable
override: true

- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
Expand Down Expand Up @@ -518,7 +518,7 @@ jobs:
toolchain: stable
override: true

- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
Expand Down Expand Up @@ -576,7 +576,7 @@ jobs:
toolchain: stable
override: true

- uses: actions/cache@v2
- uses: actions/cache@v3
with:
path: |
~/.cargo/registry
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## 0.9.0 - Pending

* Improve sea-orm-cli logging (#735)

## sea-orm-migration 0.8.3

* Removed `async-std` from dependency https://github.com/SeaQL/sea-orm/pull/758

## 0.8.0 - 2022-05-10

### New Features
Expand Down
2 changes: 2 additions & 0 deletions COMMUNITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,5 @@ If you have built an app using SeaORM and want to showcase it, feel free to open
- [Quasar](https://github.com/Technik97/Quasar) | Rust REST API using Actix-Web, SeaOrm and Postgres with Svelte Typescript Frontend
- [snmp-sim-rust](https://github.com/sonalake/snmp-sim-rust) | SNMP Simulator
- [template_flow](https://github.com/hilary888/template_flow) | An experiment exploring replacing placeholders in pre-prepared templates with their actual values
- [actix-react-starter-template](https://github.com/aslamplr/actix-react-starter-template) | Actix web + SeaORM + React + Redux + Redux Saga project starter template
- [ZAPP](https://zapp.epics.dev) ([repository](https://github.com/EpicsDAO/zapp)) | ZAPP is a serverless framework made by Rust. Quickly build a scalable GraphQL API web server.
7 changes: 6 additions & 1 deletion examples/actix3_example/migration/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@ name = "migration"
path = "src/lib.rs"

[dependencies]
entity = { path = "../entity" }
async-std = { version = "^1", features = ["attributes", "tokio1"] }

[dependencies.sea-orm-migration]
path = "../../../sea-orm-migration" # remove this line in your own project
version = "^0.8.0"
features = [
# Enable following runtime and db backend features if you want to run migration via CLI
# "runtime-async-std-native-tls",
# "sqlx-mysql",
]
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use entity::post::*;
use sea_orm_migration::prelude::*;

pub struct Migration;
Expand All @@ -15,25 +14,34 @@ impl MigrationTrait for Migration {
manager
.create_table(
Table::create()
.table(Entity)
.table(Post::Table)
.if_not_exists()
.col(
ColumnDef::new(Column::Id)
ColumnDef::new(Post::Id)
.integer()
.not_null()
.auto_increment()
.primary_key(),
)
.col(ColumnDef::new(Column::Title).string().not_null())
.col(ColumnDef::new(Column::Text).string().not_null())
.col(ColumnDef::new(Post::Title).string().not_null())
.col(ColumnDef::new(Post::Text).string().not_null())
.to_owned(),
)
.await
}

async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
manager
.drop_table(Table::drop().table(Entity).to_owned())
.drop_table(Table::drop().table(Post::Table).to_owned())
.await
}
}

/// Learn more at https://docs.rs/sea-query#iden
#[derive(Iden)]
enum Post {
Table,
Id,
Title,
Text,
}
7 changes: 6 additions & 1 deletion examples/actix_example/migration/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@ name = "migration"
path = "src/lib.rs"

[dependencies]
entity = { path = "../entity" }
async-std = { version = "^1", features = ["attributes", "tokio1"] }

[dependencies.sea-orm-migration]
path = "../../../sea-orm-migration" # remove this line in your own project
version = "^0.8.0"
features = [
# Enable following runtime and db backend features if you want to run migration via CLI
# "runtime-actix-native-tls",
# "sqlx-mysql",
]
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use entity::post::*;
use sea_orm_migration::prelude::*;

pub struct Migration;
Expand All @@ -15,25 +14,34 @@ impl MigrationTrait for Migration {
manager
.create_table(
Table::create()
.table(Entity)
.table(Post::Table)
.if_not_exists()
.col(
ColumnDef::new(Column::Id)
ColumnDef::new(Post::Id)
.integer()
.not_null()
.auto_increment()
.primary_key(),
)
.col(ColumnDef::new(Column::Title).string().not_null())
.col(ColumnDef::new(Column::Text).string().not_null())
.col(ColumnDef::new(Post::Title).string().not_null())
.col(ColumnDef::new(Post::Text).string().not_null())
.to_owned(),
)
.await
}

async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
manager
.drop_table(Table::drop().table(Entity).to_owned())
.drop_table(Table::drop().table(Post::Table).to_owned())
.await
}
}

/// Learn more at https://docs.rs/sea-query#iden
#[derive(Iden)]
enum Post {
Table,
Id,
Title,
Text,
}
7 changes: 6 additions & 1 deletion examples/axum_example/migration/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@ name = "migration"
path = "src/lib.rs"

[dependencies]
entity = { path = "../entity" }
async-std = { version = "^1", features = ["attributes", "tokio1"] }

[dependencies.sea-orm-migration]
path = "../../../sea-orm-migration" # remove this line in your own project
version = "^0.8.0"
features = [
# Enable following runtime and db backend features if you want to run migration via CLI
# "runtime-tokio-native-tls",
# "sqlx-postgres",
]
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use entity::post::*;
use sea_orm_migration::prelude::*;

pub struct Migration;
Expand All @@ -15,25 +14,34 @@ impl MigrationTrait for Migration {
manager
.create_table(
Table::create()
.table(Entity)
.table(Post::Table)
.if_not_exists()
.col(
ColumnDef::new(Column::Id)
ColumnDef::new(Post::Id)
.integer()
.not_null()
.auto_increment()
.primary_key(),
)
.col(ColumnDef::new(Column::Title).string().not_null())
.col(ColumnDef::new(Column::Text).string().not_null())
.col(ColumnDef::new(Post::Title).string().not_null())
.col(ColumnDef::new(Post::Text).string().not_null())
.to_owned(),
)
.await
}

async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
manager
.drop_table(Table::drop().table(Entity).to_owned())
.drop_table(Table::drop().table(Post::Table).to_owned())
.await
}
}

/// Learn more at https://docs.rs/sea-query#iden
#[derive(Iden)]
enum Post {
Table,
Id,
Title,
Text,
}
7 changes: 6 additions & 1 deletion examples/graphql_example/migration/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,13 @@ path = "src/lib.rs"

[dependencies]
dotenv = "0.15.0"
entity = { path = "../entity" }
async-std = { version = "^1", features = ["attributes", "tokio1"] }

[dependencies.sea-orm-migration]
path = "../../../sea-orm-migration" # remove this line in your own project
version = "^0.8.0"
features = [
# Enable following runtime and db backend features if you want to run migration via CLI
# "runtime-tokio-native-tls",
# "sqlx-sqlite",
]
Original file line number Diff line number Diff line change
@@ -1,22 +1,7 @@
use entity::note;
use sea_orm::{DbBackend, EntityTrait, Schema};
use sea_orm_migration::prelude::*;

pub struct Migration;

fn get_seaorm_create_stmt<E: EntityTrait>(e: E) -> TableCreateStatement {
let schema = Schema::new(DbBackend::Sqlite);

schema
.create_table_from_entity(e)
.if_not_exists()
.to_owned()
}

fn get_seaorm_drop_stmt<E: EntityTrait>(e: E) -> TableDropStatement {
Table::drop().table(e).if_exists().to_owned()
}

impl MigrationName for Migration {
fn name(&self) -> &str {
"m20220101_000001_create_table"
Expand All @@ -26,22 +11,37 @@ impl MigrationName for Migration {
#[async_trait::async_trait]
impl MigrationTrait for Migration {
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
let stmts = vec![get_seaorm_create_stmt(note::Entity)];

for stmt in stmts {
manager.create_table(stmt.to_owned()).await?;
}

Ok(())
manager
.create_table(
Table::create()
.table(Notes::Table)
.if_not_exists()
.col(
ColumnDef::new(Notes::Id)
.integer()
.not_null()
.auto_increment()
.primary_key(),
)
.col(ColumnDef::new(Notes::Title).string().not_null())
.col(ColumnDef::new(Notes::Text).string().not_null())
.to_owned(),
)
.await
}

async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
let stmts = vec![get_seaorm_drop_stmt(note::Entity)];

for stmt in stmts {
manager.drop_table(stmt.to_owned()).await?;
}

Ok(())
manager
.drop_table(Table::drop().table(Notes::Table).to_owned())
.await
}
}

/// Learn more at https://docs.rs/sea-query#iden
#[derive(Iden)]
enum Notes {
Table,
Id,
Title,
Text,
}
7 changes: 6 additions & 1 deletion examples/jsonrpsee_example/migration/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@ name = "migration"
path = "src/lib.rs"

[dependencies]
entity = { path = "../entity" }
async-std = { version = "^1", features = ["attributes", "tokio1"] }

[dependencies.sea-orm-migration]
path = "../../../sea-orm-migration" # remove this line in your own project
version = "^0.8.0"
features = [
# Enable following runtime and db backend features if you want to run migration via CLI
# "runtime-tokio-native-tls",
# "sqlx-sqlite",
]
Loading

0 comments on commit 88c4268

Please sign in to comment.