JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
8bfa14f34ebb9b18e055ccf6ec6815aad1fafecd
[wfpl-cms.git] / inc / db_upgrade.php
1 <?php
2
3 # 1. Write the next db_upgrade_to_X() at the bottom of this file. It will be
4 #    called automatically.
5
6 function db_upgrade_to_1() {
7 db_send_query(<<<EOLsql
8         create table wfpl_sessions (
9                 id int unique auto_increment,
10                 session_key varchar(16),
11                 idle_timeout int,
12                 expires int,
13                 expires_max int,
14                 value text
15         ) CHARSET=utf8;
16 EOLsql
17 );
18 db_send_query(<<<EOLsql
19         create table email_templates (
20                 id int unique auto_increment,
21                 slug varchar(200) binary not null default "",
22                 notes text binary not null default "",
23                 from_addr varchar(100) binary not null default "",
24                 to_addr varchar(100) binary not null default "",
25                 cc_addr varchar(100) binary not null default "",
26                 bcc_addr varchar(100) binary not null default "",
27                 subject varchar(200) binary not null default "",
28                 content text binary not null default ""
29         ) CHARSET=utf8;
30 EOLsql
31 );
32 db_send_query(<<<EOLsql
33         create table files (
34                 id int unique auto_increment,
35                 filename varchar(100) not null default "",
36                 description varchar(200) not null default ""
37         );
38 EOLsql
39 );
40 db_send_query(<<<EOLsql
41         create table cms_images (
42                 id int unique auto_increment,
43                 image varchar(240) not null default "",
44                 name varchar(200) not null default "",
45                 caption varchar(200) not null default "",
46                 created_at int not null default 0
47         );
48 EOLsql
49 );
50 db_send_query(<<<EOLsql
51         create table cms_pages (
52                 id int unique auto_increment,
53                 filename varchar(200) not null default "",
54                 title varchar(200) not null default "",
55                 nav_title varchar(200) not null default "",
56                 navbar int not null default 0,
57                 layout int not null default 0,
58                 content mediumtext not null default "",
59                 sidebar_content mediumtext not null default "",
60                 description text not null default "",
61                 keywords text not null default ""
62         );
63 EOLsql
64 );
65 db_send_query(<<<EOLsql
66         insert into cms_pages set
67                 filename='index',
68                 title='Home',
69                 content='Under Construction',
70                 navbar=1000000000;
71 EOLsql
72 );
73 db_send_query(<<<EOLsql
74         create table users (
75                 id int unique auto_increment,
76                 name varchar(200) binary not null default "",
77                 username varchar(200) binary not null default "",
78                 password varchar(255) binary not null default "",
79                 role varchar(200) binary not null default "",
80                 last_active int(11) not null default 0,
81                 last_login int(11) not null default 0
82         ) CHARSET=utf8;
83 EOLsql
84 );
85 db_send_query(<<<EOLsql
86         insert into users set
87                 name="fixme",
88                 username="fixme",
89                 password="$2y$10$84xUpPFQFRYRwpGkt01YtObJZcRKGReM/5ywHXCbwDF2bja41CDZm",
90                 role="admin";
91 EOLsql
92 );
93 db_send_query(<<<EOLsql
94         create table paypal_ipn (
95                 id int unique auto_increment,
96                 txn_id varchar(250) not null default "",
97                 status varchar(250) not null default "",
98                 ipn_at int(11) not null default 0,
99                 txn_type varchar(100) not null default "",
100                 subscr_id varchar(100) not null default "",
101                 custom varchar(250) not null default "",
102                 for_table_id int not null default 0,
103                 for_row_id int not null default 0,
104                 processed int(1) not null default 0,
105                 item_name varchar(250) not null default "",
106                 item_number varchar(250) not null default "",
107                 needs_review int(1) not null default 0,
108                 payment_status varchar(250) not null default "",
109                 mc_gross varchar(250) not null default "",
110                 mc_currency varchar(250) not null default "",
111                 receiver_email varchar(250) not null default "",
112                 payer_email varchar(250) not null default "",
113                 log text not null default ""
114         ) CHARSET=utf8;
115 EOLsql
116 );
117 }