Advertisement
muhidins

candidates_table

Feb 12th, 2021
317
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. <?php namespace App\Database\Migrations;
  2.  
  3. use CodeIgniter\Database\Migration;
  4.  
  5. class Candidates extends Migration
  6. {
  7. public function up()
  8. {
  9. $this->forge->addField([
  10. 'id' => [
  11. 'type' => 'INT',
  12. 'unsigned' => true,
  13. 'auto_increment' => true,
  14. ],
  15. 'name' => [
  16. 'type' => 'VARCHAR',
  17. 'constraint' => '75',
  18. 'null' => true,
  19. ],
  20. 'number' => [
  21. 'type' => 'VARCHAR',
  22. 'constraint' => '3',
  23. 'null' => true,
  24. ],
  25. 'amount' => [
  26. 'type' => 'INT',
  27. 'unsigned' => true,
  28. 'null' => true,
  29. ],
  30. 'vision' => [
  31. 'type' => 'VARCHAR',
  32. 'constraint' => '255',
  33. 'null' => true,
  34. ],
  35. 'mission' => [
  36. 'type' => 'VARCHAR',
  37. 'constraint' => '255',
  38. 'null' => true,
  39. ],
  40. 'username' => [
  41. 'type' => 'VARCHAR',
  42. 'constraint' => '25',
  43. 'null' => true,
  44. ],
  45. 'password' => [
  46. 'type' => 'VARCHAR',
  47. 'constraint' => '65',
  48. 'null' => true,
  49. ],
  50. 'active' => [
  51. 'type' => 'ENUM',
  52. 'constraint' => ['Y', 'N'],
  53. 'default' => 'N',
  54. ],
  55. 'photo' => [
  56. 'type' => 'VARCHAR',
  57. 'constraint' => '100',
  58. 'null' => true,
  59. ],
  60. ]);
  61. $this->forge->addKey('id', true);
  62. $this->forge->createTable('candidates');
  63. }
  64.  
  65. //--------------------------------------------------------------------
  66.  
  67. public function down()
  68. {
  69. $this->forge->dropTable('candidates');
  70. }
  71. }
  72.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement