M_build_database_structure

The Membership 2 M build database structure function.

Description

M_build_database_structure(); 

Usage

  1. if ( !function_exists( 'M_build_database_structure' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'membership-2/app_old/membershipincludes/classes/upgrade.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = M_build_database_structure(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/app_old/membershipincludes/classes/upgrade.php  
  1. function M_build_database_structure() { 
  2.  
  3. global $wpdb; 
  4.  
  5. $bi = 'bigint(20)'; 
  6. $biu = 'bigint(20) unsigned'; 
  7. $bi11 = 'bigint(11)'; 
  8. $bi35 = 'bigint(35)'; 
  9. $i = 'int(11)'; 
  10. $v1 = 'varchar(1)'; 
  11. $v5 = 'varchar(5)'; 
  12. $v10 = 'varchar(10)'; 
  13. $v30 = 'varchar(30)'; 
  14. $v35 = 'varchar(35)'; 
  15. $v50 = 'varchar(50)'; 
  16. $v20 = 'varchar(20)'; 
  17. $v200 = 'varchar(200)'; 
  18. $v250 = 'varchar(250)'; 
  19. $t = 'text'; 
  20. $jd = 'date'; 
  21. $d = 'datetime'; 
  22. $ts = 'timestamp'; 
  23. $dc = 'decimal(11, 2)'; 
  24.  
  25. $structure = array( membership_db_prefix($wpdb, 'membership_levels') => array( 'id' => $bi,  
  26. 'level_title' => $v250,  
  27. 'level_slug' => $v250,  
  28. 'level_active' => $i,  
  29. 'level_count' => $bi 
  30. ),  
  31. membership_db_prefix($wpdb, 'membership_relationships') => array( 'rel_id' => $bi,  
  32. 'user_id' => $bi,  
  33. 'sub_id' => $bi,  
  34. 'level_id' => $bi,  
  35. 'startdate' => $d,  
  36. 'updateddate' => $d,  
  37. 'expirydate' => $d,  
  38. 'order_instance' => $bi,  
  39. 'usinggateway' => $v50 
  40. ),  
  41. membership_db_prefix($wpdb, 'membership_rules') => array( 'level_id' => $bi,  
  42. 'rule_ive' => $v20,  
  43. 'rule_area' => $v20,  
  44. 'rule_value' => $t,  
  45. 'rule_order' => $i 
  46. ),  
  47. membership_db_prefix($wpdb, 'subscriptions') => array( 'id' => $bi,  
  48. 'sub_name' => $v200,  
  49. 'sub_active' => $i,  
  50. 'sub_public' => $i,  
  51. 'sub_count' => $bi,  
  52. 'sub_description' => $t,  
  53. 'sub_pricetext' => $v200 
  54. ),  
  55. membership_db_prefix($wpdb, 'subscriptions_levels') => array( 'sub_id' => $bi,  
  56. 'level_id' => $bi,  
  57. 'level_period' => $i,  
  58. 'sub_type' => $v20,  
  59. 'level_price' => $dc,  
  60. 'level_currency' => $v5,  
  61. 'level_order' => $bi,  
  62. 'level_period_unit' => $v1 
  63. ),  
  64. membership_db_prefix($wpdb, 'subscription_transaction') => array( 'transaction_ID' => $biu,  
  65. 'transaction_subscription_ID' => $bi,  
  66. 'transaction_user_ID' => $bi,  
  67. 'transaction_sub_ID' => $bi,  
  68. 'transaction_paypal_ID' => $v30,  
  69. 'transaction_payment_type' => $v20,  
  70. 'transaction_stamp' => $bi35,  
  71. 'transaction_total_amount' => $bi,  
  72. 'transaction_currency' => $v35,  
  73. 'transaction_duedate' => $jd,  
  74. 'transaction_gateway' => $v50,  
  75. 'transaction_note' => $t,  
  76. 'transaction_expires' => $d 
  77. ),  
  78. membership_db_prefix($wpdb, 'urlgroups') => array( 'id' => $bi,  
  79. 'groupname' => $v250,  
  80. 'groupurls' => $t,  
  81. 'isregexp' => $i,  
  82. 'stripquerystring' => $i 
  83. ),  
  84. membership_db_prefix($wpdb, 'communications') => array( 'id' => $bi11,  
  85. 'subject' => $v250,  
  86. 'message' => $t,  
  87. 'periodunit' => $i,  
  88. 'periodtype' => $v5,  
  89. 'periodprepost' => $v5,  
  90. 'lastupdated' => $ts,  
  91. 'active' => $i,  
  92. 'periodstamp' => $bi 
  93. ),  
  94. membership_db_prefix($wpdb, 'pings') => array( 'id' => $bi,  
  95. 'pingname' => $v250,  
  96. 'pingurl' => $v250,  
  97. 'pinginfo' => $t,  
  98. 'pingtype' => $v10 
  99. ),  
  100. membership_db_prefix($wpdb, 'ping_history') => array( 'id' => $bi,  
  101. 'ping_id' => $bi,  
  102. 'ping_sent' => $ts,  
  103. 'ping_info' => $t,  
  104. 'ping_return' => $t 
  105. ),  
  106. membership_db_prefix($wpdb, 'levelmeta') => array( 'id' => $bi,  
  107. 'level_id' => $bi,  
  108. 'meta_key' => $v250,  
  109. 'meta_value' => $t,  
  110. 'meta_stamp' => $ts 
  111. ),  
  112. membership_db_prefix($wpdb, 'subscriptionmeta') => array( 'id' => $bi,  
  113. 'sub_id' => $bi,  
  114. 'meta_key' => $v250,  
  115. 'meta_value' => $t,  
  116. 'meta_stamp' => $ts 
  117. ),  
  118. membership_db_prefix($wpdb, 'member_payments') => array( 'id' => $bi11,  
  119. 'member_id' => $bi,  
  120. 'sub_id' => $bi,  
  121. 'level_id' => $bi,  
  122. 'level_order' => $i,  
  123. 'paymentmade' => $d,  
  124. 'paymentexpires' => $d 
  125. ),  
  126. membership_db_prefix($wpdb, 'coupons') => array( 'id' => $biu,  
  127. 'site_id' => $bi,  
  128. 'couponcode' => $v250,  
  129. 'discount' => $dc,  
  130. 'discount_type' => $v5,  
  131. 'discount_currency' => $v5,  
  132. 'coupon_startdate' => $d,  
  133. 'coupon_enddate' => $d,  
  134. 'coupon_sub_id' => $bi,  
  135. 'coupon_uses' => $i,  
  136. 'coupon_used' => $i,  
  137. 'coupon_apply_to' => $v20 
  138. ); 
  139.  
  140. return $structure; 
  141.