import { schemaMigrations } from '@nozbe/watermelondb/Schema/migrations';

export const migrations = schemaMigrations({
  migrations: [
    {
      toVersion: 3,
      steps: [
        {
          type: 'add_columns',
          table: 'messages',
          columns: [
            { name: 'chat_key', type: 'string', isOptional: true },
            { name: 'is_group', type: 'boolean' },
            { name: 'reply_to_id', type: 'number', isOptional: true },
            { name: 'reply_to', type: 'string', isOptional: true },
            { name: 'attachment', type: 'string', isOptional: true },
            { name: 'is_sending', type: 'boolean', isOptional: true },
            { name: 'sent_at', type: 'string' }
          ]
        },
        {
          type: 'add_columns',
          table: 'chats',
          columns: [{ name: 'chat_key', type: 'string', isOptional: true }]
        }
      ]
    }
  ]
});
