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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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