examples: Fix table identifier (#812)
This commit is contained in:
parent
fff738a706
commit
8faabf4076
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user