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