refactor: implicitly declare primary keys names

This commit is contained in:
Suiranoil
2023-07-04 19:03:24 +03:00
parent 0805c59a7b
commit d83e507913
3 changed files with 6 additions and 6 deletions

View File

@@ -15,8 +15,7 @@ impl MigrationTrait for Migration {
ColumnDef::new(Guilds::Id) ColumnDef::new(Guilds::Id)
.integer() .integer()
.not_null() .not_null()
.auto_increment() .auto_increment(),
.primary_key(),
) )
.col( .col(
ColumnDef::new(Guilds::GuildId) ColumnDef::new(Guilds::GuildId)
@@ -30,6 +29,7 @@ impl MigrationTrait for Migration {
.not_null() .not_null()
.default(false), .default(false),
) )
.primary_key(Index::create().name("guilds_pkey").col(Guilds::Id))
.to_owned(), .to_owned(),
) )
.await?; .await?;

View File

@@ -14,8 +14,7 @@ impl MigrationTrait for Migration {
ColumnDef::new(Lobbies::Id) ColumnDef::new(Lobbies::Id)
.integer() .integer()
.not_null() .not_null()
.auto_increment() .auto_increment(),
.primary_key(),
) )
.col(ColumnDef::new(Lobbies::GuildId).big_unsigned().not_null()) .col(ColumnDef::new(Lobbies::GuildId).big_unsigned().not_null())
.col( .col(
@@ -33,6 +32,7 @@ impl MigrationTrait for Migration {
.big_unsigned() .big_unsigned()
.not_null(), .not_null(),
) )
.primary_key(Index::create().name("lobbies_pkey").col(Lobbies::Id))
.to_owned(), .to_owned(),
) )
.await?; .await?;

View File

@@ -14,8 +14,7 @@ impl MigrationTrait for Migration {
ColumnDef::new(Players::Id) ColumnDef::new(Players::Id)
.integer() .integer()
.not_null() .not_null()
.auto_increment() .auto_increment(),
.primary_key(),
) )
.col( .col(
ColumnDef::new(Players::DiscordId) ColumnDef::new(Players::DiscordId)
@@ -89,6 +88,7 @@ impl MigrationTrait for Migration {
.col(ColumnDef::new(Players::PrimaryRole).custom(Role)) .col(ColumnDef::new(Players::PrimaryRole).custom(Role))
.col(ColumnDef::new(Players::SecondaryRole).custom(Role)) .col(ColumnDef::new(Players::SecondaryRole).custom(Role))
.col(ColumnDef::new(Players::TertiaryRole).custom(Role)) .col(ColumnDef::new(Players::TertiaryRole).custom(Role))
.primary_key(Index::create().name("players_pkey").col(Players::Id))
.to_owned(), .to_owned(),
) )
.await?; .await?;