-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase.php
More file actions
54 lines (48 loc) · 1.58 KB
/
database.php
File metadata and controls
54 lines (48 loc) · 1.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
if ( ! defined( 'ABSPATH' ) ) exit;
global $misaaq_db_version;
$misaaq_db_version = '1.0';
function misaaq_create_table()
{
global $wpdb;
global $misaaq_db_version;
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
$charset_collate = $wpdb->get_charset_collate();
$sql = "CREATE TABLE IF NOT EXISTS {$wpdb->prefix}misaaq_ordo (
id integer NOT NULL AUTO_INCREMENT,
name tinytext NOT NULL,
start_time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
end_time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
register_start_time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
register_end_time datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
ordo_size integer NOT NULL,
ordo_mard_max integer not null,
ordo_zan_max integer not null,
hazineh integer not null,
PRIMARY KEY (id)
) $charset_collate;";
dbDelta( $sql );
$sql = "CREATE TABLE IF NOT EXISTS {$wpdb->prefix}misaaq_registers (
id INTEGER NOT NULL AUTO_INCREMENT,
ordo_id INTEGER NOT NULL,
user_id INTEGER NOT NULL,
state smallint not null ,
PRIMARY KEY (id)
) $charset_collate;";
dbDelta( $sql );
add_option( 'misaaq_db_version', $misaaq_db_version );
add_option($misaaq_db_version,'1.0');
}
function misaaq_drop_table()
{
global $wpdb;
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
dbDelta("drop table `{$wpdb->prefix}misaaq_registers`");
dbDelta("drop table `{$wpdb->prefix}misaaq_ordo`");
delete_option('misaaq_db_version');
}
function misaaq_udpate_table($old,$new)
{
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
}
?>