· 9 years ago · Dec 11, 2016, 09:08 PM
1<?php
2register_activation_hook( __FILE__, 'my_plugin_create_db' );
3
4// function to create the DB / Options / Defaults
5if(!function_exists(my_plugin_create_db))
6{
7 {
8 function my_plugin_create_db() {
9
10
11
12 require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
13 require_once( ABSPATH . 'wp-admin/upgrade-functions.php' );
14
15 global $wpdb;
16 $charset_collate = $wpdb->get_charset_collate();
17 $table_name = $wpdb->prefix . 'jobs';
18
19 $sql = "CREATE TABLE IF NOT EXISTS $table_name (
20 id mediumint(9) NOT NULL auto_increment,
21 location varchar(255),
22 industry varchar(255),
23 type varchar(255),
24 role varchar(255),
25 career_level varchar(255),
26 presence varchar(255),
27 insurance int,
28 consulting int,
29 management int,
30 finance int,
31 time_management int,
32 communication int,
33 communication_text text,
34 organizational int,
35 organizational_text text,
36 job_related int,
37 job_related_text text,
38 english_understanding int,
39 english_speaking int,
40 english_writing int,
41 french_understanding int,
42 french_speaking int,
43 french_writing int,
44 spanish_understanding int,
45 spanish_speaking int,
46 spanish_writing int,
47 aditional_requirments text,
48 experience text,
49 benefits_1 text,
50 benefits_2 text,
51 benefits_3 text,
52 company_name varchar(255),
53 birth_year int,
54 people_number int,
55 job_numbers int,
56 description text,
57 PRIMARY KEY (`id`)
58 ) $charset_collate;";
59
60 require_once(ABSPATH . '/wp-admin/upgrade-functions.php');
61 dbDelta($sql);
62
63 }
64 }
65}
66?>