Project

General

Profile

cas-count.php

Script to add primary keys for peters-custom-anti-spam-image tables - Boone Gorges, 2020-04-01 12:14 PM

 
1
<?php
2

    
3
$tables = [
4
        'wp_11_cas_count',
5
        'wp_13_cas_count',
6
        'wp_1405_cas_count',
7
        'wp_1506_cas_count',
8
        'wp_19_cas_count',
9
        'wp_23_cas_count',
10
        'wp_250_cas_count',
11
        'wp_26_cas_count',
12
        'wp_2715_cas_count',
13
        'wp_2716_cas_count',
14
        'wp_2761_cas_count',
15
        'wp_2767_cas_count',
16
        'wp_32_cas_count',
17
        'wp_34_cas_count',
18
        'wp_379_cas_count',
19
        'wp_39_cas_count',
20
        'wp_40_cas_count',
21
        'wp_41_cas_count',
22
        'wp_457_cas_count',
23
        'wp_45_cas_count',
24
        'wp_604_cas_count',
25
        'wp_614_cas_count',
26
        'wp_63_cas_count',
27
        'wp_64_cas_count',
28
        'wp_710_cas_count',
29
        'wp_71_cas_count',
30
        'wp_843_cas_count',
31
        'wp_854_cas_count',
32
        'wp_860_cas_count',
33
        'wp_932_cas_count',
34
        'wp_964_cas_count',
35

    
36
        'wp_11_cas_image',
37
        'wp_13_cas_image',
38
        'wp_1405_cas_image',
39
        'wp_1506_cas_image',
40
        'wp_19_cas_image',
41
        'wp_23_cas_image',
42
        'wp_250_cas_image',
43
        'wp_26_cas_image',
44
        'wp_2715_cas_image',
45
        'wp_2716_cas_image',
46
        'wp_2761_cas_image',
47
        'wp_2767_cas_image',
48
        'wp_32_cas_image',
49
        'wp_34_cas_image',
50
        'wp_379_cas_image',
51
        'wp_39_cas_image',
52
        'wp_40_cas_image',
53
        'wp_41_cas_image',
54
        'wp_457_cas_image',
55
        'wp_45_cas_image',
56
        'wp_604_cas_image',
57
        'wp_614_cas_image',
58
        'wp_63_cas_image',
59
        'wp_64_cas_image',
60
        'wp_710_cas_image',
61
        'wp_71_cas_image',
62
        'wp_843_cas_image',
63
        'wp_854_cas_image',
64
        'wp_860_cas_image',
65
        'wp_932_cas_image',
66
        'wp_964_cas_image',
67
];
68

    
69
global $wpdb;
70

    
71
foreach ( $tables as $table ) {
72
        $wpdb->query( "ALTER TABLE {$table} ADD PRIMARY KEY (id)" );
73
//        $count = $wpdb->get_var( "select count(*) from {$table}" );
74
//        echo "{$table} {$count} \n";
75
}