examples: Fix table identifier (#812)

This commit is contained in:
Billy Chan 2022-06-22 16:21:23 +08:00 committed by GitHub
parent fff738a706
commit 8faabf4076
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 42 additions and 42 deletions

View File

@ -14,17 +14,17 @@ impl MigrationTrait for Migration {
manager manager
.create_table( .create_table(
Table::create() Table::create()
.table(Post::Table) .table(Posts::Table)
.if_not_exists() .if_not_exists()
.col( .col(
ColumnDef::new(Post::Id) ColumnDef::new(Posts::Id)
.integer() .integer()
.not_null() .not_null()
.auto_increment() .auto_increment()
.primary_key(), .primary_key(),
) )
.col(ColumnDef::new(Post::Title).string().not_null()) .col(ColumnDef::new(Posts::Title).string().not_null())
.col(ColumnDef::new(Post::Text).string().not_null()) .col(ColumnDef::new(Posts::Text).string().not_null())
.to_owned(), .to_owned(),
) )
.await .await
@ -32,14 +32,14 @@ impl MigrationTrait for Migration {
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> { async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
manager manager
.drop_table(Table::drop().table(Post::Table).to_owned()) .drop_table(Table::drop().table(Posts::Table).to_owned())
.await .await
} }
} }
/// Learn more at https://docs.rs/sea-query#iden /// Learn more at https://docs.rs/sea-query#iden
#[derive(Iden)] #[derive(Iden)]
enum Post { enum Posts {
Table, Table,
Id, Id,
Title, Title,

View File

@ -14,17 +14,17 @@ impl MigrationTrait for Migration {
manager manager
.create_table( .create_table(
Table::create() Table::create()
.table(Post::Table) .table(Posts::Table)
.if_not_exists() .if_not_exists()
.col( .col(
ColumnDef::new(Post::Id) ColumnDef::new(Posts::Id)
.integer() .integer()
.not_null() .not_null()
.auto_increment() .auto_increment()
.primary_key(), .primary_key(),
) )
.col(ColumnDef::new(Post::Title).string().not_null()) .col(ColumnDef::new(Posts::Title).string().not_null())
.col(ColumnDef::new(Post::Text).string().not_null()) .col(ColumnDef::new(Posts::Text).string().not_null())
.to_owned(), .to_owned(),
) )
.await .await
@ -32,14 +32,14 @@ impl MigrationTrait for Migration {
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> { async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
manager manager
.drop_table(Table::drop().table(Post::Table).to_owned()) .drop_table(Table::drop().table(Posts::Table).to_owned())
.await .await
} }
} }
/// Learn more at https://docs.rs/sea-query#iden /// Learn more at https://docs.rs/sea-query#iden
#[derive(Iden)] #[derive(Iden)]
enum Post { enum Posts {
Table, Table,
Id, Id,
Title, Title,

View File

@ -14,17 +14,17 @@ impl MigrationTrait for Migration {
manager manager
.create_table( .create_table(
Table::create() Table::create()
.table(Post::Table) .table(Posts::Table)
.if_not_exists() .if_not_exists()
.col( .col(
ColumnDef::new(Post::Id) ColumnDef::new(Posts::Id)
.integer() .integer()
.not_null() .not_null()
.auto_increment() .auto_increment()
.primary_key(), .primary_key(),
) )
.col(ColumnDef::new(Post::Title).string().not_null()) .col(ColumnDef::new(Posts::Title).string().not_null())
.col(ColumnDef::new(Post::Text).string().not_null()) .col(ColumnDef::new(Posts::Text).string().not_null())
.to_owned(), .to_owned(),
) )
.await .await
@ -32,14 +32,14 @@ impl MigrationTrait for Migration {
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> { async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
manager manager
.drop_table(Table::drop().table(Post::Table).to_owned()) .drop_table(Table::drop().table(Posts::Table).to_owned())
.await .await
} }
} }
/// Learn more at https://docs.rs/sea-query#iden /// Learn more at https://docs.rs/sea-query#iden
#[derive(Iden)] #[derive(Iden)]
enum Post { enum Posts {
Table, Table,
Id, Id,
Title, Title,

View File

@ -14,17 +14,17 @@ impl MigrationTrait for Migration {
manager manager
.create_table( .create_table(
Table::create() Table::create()
.table(Post::Table) .table(Posts::Table)
.if_not_exists() .if_not_exists()
.col( .col(
ColumnDef::new(Post::Id) ColumnDef::new(Posts::Id)
.integer() .integer()
.not_null() .not_null()
.auto_increment() .auto_increment()
.primary_key(), .primary_key(),
) )
.col(ColumnDef::new(Post::Title).string().not_null()) .col(ColumnDef::new(Posts::Title).string().not_null())
.col(ColumnDef::new(Post::Text).string().not_null()) .col(ColumnDef::new(Posts::Text).string().not_null())
.to_owned(), .to_owned(),
) )
.await .await
@ -32,14 +32,14 @@ impl MigrationTrait for Migration {
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> { async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
manager manager
.drop_table(Table::drop().table(Post::Table).to_owned()) .drop_table(Table::drop().table(Posts::Table).to_owned())
.await .await
} }
} }
/// Learn more at https://docs.rs/sea-query#iden /// Learn more at https://docs.rs/sea-query#iden
#[derive(Iden)] #[derive(Iden)]
enum Post { enum Posts {
Table, Table,
Id, Id,
Title, Title,

View File

@ -14,17 +14,17 @@ impl MigrationTrait for Migration {
manager manager
.create_table( .create_table(
Table::create() Table::create()
.table(Post::Table) .table(Posts::Table)
.if_not_exists() .if_not_exists()
.col( .col(
ColumnDef::new(Post::Id) ColumnDef::new(Posts::Id)
.integer() .integer()
.not_null() .not_null()
.auto_increment() .auto_increment()
.primary_key(), .primary_key(),
) )
.col(ColumnDef::new(Post::Title).string().not_null()) .col(ColumnDef::new(Posts::Title).string().not_null())
.col(ColumnDef::new(Post::Text).string().not_null()) .col(ColumnDef::new(Posts::Text).string().not_null())
.to_owned(), .to_owned(),
) )
.await .await
@ -32,14 +32,14 @@ impl MigrationTrait for Migration {
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> { async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
manager manager
.drop_table(Table::drop().table(Post::Table).to_owned()) .drop_table(Table::drop().table(Posts::Table).to_owned())
.await .await
} }
} }
/// Learn more at https://docs.rs/sea-query#iden /// Learn more at https://docs.rs/sea-query#iden
#[derive(Iden)] #[derive(Iden)]
enum Post { enum Posts {
Table, Table,
Id, Id,
Title, Title,

View File

@ -14,17 +14,17 @@ impl MigrationTrait for Migration {
manager manager
.create_table( .create_table(
Table::create() Table::create()
.table(Post::Table) .table(Posts::Table)
.if_not_exists() .if_not_exists()
.col( .col(
ColumnDef::new(Post::Id) ColumnDef::new(Posts::Id)
.integer() .integer()
.not_null() .not_null()
.auto_increment() .auto_increment()
.primary_key(), .primary_key(),
) )
.col(ColumnDef::new(Post::Title).string().not_null()) .col(ColumnDef::new(Posts::Title).string().not_null())
.col(ColumnDef::new(Post::Text).string().not_null()) .col(ColumnDef::new(Posts::Text).string().not_null())
.to_owned(), .to_owned(),
) )
.await .await
@ -32,14 +32,14 @@ impl MigrationTrait for Migration {
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> { async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
manager manager
.drop_table(Table::drop().table(Post::Table).to_owned()) .drop_table(Table::drop().table(Posts::Table).to_owned())
.await .await
} }
} }
/// Learn more at https://docs.rs/sea-query#iden /// Learn more at https://docs.rs/sea-query#iden
#[derive(Iden)] #[derive(Iden)]
enum Post { enum Posts {
Table, Table,
Id, Id,
Title, Title,

View File

@ -14,17 +14,17 @@ impl MigrationTrait for Migration {
manager manager
.create_table( .create_table(
Table::create() Table::create()
.table(Post::Table) .table(Posts::Table)
.if_not_exists() .if_not_exists()
.col( .col(
ColumnDef::new(Post::Id) ColumnDef::new(Posts::Id)
.integer() .integer()
.not_null() .not_null()
.auto_increment() .auto_increment()
.primary_key(), .primary_key(),
) )
.col(ColumnDef::new(Post::Title).string().not_null()) .col(ColumnDef::new(Posts::Title).string().not_null())
.col(ColumnDef::new(Post::Text).string().not_null()) .col(ColumnDef::new(Posts::Text).string().not_null())
.to_owned(), .to_owned(),
) )
.await .await
@ -32,14 +32,14 @@ impl MigrationTrait for Migration {
async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> { async fn down(&self, manager: &SchemaManager) -> Result<(), DbErr> {
manager manager
.drop_table(Table::drop().table(Post::Table).to_owned()) .drop_table(Table::drop().table(Posts::Table).to_owned())
.await .await
} }
} }
/// Learn more at https://docs.rs/sea-query#iden /// Learn more at https://docs.rs/sea-query#iden
#[derive(Iden)] #[derive(Iden)]
enum Post { enum Posts {
Table, Table,
Id, Id,
Title, Title,