import { Knex } from 'knex' ; import IgnoreChatInfo from '../../types/IgnoreChatInfo' ; import { DBVersion } from '../../types/SQLTableTypes' ; const upg3to4 = async ( db ) => { const ignoredChats = await db < IgnoreChatInfo > ( 'ignoredChats' ) . select ( '*' ) ; await db . schema . dropTable ( 'ignoredChats' ) ; await db . schema . createTable ( 'ignoredChats' , ( table ) => { table . bigInteger ( 'id' ) . unique ( ) . primary ( ) . index ( ) ; table . string ( 'name' ) ; } ) ; if ( ignoredChats . length !== 0 ) { await db < IgnoreChatInfo > ( 'ignoredChats' ) . insert ( ignoredChats ) ; } await db < DBVersion > ( 'dbVersion' ) . update ( { dbVersion : 4 } ) ; } ; export default upg3to4 ;