-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #344 from TaloDev/develop
Release 0.45.0
- Loading branch information
Showing
19 changed files
with
484 additions
and
24 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { Entity, ManyToOne, PrimaryKey, Property, Unique } from '@mikro-orm/mysql' | ||
import User from './user' | ||
import PlayerGroup from './player-group' | ||
|
||
@Entity() | ||
@Unique({ properties: ['user', 'group'] }) | ||
export default class UserPinnedGroup { | ||
@PrimaryKey() | ||
id: number | ||
|
||
@ManyToOne(() => User, { eager: true }) | ||
user: User | ||
|
||
@ManyToOne(() => PlayerGroup, { eager: true }) | ||
group: PlayerGroup | ||
|
||
@Property() | ||
createdAt: Date = new Date() | ||
|
||
constructor(user: User, group: PlayerGroup) { | ||
this.user = user | ||
this.group = group | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/migrations/20241001194252CreateUserPinnedGroupsTable.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Migration } from '@mikro-orm/migrations' | ||
|
||
export class CreateUserPinnedGroupsTable extends Migration { | ||
|
||
override async up(): Promise<void> { | ||
this.addSql('create table `user_pinned_group` (`id` int unsigned not null auto_increment primary key, `user_id` int unsigned not null, `group_id` varchar(255) not null, `created_at` datetime not null) default character set utf8mb4 engine = InnoDB;') | ||
this.addSql('alter table `user_pinned_group` add index `user_pinned_group_user_id_index`(`user_id`);') | ||
this.addSql('alter table `user_pinned_group` add index `user_pinned_group_group_id_index`(`group_id`);') | ||
this.addSql('alter table `user_pinned_group` add unique `user_pinned_group_user_id_group_id_unique`(`user_id`, `group_id`);') | ||
|
||
this.addSql('alter table `user_pinned_group` add constraint `user_pinned_group_user_id_foreign` foreign key (`user_id`) references `user` (`id`) on update cascade;') | ||
this.addSql('alter table `user_pinned_group` add constraint `user_pinned_group_group_id_foreign` foreign key (`group_id`) references `player_group` (`id`) on update cascade;') | ||
} | ||
|
||
override async down(): Promise<void> { | ||
this.addSql('drop table if exists `user_pinned_group`;') | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.