Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New user setting entries migration #1134

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/util/entities/UserSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ export class UserSettings extends BaseClassWithoutId {

@Column({ nullable: true })
view_nsfw_guilds: boolean = true;

}

interface CustomStatus {
Expand Down
23 changes: 23 additions & 0 deletions src/util/migration/mariadb/1719776735000-newUserSettings.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { MigrationInterface, QueryRunner } from "typeorm";

export class NewUserSettings1719776735000 implements MigrationInterface {
name = "NewUserSettings1719776735000";

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
"ALTER TABLE `user_settings` ADD friend_discovery_flags integer NULL DEFAULT 0;",
);
await queryRunner.query(
"ALTER TABLE `user_settings` ADD view_nsfw_guilds tinyint NULL DEFAULT 1;",
);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
"ALTER TABLE `user_settings` DROP COLUMN friend_discovery_flags;",
);
await queryRunner.query(
"ALTER TABLE `user_settings` DROP COLUMN view_nsfw_guilds;",
);
}
}
23 changes: 23 additions & 0 deletions src/util/migration/mysql/1719776735000-newUserSettings.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { MigrationInterface, QueryRunner } from "typeorm";

export class NewUserSettings1719776735000 implements MigrationInterface {
name = "NewUserSettings1719776735000";

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
"ALTER TABLE `user_settings` ADD friend_discovery_flags integer NULL DEFAULT 0;",
);
await queryRunner.query(
"ALTER TABLE `user_settings` ADD view_nsfw_guilds tinyint NULL DEFAULT 1;",
);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
"ALTER TABLE `user_settings` DROP COLUMN friend_discovery_flags;",
);
await queryRunner.query(
"ALTER TABLE `user_settings` DROP COLUMN view_nsfw_guilds;",
);
}
}
23 changes: 23 additions & 0 deletions src/util/migration/postgres/1719776735000-newUserSettings.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { MigrationInterface, QueryRunner } from "typeorm";

export class NewUserSettings1719776735000 implements MigrationInterface {
name = "NewUserSettings1719776735000";

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
"ALTER TABLE user_settings ADD COLUMN friend_discovery_flags integer DEFAULT 0;",
);
await queryRunner.query(
"ALTER TABLE user_settings ADD COLUMN view_nsfw_guilds boolean DEFAULT true;",
);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
"ALTER TABLE user_settings DROP COLUMN friend_discovery_flags;",
);
await queryRunner.query(
"ALTER TABLE user_settings DROP COLUMN view_nsfw_guilds;",
);
}
}
Loading