mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
migration to rename login_pending_tasks_admin to admin_pending_creations
also remove old table login_pending_tasks
This commit is contained in:
parent
88a269c6be
commit
81351102a9
@ -0,0 +1,25 @@
|
||||
import { BaseEntity, Column, Entity, PrimaryGeneratedColumn } from 'typeorm'
|
||||
|
||||
@Entity('admin_pending_creations')
|
||||
export class AdminPendingCreation extends BaseEntity {
|
||||
@PrimaryGeneratedColumn('increment', { unsigned: true })
|
||||
id: number
|
||||
|
||||
@Column({ unsigned: true, nullable: false })
|
||||
userId: number
|
||||
|
||||
@Column({ type: 'datetime', default: () => 'CURRENT_TIMESTAMP' })
|
||||
created: Date
|
||||
|
||||
@Column({ type: 'datetime', nullable: false })
|
||||
date: Date
|
||||
|
||||
@Column({ length: 256, nullable: true, default: null })
|
||||
memo: string
|
||||
|
||||
@Column({ type: 'bigint', nullable: false })
|
||||
amount: BigInt
|
||||
|
||||
@Column()
|
||||
moderator: number
|
||||
}
|
||||
1
database/entity/AdminPendingCreation.ts
Normal file
1
database/entity/AdminPendingCreation.ts
Normal file
@ -0,0 +1 @@
|
||||
export { AdminPendingCreation } from './0015-admin_pending_creations/AdminPendingCreation'
|
||||
@ -1 +0,0 @@
|
||||
export { LoginPendingTasksAdmin } from './0005-admin_tables/LoginPendingTasksAdmin'
|
||||
@ -13,9 +13,10 @@ import { TransactionSendCoin } from './TransactionSendCoin'
|
||||
import { User } from './User'
|
||||
import { UserSetting } from './UserSetting'
|
||||
import { UserTransaction } from './UserTransaction'
|
||||
import { LoginPendingTasksAdmin } from './LoginPendingTasksAdmin'
|
||||
import { AdminPendingCreation } from './AdminPendingCreation'
|
||||
|
||||
export const entities = [
|
||||
AdminPendingCreation,
|
||||
Balance,
|
||||
LoginElopageBuys,
|
||||
LoginEmailOptIn,
|
||||
@ -31,5 +32,4 @@ export const entities = [
|
||||
User,
|
||||
UserSetting,
|
||||
UserTransaction,
|
||||
LoginPendingTasksAdmin,
|
||||
]
|
||||
|
||||
35
database/migrations/0015-admin_pending_creations.ts
Normal file
35
database/migrations/0015-admin_pending_creations.ts
Normal file
@ -0,0 +1,35 @@
|
||||
/* MIGRATION TO PROPERLY STORE PENDING CREATIONS
|
||||
*
|
||||
* There were two tables for the pending tasks,
|
||||
* since the login_server used some crypto to store its
|
||||
* tasks there. It was easier to create a new table.
|
||||
* This migration drops the old unused table and renames
|
||||
* the new table to properly describe what it does
|
||||
*/
|
||||
|
||||
export async function upgrade(queryFn: (query: string, values?: any[]) => Promise<Array<any>>) {
|
||||
// drop duplicate table, it was unused
|
||||
await queryFn('DROP TABLE `login_pending_tasks`;')
|
||||
|
||||
// rename the new pending creations table to a proper table name
|
||||
await queryFn('RENAME TABLE `login_pending_tasks_admin` TO `admin_pending_creations`;')
|
||||
}
|
||||
|
||||
export async function downgrade(queryFn: (query: string, values?: any[]) => Promise<Array<any>>) {
|
||||
await queryFn('RENAME TABLE `admin_pending_creations` TO `login_pending_tasks_admin`;')
|
||||
await queryFn(`
|
||||
CREATE TABLE \`login_pending_tasks\` (
|
||||
\`id\` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
\`user_id\` int(10) unsigned DEFAULT 0,
|
||||
\`request\` varbinary(2048) NOT NULL,
|
||||
\`created\` datetime NOT NULL,
|
||||
\`finished\` datetime DEFAULT '2000-01-01 00:00:00',
|
||||
\`result_json\` text DEFAULT NULL,
|
||||
\`param_json\` text DEFAULT NULL,
|
||||
\`task_type_id\` int(10) unsigned NOT NULL,
|
||||
\`child_pending_task_id\` int(10) unsigned DEFAULT 0,
|
||||
\`parent_pending_task_id\` int(10) unsigned DEFAULT 0,
|
||||
PRIMARY KEY (\`id\`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=795 DEFAULT CHARSET=utf8mb4
|
||||
`)
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user