InstallSchema.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. /**
  3. * MageSpecialist
  4. *
  5. * NOTICE OF LICENSE
  6. *
  7. * This source file is subject to the Open Software License (OSL 3.0)
  8. * that is bundled with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://opensource.org/licenses/osl-3.0.php
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to info@magespecialist.it so we can send you a copy immediately.
  14. *
  15. * @category MSP
  16. * @package MSP_TwoFactorAuth
  17. * @copyright Copyright (c) 2017 Skeeller srl (http://www.magespecialist.it)
  18. * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
  19. */
  20. namespace MSP\TwoFactorAuth\Setup;
  21. use Magento\Framework\Setup\InstallSchemaInterface;
  22. use Magento\Framework\Setup\ModuleContextInterface;
  23. use Magento\Framework\Setup\SchemaSetupInterface;
  24. use Magento\Framework\DB\Ddl\Table;
  25. class InstallSchema implements InstallSchemaInterface
  26. {
  27. /**
  28. * @param SchemaSetupInterface $setup
  29. * @param ModuleContextInterface $context
  30. * @SuppressWarnings("PHPMD.UnusedFormalParameter")
  31. */
  32. public function install(
  33. SchemaSetupInterface $setup,
  34. ModuleContextInterface $context
  35. ) {
  36. $setup->startSetup();
  37. $connection = $setup->getConnection();
  38. $adminUserTable = $setup->getTable('admin_user');
  39. $connection->addColumn($adminUserTable, 'msp_tfa_enabled', [
  40. 'type' => Table::TYPE_INTEGER,
  41. 'length' => '1',
  42. 'nullable' => false,
  43. 'comment' => 'Two Factor Authentication Enabled',
  44. ]);
  45. $connection->addColumn($adminUserTable, 'msp_tfa_secret', [
  46. 'type' => Table::TYPE_TEXT,
  47. 'nullable' => false,
  48. 'comment' => 'Two Factor Authentication Secret',
  49. ]);
  50. $connection->addColumn($adminUserTable, 'msp_tfa_activated', [
  51. 'type' => Table::TYPE_INTEGER,
  52. 'length' => '1',
  53. 'nullable' => false,
  54. 'comment' => 'Two Factor Authentication Activated',
  55. ]);
  56. $setup->endSetup();
  57. }
  58. }