module.exports = {
  /**
   * @param {QueryInterface} queryInterface
   * @param {Sequelize} Sequelize
   * @returns {Promise<void>}
   */
  async up(queryInterface, Sequelize) {
    /**
     * @type {Transaction}
     */
    const transaction = await queryInterface.sequelize.transaction();
    try {
      await queryInterface.createTable(
        'users',
        {
          id: {
            type: Sequelize.DataTypes.UUID,
            defaultValue: Sequelize.DataTypes.UUIDV4,
            primaryKey: true,
          },
          createdById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          updatedById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          createdAt: { type: Sequelize.DataTypes.DATE },
          updatedAt: { type: Sequelize.DataTypes.DATE },
          deletedAt: { type: Sequelize.DataTypes.DATE },
          importHash: {
            type: Sequelize.DataTypes.STRING(255),
            allowNull: true,
            unique: true,
          },
        },
        { transaction },
      );

      await queryInterface.createTable(
        'activity_logs',
        {
          id: {
            type: Sequelize.DataTypes.UUID,
            defaultValue: Sequelize.DataTypes.UUIDV4,
            primaryKey: true,
          },
          createdById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          updatedById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          createdAt: { type: Sequelize.DataTypes.DATE },
          updatedAt: { type: Sequelize.DataTypes.DATE },
          deletedAt: { type: Sequelize.DataTypes.DATE },
          importHash: {
            type: Sequelize.DataTypes.STRING(255),
            allowNull: true,
            unique: true,
          },
        },
        { transaction },
      );

      await queryInterface.createTable(
        'assignment_submissions',
        {
          id: {
            type: Sequelize.DataTypes.UUID,
            defaultValue: Sequelize.DataTypes.UUIDV4,
            primaryKey: true,
          },
          createdById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          updatedById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          createdAt: { type: Sequelize.DataTypes.DATE },
          updatedAt: { type: Sequelize.DataTypes.DATE },
          deletedAt: { type: Sequelize.DataTypes.DATE },
          importHash: {
            type: Sequelize.DataTypes.STRING(255),
            allowNull: true,
            unique: true,
          },
        },
        { transaction },
      );

      await queryInterface.createTable(
        'assignments',
        {
          id: {
            type: Sequelize.DataTypes.UUID,
            defaultValue: Sequelize.DataTypes.UUIDV4,
            primaryKey: true,
          },
          createdById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          updatedById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          createdAt: { type: Sequelize.DataTypes.DATE },
          updatedAt: { type: Sequelize.DataTypes.DATE },
          deletedAt: { type: Sequelize.DataTypes.DATE },
          importHash: {
            type: Sequelize.DataTypes.STRING(255),
            allowNull: true,
            unique: true,
          },
        },
        { transaction },
      );

      await queryInterface.createTable(
        'bills',
        {
          id: {
            type: Sequelize.DataTypes.UUID,
            defaultValue: Sequelize.DataTypes.UUIDV4,
            primaryKey: true,
          },
          createdById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          updatedById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          createdAt: { type: Sequelize.DataTypes.DATE },
          updatedAt: { type: Sequelize.DataTypes.DATE },
          deletedAt: { type: Sequelize.DataTypes.DATE },
          importHash: {
            type: Sequelize.DataTypes.STRING(255),
            allowNull: true,
            unique: true,
          },
        },
        { transaction },
      );

      await queryInterface.createTable(
        'class_messages',
        {
          id: {
            type: Sequelize.DataTypes.UUID,
            defaultValue: Sequelize.DataTypes.UUIDV4,
            primaryKey: true,
          },
          createdById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          updatedById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          createdAt: { type: Sequelize.DataTypes.DATE },
          updatedAt: { type: Sequelize.DataTypes.DATE },
          deletedAt: { type: Sequelize.DataTypes.DATE },
          importHash: {
            type: Sequelize.DataTypes.STRING(255),
            allowNull: true,
            unique: true,
          },
        },
        { transaction },
      );

      await queryInterface.createTable(
        'class_subjects',
        {
          id: {
            type: Sequelize.DataTypes.UUID,
            defaultValue: Sequelize.DataTypes.UUIDV4,
            primaryKey: true,
          },
          createdById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          updatedById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          createdAt: { type: Sequelize.DataTypes.DATE },
          updatedAt: { type: Sequelize.DataTypes.DATE },
          deletedAt: { type: Sequelize.DataTypes.DATE },
          importHash: {
            type: Sequelize.DataTypes.STRING(255),
            allowNull: true,
            unique: true,
          },
        },
        { transaction },
      );

      await queryInterface.createTable(
        'classes',
        {
          id: {
            type: Sequelize.DataTypes.UUID,
            defaultValue: Sequelize.DataTypes.UUIDV4,
            primaryKey: true,
          },
          createdById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          updatedById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          createdAt: { type: Sequelize.DataTypes.DATE },
          updatedAt: { type: Sequelize.DataTypes.DATE },
          deletedAt: { type: Sequelize.DataTypes.DATE },
          importHash: {
            type: Sequelize.DataTypes.STRING(255),
            allowNull: true,
            unique: true,
          },
        },
        { transaction },
      );

      await queryInterface.createTable(
        'exam_subjects',
        {
          id: {
            type: Sequelize.DataTypes.UUID,
            defaultValue: Sequelize.DataTypes.UUIDV4,
            primaryKey: true,
          },
          createdById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          updatedById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          createdAt: { type: Sequelize.DataTypes.DATE },
          updatedAt: { type: Sequelize.DataTypes.DATE },
          deletedAt: { type: Sequelize.DataTypes.DATE },
          importHash: {
            type: Sequelize.DataTypes.STRING(255),
            allowNull: true,
            unique: true,
          },
        },
        { transaction },
      );

      await queryInterface.createTable(
        'exams',
        {
          id: {
            type: Sequelize.DataTypes.UUID,
            defaultValue: Sequelize.DataTypes.UUIDV4,
            primaryKey: true,
          },
          createdById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          updatedById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          createdAt: { type: Sequelize.DataTypes.DATE },
          updatedAt: { type: Sequelize.DataTypes.DATE },
          deletedAt: { type: Sequelize.DataTypes.DATE },
          importHash: {
            type: Sequelize.DataTypes.STRING(255),
            allowNull: true,
            unique: true,
          },
        },
        { transaction },
      );

      await queryInterface.createTable(
        'fee_payments',
        {
          id: {
            type: Sequelize.DataTypes.UUID,
            defaultValue: Sequelize.DataTypes.UUIDV4,
            primaryKey: true,
          },
          createdById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          updatedById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          createdAt: { type: Sequelize.DataTypes.DATE },
          updatedAt: { type: Sequelize.DataTypes.DATE },
          deletedAt: { type: Sequelize.DataTypes.DATE },
          importHash: {
            type: Sequelize.DataTypes.STRING(255),
            allowNull: true,
            unique: true,
          },
        },
        { transaction },
      );

      await queryInterface.createTable(
        'fee_structures',
        {
          id: {
            type: Sequelize.DataTypes.UUID,
            defaultValue: Sequelize.DataTypes.UUIDV4,
            primaryKey: true,
          },
          createdById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          updatedById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          createdAt: { type: Sequelize.DataTypes.DATE },
          updatedAt: { type: Sequelize.DataTypes.DATE },
          deletedAt: { type: Sequelize.DataTypes.DATE },
          importHash: {
            type: Sequelize.DataTypes.STRING(255),
            allowNull: true,
            unique: true,
          },
        },
        { transaction },
      );

      await queryInterface.createTable(
        'lesson_plans',
        {
          id: {
            type: Sequelize.DataTypes.UUID,
            defaultValue: Sequelize.DataTypes.UUIDV4,
            primaryKey: true,
          },
          createdById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          updatedById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          createdAt: { type: Sequelize.DataTypes.DATE },
          updatedAt: { type: Sequelize.DataTypes.DATE },
          deletedAt: { type: Sequelize.DataTypes.DATE },
          importHash: {
            type: Sequelize.DataTypes.STRING(255),
            allowNull: true,
            unique: true,
          },
        },
        { transaction },
      );

      await queryInterface.createTable(
        'login_logs',
        {
          id: {
            type: Sequelize.DataTypes.UUID,
            defaultValue: Sequelize.DataTypes.UUIDV4,
            primaryKey: true,
          },
          createdById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          updatedById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          createdAt: { type: Sequelize.DataTypes.DATE },
          updatedAt: { type: Sequelize.DataTypes.DATE },
          deletedAt: { type: Sequelize.DataTypes.DATE },
          importHash: {
            type: Sequelize.DataTypes.STRING(255),
            allowNull: true,
            unique: true,
          },
        },
        { transaction },
      );

      await queryInterface.createTable(
        'marks',
        {
          id: {
            type: Sequelize.DataTypes.UUID,
            defaultValue: Sequelize.DataTypes.UUIDV4,
            primaryKey: true,
          },
          createdById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          updatedById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          createdAt: { type: Sequelize.DataTypes.DATE },
          updatedAt: { type: Sequelize.DataTypes.DATE },
          deletedAt: { type: Sequelize.DataTypes.DATE },
          importHash: {
            type: Sequelize.DataTypes.STRING(255),
            allowNull: true,
            unique: true,
          },
        },
        { transaction },
      );

      await queryInterface.createTable(
        'messages',
        {
          id: {
            type: Sequelize.DataTypes.UUID,
            defaultValue: Sequelize.DataTypes.UUIDV4,
            primaryKey: true,
          },
          createdById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          updatedById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          createdAt: { type: Sequelize.DataTypes.DATE },
          updatedAt: { type: Sequelize.DataTypes.DATE },
          deletedAt: { type: Sequelize.DataTypes.DATE },
          importHash: {
            type: Sequelize.DataTypes.STRING(255),
            allowNull: true,
            unique: true,
          },
        },
        { transaction },
      );

      await queryInterface.createTable(
        'parents',
        {
          id: {
            type: Sequelize.DataTypes.UUID,
            defaultValue: Sequelize.DataTypes.UUIDV4,
            primaryKey: true,
          },
          createdById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          updatedById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          createdAt: { type: Sequelize.DataTypes.DATE },
          updatedAt: { type: Sequelize.DataTypes.DATE },
          deletedAt: { type: Sequelize.DataTypes.DATE },
          importHash: {
            type: Sequelize.DataTypes.STRING(255),
            allowNull: true,
            unique: true,
          },
        },
        { transaction },
      );

      await queryInterface.createTable(
        'period_settings',
        {
          id: {
            type: Sequelize.DataTypes.UUID,
            defaultValue: Sequelize.DataTypes.UUIDV4,
            primaryKey: true,
          },
          createdById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          updatedById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          createdAt: { type: Sequelize.DataTypes.DATE },
          updatedAt: { type: Sequelize.DataTypes.DATE },
          deletedAt: { type: Sequelize.DataTypes.DATE },
          importHash: {
            type: Sequelize.DataTypes.STRING(255),
            allowNull: true,
            unique: true,
          },
        },
        { transaction },
      );

      await queryInterface.createTable(
        'school_admins',
        {
          id: {
            type: Sequelize.DataTypes.UUID,
            defaultValue: Sequelize.DataTypes.UUIDV4,
            primaryKey: true,
          },
          createdById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          updatedById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          createdAt: { type: Sequelize.DataTypes.DATE },
          updatedAt: { type: Sequelize.DataTypes.DATE },
          deletedAt: { type: Sequelize.DataTypes.DATE },
          importHash: {
            type: Sequelize.DataTypes.STRING(255),
            allowNull: true,
            unique: true,
          },
        },
        { transaction },
      );

      await queryInterface.createTable(
        'student_attendance',
        {
          id: {
            type: Sequelize.DataTypes.UUID,
            defaultValue: Sequelize.DataTypes.UUIDV4,
            primaryKey: true,
          },
          createdById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          updatedById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          createdAt: { type: Sequelize.DataTypes.DATE },
          updatedAt: { type: Sequelize.DataTypes.DATE },
          deletedAt: { type: Sequelize.DataTypes.DATE },
          importHash: {
            type: Sequelize.DataTypes.STRING(255),
            allowNull: true,
            unique: true,
          },
        },
        { transaction },
      );

      await queryInterface.createTable(
        'students',
        {
          id: {
            type: Sequelize.DataTypes.UUID,
            defaultValue: Sequelize.DataTypes.UUIDV4,
            primaryKey: true,
          },
          createdById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          updatedById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          createdAt: { type: Sequelize.DataTypes.DATE },
          updatedAt: { type: Sequelize.DataTypes.DATE },
          deletedAt: { type: Sequelize.DataTypes.DATE },
          importHash: {
            type: Sequelize.DataTypes.STRING(255),
            allowNull: true,
            unique: true,
          },
        },
        { transaction },
      );

      await queryInterface.createTable(
        'subjects',
        {
          id: {
            type: Sequelize.DataTypes.UUID,
            defaultValue: Sequelize.DataTypes.UUIDV4,
            primaryKey: true,
          },
          createdById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          updatedById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          createdAt: { type: Sequelize.DataTypes.DATE },
          updatedAt: { type: Sequelize.DataTypes.DATE },
          deletedAt: { type: Sequelize.DataTypes.DATE },
          importHash: {
            type: Sequelize.DataTypes.STRING(255),
            allowNull: true,
            unique: true,
          },
        },
        { transaction },
      );

      await queryInterface.createTable(
        'teacher_attendance',
        {
          id: {
            type: Sequelize.DataTypes.UUID,
            defaultValue: Sequelize.DataTypes.UUIDV4,
            primaryKey: true,
          },
          createdById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          updatedById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          createdAt: { type: Sequelize.DataTypes.DATE },
          updatedAt: { type: Sequelize.DataTypes.DATE },
          deletedAt: { type: Sequelize.DataTypes.DATE },
          importHash: {
            type: Sequelize.DataTypes.STRING(255),
            allowNull: true,
            unique: true,
          },
        },
        { transaction },
      );

      await queryInterface.createTable(
        'teachers',
        {
          id: {
            type: Sequelize.DataTypes.UUID,
            defaultValue: Sequelize.DataTypes.UUIDV4,
            primaryKey: true,
          },
          createdById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          updatedById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          createdAt: { type: Sequelize.DataTypes.DATE },
          updatedAt: { type: Sequelize.DataTypes.DATE },
          deletedAt: { type: Sequelize.DataTypes.DATE },
          importHash: {
            type: Sequelize.DataTypes.STRING(255),
            allowNull: true,
            unique: true,
          },
        },
        { transaction },
      );

      await queryInterface.createTable(
        'timetables',
        {
          id: {
            type: Sequelize.DataTypes.UUID,
            defaultValue: Sequelize.DataTypes.UUIDV4,
            primaryKey: true,
          },
          createdById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          updatedById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          createdAt: { type: Sequelize.DataTypes.DATE },
          updatedAt: { type: Sequelize.DataTypes.DATE },
          deletedAt: { type: Sequelize.DataTypes.DATE },
          importHash: {
            type: Sequelize.DataTypes.STRING(255),
            allowNull: true,
            unique: true,
          },
        },
        { transaction },
      );

      await queryInterface.createTable(
        'roles',
        {
          id: {
            type: Sequelize.DataTypes.UUID,
            defaultValue: Sequelize.DataTypes.UUIDV4,
            primaryKey: true,
          },
          createdById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          updatedById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          createdAt: { type: Sequelize.DataTypes.DATE },
          updatedAt: { type: Sequelize.DataTypes.DATE },
          deletedAt: { type: Sequelize.DataTypes.DATE },
          importHash: {
            type: Sequelize.DataTypes.STRING(255),
            allowNull: true,
            unique: true,
          },
        },
        { transaction },
      );

      await queryInterface.createTable(
        'permissions',
        {
          id: {
            type: Sequelize.DataTypes.UUID,
            defaultValue: Sequelize.DataTypes.UUIDV4,
            primaryKey: true,
          },
          createdById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          updatedById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          createdAt: { type: Sequelize.DataTypes.DATE },
          updatedAt: { type: Sequelize.DataTypes.DATE },
          deletedAt: { type: Sequelize.DataTypes.DATE },
          importHash: {
            type: Sequelize.DataTypes.STRING(255),
            allowNull: true,
            unique: true,
          },
        },
        { transaction },
      );

      await queryInterface.createTable(
        'schools',
        {
          id: {
            type: Sequelize.DataTypes.UUID,
            defaultValue: Sequelize.DataTypes.UUIDV4,
            primaryKey: true,
          },
          createdById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          updatedById: {
            type: Sequelize.DataTypes.UUID,
            references: {
              key: 'id',
              model: 'users',
            },
          },
          createdAt: { type: Sequelize.DataTypes.DATE },
          updatedAt: { type: Sequelize.DataTypes.DATE },
          deletedAt: { type: Sequelize.DataTypes.DATE },
          importHash: {
            type: Sequelize.DataTypes.STRING(255),
            allowNull: true,
            unique: true,
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'users',
        'firstName',
        {
          type: Sequelize.DataTypes.TEXT,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'users',
        'lastName',
        {
          type: Sequelize.DataTypes.TEXT,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'users',
        'phoneNumber',
        {
          type: Sequelize.DataTypes.TEXT,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'users',
        'email',
        {
          type: Sequelize.DataTypes.TEXT,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'users',
        'disabled',
        {
          type: Sequelize.DataTypes.BOOLEAN,

          defaultValue: false,
          allowNull: false,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'users',
        'password',
        {
          type: Sequelize.DataTypes.TEXT,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'users',
        'emailVerified',
        {
          type: Sequelize.DataTypes.BOOLEAN,

          defaultValue: false,
          allowNull: false,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'users',
        'emailVerificationToken',
        {
          type: Sequelize.DataTypes.TEXT,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'users',
        'emailVerificationTokenExpiresAt',
        {
          type: Sequelize.DataTypes.DATE,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'users',
        'passwordResetToken',
        {
          type: Sequelize.DataTypes.TEXT,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'users',
        'passwordResetTokenExpiresAt',
        {
          type: Sequelize.DataTypes.DATE,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'users',
        'provider',
        {
          type: Sequelize.DataTypes.TEXT,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'activity_logs',
        'userId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'users',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'activity_logs',
        'action',
        {
          type: Sequelize.DataTypes.TEXT,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'activity_logs',
        'entity_type',
        {
          type: Sequelize.DataTypes.TEXT,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'activity_logs',
        'entity_id',
        {
          type: Sequelize.DataTypes.INTEGER,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'activity_logs',
        'timestamp',
        {
          type: Sequelize.DataTypes.DATE,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'assignment_submissions',
        'assignmentId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'assignments',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'assignment_submissions',
        'studentId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'students',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'assignment_submissions',
        'submission_date',
        {
          type: Sequelize.DataTypes.DATE,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'assignment_submissions',
        'content',
        {
          type: Sequelize.DataTypes.TEXT,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'assignment_submissions',
        'grade',
        {
          type: Sequelize.DataTypes.DECIMAL,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'assignment_submissions',
        'feedback',
        {
          type: Sequelize.DataTypes.TEXT,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'assignments',
        'teacherId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'teachers',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'assignments',
        'subjectId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'subjects',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'assignments',
        'title',
        {
          type: Sequelize.DataTypes.TEXT,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'assignments',
        'description',
        {
          type: Sequelize.DataTypes.TEXT,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'assignments',
        'due_date',
        {
          type: Sequelize.DataTypes.DATE,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'assignments',
        'attachment_url',
        {
          type: Sequelize.DataTypes.TEXT,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'bills',
        'schoolId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'schools',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'bills',
        'title',
        {
          type: Sequelize.DataTypes.TEXT,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'bills',
        'amount',
        {
          type: Sequelize.DataTypes.DECIMAL,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'bills',
        'bill_month',
        {
          type: Sequelize.DataTypes.TEXT,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'bills',
        'category',
        {
          type: Sequelize.DataTypes.TEXT,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'bills',
        'upload_url',
        {
          type: Sequelize.DataTypes.TEXT,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'bills',
        'status',
        {
          type: Sequelize.DataTypes.ENUM,

          values: ['pending', 'paid', 'overdue'],
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'class_messages',
        'senderId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'users',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'class_messages',
        'content',
        {
          type: Sequelize.DataTypes.TEXT,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'class_subjects',
        'subjectId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'subjects',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'class_subjects',
        'teacherId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'teachers',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'classes',
        'schoolId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'schools',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'classes',
        'name',
        {
          type: Sequelize.DataTypes.TEXT,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'classes',
        'section',
        {
          type: Sequelize.DataTypes.TEXT,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'classes',
        'class_teacherId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'teachers',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'exam_subjects',
        'examId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'exams',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'exam_subjects',
        'subjectId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'subjects',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'exam_subjects',
        'exam_date',
        {
          type: Sequelize.DataTypes.DATE,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'exam_subjects',
        'max_marks',
        {
          type: Sequelize.DataTypes.DECIMAL,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'exams',
        'schoolId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'schools',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'exams',
        'title',
        {
          type: Sequelize.DataTypes.TEXT,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'exams',
        'start_date',
        {
          type: Sequelize.DataTypes.DATE,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'exams',
        'end_date',
        {
          type: Sequelize.DataTypes.DATE,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'exams',
        'term',
        {
          type: Sequelize.DataTypes.TEXT,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'fee_payments',
        'studentId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'students',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'fee_payments',
        'amount_paid',
        {
          type: Sequelize.DataTypes.DECIMAL,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'fee_payments',
        'payment_date',
        {
          type: Sequelize.DataTypes.DATE,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'fee_payments',
        'receipt_url',
        {
          type: Sequelize.DataTypes.TEXT,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'fee_payments',
        'term',
        {
          type: Sequelize.DataTypes.TEXT,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'fee_payments',
        'status',
        {
          type: Sequelize.DataTypes.ENUM,

          values: ['pending', 'completed', 'failed'],
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'fee_structures',
        'schoolId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'schools',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'fee_structures',
        'term',
        {
          type: Sequelize.DataTypes.TEXT,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'fee_structures',
        'amount',
        {
          type: Sequelize.DataTypes.DECIMAL,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'lesson_plans',
        'teacherId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'teachers',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'lesson_plans',
        'subjectId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'subjects',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'lesson_plans',
        'week_start_date',
        {
          type: Sequelize.DataTypes.DATE,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'lesson_plans',
        'plan_content',
        {
          type: Sequelize.DataTypes.TEXT,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'lesson_plans',
        'status',
        {
          type: Sequelize.DataTypes.ENUM,

          values: ['draft', 'submitted', 'approved'],
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'login_logs',
        'userId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'users',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'login_logs',
        'login_time',
        {
          type: Sequelize.DataTypes.DATE,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'login_logs',
        'ip_address',
        {
          type: Sequelize.DataTypes.TEXT,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'login_logs',
        'device_info',
        {
          type: Sequelize.DataTypes.TEXT,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'marks',
        'studentId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'students',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'marks',
        'exam_subjectId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'exam_subjects',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'marks',
        'marks_obtained',
        {
          type: Sequelize.DataTypes.DECIMAL,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'messages',
        'senderId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'users',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'messages',
        'receiver_role',
        {
          type: Sequelize.DataTypes.ENUM,

          values: [
            'super_admin',
            'school_admin',
            'teacher',
            'student',
            'parent',
          ],
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'messages',
        'receiverId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'users',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'messages',
        'schoolId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'schools',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'messages',
        'message_type',
        {
          type: Sequelize.DataTypes.ENUM,

          values: ['text', 'announcement', 'alert'],
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'messages',
        'content',
        {
          type: Sequelize.DataTypes.TEXT,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'parents',
        'userId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'users',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'parents',
        'full_name',
        {
          type: Sequelize.DataTypes.TEXT,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'parents',
        'phone_number',
        {
          type: Sequelize.DataTypes.TEXT,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'parents',
        'address',
        {
          type: Sequelize.DataTypes.TEXT,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'period_settings',
        'schoolId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'schools',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'period_settings',
        'total_periods_per_day',
        {
          type: Sequelize.DataTypes.INTEGER,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'period_settings',
        'period_duration',
        {
          type: Sequelize.DataTypes.INTEGER,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'school_admins',
        'userId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'users',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'school_admins',
        'schoolId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'schools',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'school_admins',
        'full_name',
        {
          type: Sequelize.DataTypes.TEXT,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'school_admins',
        'phone_number',
        {
          type: Sequelize.DataTypes.TEXT,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'student_attendance',
        'studentId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'students',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'student_attendance',
        'date',
        {
          type: Sequelize.DataTypes.DATE,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'student_attendance',
        'status',
        {
          type: Sequelize.DataTypes.ENUM,

          values: ['present', 'absent', 'late'],
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'student_attendance',
        'marked_byId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'teachers',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'students',
        'userId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'users',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'students',
        'schoolId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'schools',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'students',
        'full_name',
        {
          type: Sequelize.DataTypes.TEXT,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'students',
        'dob',
        {
          type: Sequelize.DataTypes.DATE,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'students',
        'gender',
        {
          type: Sequelize.DataTypes.ENUM,

          values: ['male', 'female', 'other'],
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'students',
        'admission_date',
        {
          type: Sequelize.DataTypes.DATE,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'students',
        'parentId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'parents',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'subjects',
        'schoolId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'schools',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'subjects',
        'name',
        {
          type: Sequelize.DataTypes.TEXT,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'teacher_attendance',
        'teacherId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'teachers',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'teacher_attendance',
        'schoolId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'schools',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'teacher_attendance',
        'date',
        {
          type: Sequelize.DataTypes.DATE,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'teacher_attendance',
        'status',
        {
          type: Sequelize.DataTypes.ENUM,

          values: ['present', 'absent', 'late'],
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'teachers',
        'userId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'users',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'teachers',
        'schoolId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'schools',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'teachers',
        'full_name',
        {
          type: Sequelize.DataTypes.TEXT,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'teachers',
        'subject_specialization',
        {
          type: Sequelize.DataTypes.TEXT,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'teachers',
        'phone_number',
        {
          type: Sequelize.DataTypes.TEXT,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'teachers',
        'joining_date',
        {
          type: Sequelize.DataTypes.DATE,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'timetables',
        'day_of_week',
        {
          type: Sequelize.DataTypes.ENUM,

          values: [
            'Monday',
            'Tuesday',
            'Wednesday',
            'Thursday',
            'Friday',
            'Saturday',
            'Sunday',
          ],
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'timetables',
        'period_number',
        {
          type: Sequelize.DataTypes.INTEGER,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'timetables',
        'subjectId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'subjects',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'timetables',
        'teacherId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'teachers',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'permissions',
        'name',
        {
          type: Sequelize.DataTypes.TEXT,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'roles',
        'name',
        {
          type: Sequelize.DataTypes.TEXT,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'roles',
        'role_customization',
        {
          type: Sequelize.DataTypes.TEXT,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'users',
        'app_roleId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'roles',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'schools',
        'name',
        {
          type: Sequelize.DataTypes.TEXT,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'roles',
        'globalAccess',
        {
          type: Sequelize.DataTypes.BOOLEAN,

          defaultValue: false,
          allowNull: false,
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'users',
        'schoolsId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'schools',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'activity_logs',
        'schoolsId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'schools',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'assignment_submissions',
        'schoolsId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'schools',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'assignments',
        'schoolsId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'schools',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'bills',
        'schoolsId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'schools',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'class_messages',
        'schoolsId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'schools',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'class_subjects',
        'schoolsId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'schools',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'classes',
        'schoolsId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'schools',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'exam_subjects',
        'schoolsId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'schools',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'exams',
        'schoolsId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'schools',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'fee_payments',
        'schoolsId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'schools',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'fee_structures',
        'schoolsId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'schools',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'lesson_plans',
        'schoolsId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'schools',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'login_logs',
        'schoolsId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'schools',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'marks',
        'schoolsId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'schools',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'messages',
        'schoolsId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'schools',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'parents',
        'schoolsId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'schools',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'period_settings',
        'schoolsId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'schools',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'school_admins',
        'schoolsId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'schools',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'student_attendance',
        'schoolsId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'schools',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'students',
        'schoolsId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'schools',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'subjects',
        'schoolsId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'schools',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'teacher_attendance',
        'schoolsId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'schools',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'teachers',
        'schoolsId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'schools',
            key: 'id',
          },
        },
        { transaction },
      );

      await queryInterface.addColumn(
        'timetables',
        'schoolsId',
        {
          type: Sequelize.DataTypes.UUID,

          references: {
            model: 'schools',
            key: 'id',
          },
        },
        { transaction },
      );

      await transaction.commit();
    } catch (err) {
      await transaction.rollback();
      throw err;
    }
  },
  /**
   * @param {QueryInterface} queryInterface
   * @param {Sequelize} Sequelize
   * @returns {Promise<void>}
   */
  async down(queryInterface, Sequelize) {
    /**
     * @type {Transaction}
     */
    const transaction = await queryInterface.sequelize.transaction();
    try {
      await queryInterface.removeColumn('timetables', 'schoolsId', {
        transaction,
      });

      await queryInterface.removeColumn('teachers', 'schoolsId', {
        transaction,
      });

      await queryInterface.removeColumn('teacher_attendance', 'schoolsId', {
        transaction,
      });

      await queryInterface.removeColumn('subjects', 'schoolsId', {
        transaction,
      });

      await queryInterface.removeColumn('students', 'schoolsId', {
        transaction,
      });

      await queryInterface.removeColumn('student_attendance', 'schoolsId', {
        transaction,
      });

      await queryInterface.removeColumn('school_admins', 'schoolsId', {
        transaction,
      });

      await queryInterface.removeColumn('period_settings', 'schoolsId', {
        transaction,
      });

      await queryInterface.removeColumn('parents', 'schoolsId', {
        transaction,
      });

      await queryInterface.removeColumn('messages', 'schoolsId', {
        transaction,
      });

      await queryInterface.removeColumn('marks', 'schoolsId', { transaction });

      await queryInterface.removeColumn('login_logs', 'schoolsId', {
        transaction,
      });

      await queryInterface.removeColumn('lesson_plans', 'schoolsId', {
        transaction,
      });

      await queryInterface.removeColumn('fee_structures', 'schoolsId', {
        transaction,
      });

      await queryInterface.removeColumn('fee_payments', 'schoolsId', {
        transaction,
      });

      await queryInterface.removeColumn('exams', 'schoolsId', { transaction });

      await queryInterface.removeColumn('exam_subjects', 'schoolsId', {
        transaction,
      });

      await queryInterface.removeColumn('classes', 'schoolsId', {
        transaction,
      });

      await queryInterface.removeColumn('class_subjects', 'schoolsId', {
        transaction,
      });

      await queryInterface.removeColumn('class_messages', 'schoolsId', {
        transaction,
      });

      await queryInterface.removeColumn('bills', 'schoolsId', { transaction });

      await queryInterface.removeColumn('assignments', 'schoolsId', {
        transaction,
      });

      await queryInterface.removeColumn('assignment_submissions', 'schoolsId', {
        transaction,
      });

      await queryInterface.removeColumn('activity_logs', 'schoolsId', {
        transaction,
      });

      await queryInterface.removeColumn('users', 'schoolsId', { transaction });

      await queryInterface.removeColumn('roles', 'globalAccess', {
        transaction,
      });

      await queryInterface.removeColumn('schools', 'name', { transaction });

      await queryInterface.removeColumn('users', 'app_roleId', { transaction });

      await queryInterface.removeColumn('roles', 'role_customization', {
        transaction,
      });

      await queryInterface.removeColumn('roles', 'name', { transaction });

      await queryInterface.removeColumn('permissions', 'name', { transaction });

      await queryInterface.removeColumn('timetables', 'teacherId', {
        transaction,
      });

      await queryInterface.removeColumn('timetables', 'subjectId', {
        transaction,
      });

      await queryInterface.removeColumn('timetables', 'period_number', {
        transaction,
      });

      await queryInterface.removeColumn('timetables', 'day_of_week', {
        transaction,
      });

      await queryInterface.removeColumn('teachers', 'joining_date', {
        transaction,
      });

      await queryInterface.removeColumn('teachers', 'phone_number', {
        transaction,
      });

      await queryInterface.removeColumn('teachers', 'subject_specialization', {
        transaction,
      });

      await queryInterface.removeColumn('teachers', 'full_name', {
        transaction,
      });

      await queryInterface.removeColumn('teachers', 'schoolId', {
        transaction,
      });

      await queryInterface.removeColumn('teachers', 'userId', { transaction });

      await queryInterface.removeColumn('teacher_attendance', 'status', {
        transaction,
      });

      await queryInterface.removeColumn('teacher_attendance', 'date', {
        transaction,
      });

      await queryInterface.removeColumn('teacher_attendance', 'schoolId', {
        transaction,
      });

      await queryInterface.removeColumn('teacher_attendance', 'teacherId', {
        transaction,
      });

      await queryInterface.removeColumn('subjects', 'name', { transaction });

      await queryInterface.removeColumn('subjects', 'schoolId', {
        transaction,
      });

      await queryInterface.removeColumn('students', 'parentId', {
        transaction,
      });

      await queryInterface.removeColumn('students', 'admission_date', {
        transaction,
      });

      await queryInterface.removeColumn('students', 'gender', { transaction });

      await queryInterface.removeColumn('students', 'dob', { transaction });

      await queryInterface.removeColumn('students', 'full_name', {
        transaction,
      });

      await queryInterface.removeColumn('students', 'schoolId', {
        transaction,
      });

      await queryInterface.removeColumn('students', 'userId', { transaction });

      await queryInterface.removeColumn('student_attendance', 'marked_byId', {
        transaction,
      });

      await queryInterface.removeColumn('student_attendance', 'status', {
        transaction,
      });

      await queryInterface.removeColumn('student_attendance', 'date', {
        transaction,
      });

      await queryInterface.removeColumn('student_attendance', 'studentId', {
        transaction,
      });

      await queryInterface.removeColumn('school_admins', 'phone_number', {
        transaction,
      });

      await queryInterface.removeColumn('school_admins', 'full_name', {
        transaction,
      });

      await queryInterface.removeColumn('school_admins', 'schoolId', {
        transaction,
      });

      await queryInterface.removeColumn('school_admins', 'userId', {
        transaction,
      });

      await queryInterface.removeColumn('period_settings', 'period_duration', {
        transaction,
      });

      await queryInterface.removeColumn(
        'period_settings',
        'total_periods_per_day',
        { transaction },
      );

      await queryInterface.removeColumn('period_settings', 'schoolId', {
        transaction,
      });

      await queryInterface.removeColumn('parents', 'address', { transaction });

      await queryInterface.removeColumn('parents', 'phone_number', {
        transaction,
      });

      await queryInterface.removeColumn('parents', 'full_name', {
        transaction,
      });

      await queryInterface.removeColumn('parents', 'userId', { transaction });

      await queryInterface.removeColumn('messages', 'content', { transaction });

      await queryInterface.removeColumn('messages', 'message_type', {
        transaction,
      });

      await queryInterface.removeColumn('messages', 'schoolId', {
        transaction,
      });

      await queryInterface.removeColumn('messages', 'receiverId', {
        transaction,
      });

      await queryInterface.removeColumn('messages', 'receiver_role', {
        transaction,
      });

      await queryInterface.removeColumn('messages', 'senderId', {
        transaction,
      });

      await queryInterface.removeColumn('marks', 'marks_obtained', {
        transaction,
      });

      await queryInterface.removeColumn('marks', 'exam_subjectId', {
        transaction,
      });

      await queryInterface.removeColumn('marks', 'studentId', { transaction });

      await queryInterface.removeColumn('login_logs', 'device_info', {
        transaction,
      });

      await queryInterface.removeColumn('login_logs', 'ip_address', {
        transaction,
      });

      await queryInterface.removeColumn('login_logs', 'login_time', {
        transaction,
      });

      await queryInterface.removeColumn('login_logs', 'userId', {
        transaction,
      });

      await queryInterface.removeColumn('lesson_plans', 'status', {
        transaction,
      });

      await queryInterface.removeColumn('lesson_plans', 'plan_content', {
        transaction,
      });

      await queryInterface.removeColumn('lesson_plans', 'week_start_date', {
        transaction,
      });

      await queryInterface.removeColumn('lesson_plans', 'subjectId', {
        transaction,
      });

      await queryInterface.removeColumn('lesson_plans', 'teacherId', {
        transaction,
      });

      await queryInterface.removeColumn('fee_structures', 'amount', {
        transaction,
      });

      await queryInterface.removeColumn('fee_structures', 'term', {
        transaction,
      });

      await queryInterface.removeColumn('fee_structures', 'schoolId', {
        transaction,
      });

      await queryInterface.removeColumn('fee_payments', 'status', {
        transaction,
      });

      await queryInterface.removeColumn('fee_payments', 'term', {
        transaction,
      });

      await queryInterface.removeColumn('fee_payments', 'receipt_url', {
        transaction,
      });

      await queryInterface.removeColumn('fee_payments', 'payment_date', {
        transaction,
      });

      await queryInterface.removeColumn('fee_payments', 'amount_paid', {
        transaction,
      });

      await queryInterface.removeColumn('fee_payments', 'studentId', {
        transaction,
      });

      await queryInterface.removeColumn('exams', 'term', { transaction });

      await queryInterface.removeColumn('exams', 'end_date', { transaction });

      await queryInterface.removeColumn('exams', 'start_date', { transaction });

      await queryInterface.removeColumn('exams', 'title', { transaction });

      await queryInterface.removeColumn('exams', 'schoolId', { transaction });

      await queryInterface.removeColumn('exam_subjects', 'max_marks', {
        transaction,
      });

      await queryInterface.removeColumn('exam_subjects', 'exam_date', {
        transaction,
      });

      await queryInterface.removeColumn('exam_subjects', 'subjectId', {
        transaction,
      });

      await queryInterface.removeColumn('exam_subjects', 'examId', {
        transaction,
      });

      await queryInterface.removeColumn('classes', 'class_teacherId', {
        transaction,
      });

      await queryInterface.removeColumn('classes', 'section', { transaction });

      await queryInterface.removeColumn('classes', 'name', { transaction });

      await queryInterface.removeColumn('classes', 'schoolId', { transaction });

      await queryInterface.removeColumn('class_subjects', 'teacherId', {
        transaction,
      });

      await queryInterface.removeColumn('class_subjects', 'subjectId', {
        transaction,
      });

      await queryInterface.removeColumn('class_messages', 'content', {
        transaction,
      });

      await queryInterface.removeColumn('class_messages', 'senderId', {
        transaction,
      });

      await queryInterface.removeColumn('bills', 'status', { transaction });

      await queryInterface.removeColumn('bills', 'upload_url', { transaction });

      await queryInterface.removeColumn('bills', 'category', { transaction });

      await queryInterface.removeColumn('bills', 'bill_month', { transaction });

      await queryInterface.removeColumn('bills', 'amount', { transaction });

      await queryInterface.removeColumn('bills', 'title', { transaction });

      await queryInterface.removeColumn('bills', 'schoolId', { transaction });

      await queryInterface.removeColumn('assignments', 'attachment_url', {
        transaction,
      });

      await queryInterface.removeColumn('assignments', 'due_date', {
        transaction,
      });

      await queryInterface.removeColumn('assignments', 'description', {
        transaction,
      });

      await queryInterface.removeColumn('assignments', 'title', {
        transaction,
      });

      await queryInterface.removeColumn('assignments', 'subjectId', {
        transaction,
      });

      await queryInterface.removeColumn('assignments', 'teacherId', {
        transaction,
      });

      await queryInterface.removeColumn('assignment_submissions', 'feedback', {
        transaction,
      });

      await queryInterface.removeColumn('assignment_submissions', 'grade', {
        transaction,
      });

      await queryInterface.removeColumn('assignment_submissions', 'content', {
        transaction,
      });

      await queryInterface.removeColumn(
        'assignment_submissions',
        'submission_date',
        { transaction },
      );

      await queryInterface.removeColumn('assignment_submissions', 'studentId', {
        transaction,
      });

      await queryInterface.removeColumn(
        'assignment_submissions',
        'assignmentId',
        { transaction },
      );

      await queryInterface.removeColumn('activity_logs', 'timestamp', {
        transaction,
      });

      await queryInterface.removeColumn('activity_logs', 'entity_id', {
        transaction,
      });

      await queryInterface.removeColumn('activity_logs', 'entity_type', {
        transaction,
      });

      await queryInterface.removeColumn('activity_logs', 'action', {
        transaction,
      });

      await queryInterface.removeColumn('activity_logs', 'userId', {
        transaction,
      });

      await queryInterface.removeColumn('users', 'provider', { transaction });

      await queryInterface.removeColumn(
        'users',
        'passwordResetTokenExpiresAt',
        { transaction },
      );

      await queryInterface.removeColumn('users', 'passwordResetToken', {
        transaction,
      });

      await queryInterface.removeColumn(
        'users',
        'emailVerificationTokenExpiresAt',
        { transaction },
      );

      await queryInterface.removeColumn('users', 'emailVerificationToken', {
        transaction,
      });

      await queryInterface.removeColumn('users', 'emailVerified', {
        transaction,
      });

      await queryInterface.removeColumn('users', 'password', { transaction });

      await queryInterface.removeColumn('users', 'disabled', { transaction });

      await queryInterface.removeColumn('users', 'email', { transaction });

      await queryInterface.removeColumn('users', 'phoneNumber', {
        transaction,
      });

      await queryInterface.removeColumn('users', 'lastName', { transaction });

      await queryInterface.removeColumn('users', 'firstName', { transaction });

      await queryInterface.dropTable('schools', { transaction });

      await queryInterface.dropTable('permissions', { transaction });

      await queryInterface.dropTable('roles', { transaction });

      await queryInterface.dropTable('timetables', { transaction });

      await queryInterface.dropTable('teachers', { transaction });

      await queryInterface.dropTable('teacher_attendance', { transaction });

      await queryInterface.dropTable('subjects', { transaction });

      await queryInterface.dropTable('students', { transaction });

      await queryInterface.dropTable('student_attendance', { transaction });

      await queryInterface.dropTable('school_admins', { transaction });

      await queryInterface.dropTable('period_settings', { transaction });

      await queryInterface.dropTable('parents', { transaction });

      await queryInterface.dropTable('messages', { transaction });

      await queryInterface.dropTable('marks', { transaction });

      await queryInterface.dropTable('login_logs', { transaction });

      await queryInterface.dropTable('lesson_plans', { transaction });

      await queryInterface.dropTable('fee_structures', { transaction });

      await queryInterface.dropTable('fee_payments', { transaction });

      await queryInterface.dropTable('exams', { transaction });

      await queryInterface.dropTable('exam_subjects', { transaction });

      await queryInterface.dropTable('classes', { transaction });

      await queryInterface.dropTable('class_subjects', { transaction });

      await queryInterface.dropTable('class_messages', { transaction });

      await queryInterface.dropTable('bills', { transaction });

      await queryInterface.dropTable('assignments', { transaction });

      await queryInterface.dropTable('assignment_submissions', { transaction });

      await queryInterface.dropTable('activity_logs', { transaction });

      await queryInterface.dropTable('users', { transaction });

      await transaction.commit();
    } catch (err) {
      await transaction.rollback();
      throw err;
    }
  },
};
