JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
indent with spaces
[wfpl-cms.git] / inc / db_upgrade.php
index c856fad..ea57afa 100644 (file)
 
 function db_upgrade_to_1() {
 db_send_query(<<<EOLsql
-       create table wfpl_sessions (
-               id int unique auto_increment,
-               session_key varchar(16),
-               idle_timeout int,
-               expires int,
-               expires_max int,
-               value text
-       ) CHARSET=utf8;
+    create table wfpl_sessions (
+        id int unique auto_increment,
+        session_key varchar(16),
+        idle_timeout int,
+        expires int,
+        expires_max int,
+        value text
+    ) CHARSET=utf8;
 EOLsql
 );
 db_send_query(<<<EOLsql
-       create table email_templates (
-               id int unique auto_increment,
-               slug varchar(200) binary not null default "",
-               notes text binary not null default "",
-               from_addr varchar(100) binary not null default "",
-               to_addr varchar(100) binary not null default "",
-               cc_addr varchar(100) binary not null default "",
-               bcc_addr varchar(100) binary not null default "",
-               subject varchar(200) binary not null default "",
-               content text binary not null default ""
-       ) CHARSET=utf8;
+    create table email_templates (
+        id int unique auto_increment,
+        slug varchar(200) binary not null default "",
+        notes text binary not null default "",
+        from_addr varchar(100) binary not null default "",
+        to_addr varchar(100) binary not null default "",
+        cc_addr varchar(100) binary not null default "",
+        bcc_addr varchar(100) binary not null default "",
+        subject varchar(200) binary not null default "",
+        content text binary not null default ""
+    ) CHARSET=utf8;
 EOLsql
 );
 db_send_query(<<<EOLsql
-       create table files (
-               id int unique auto_increment,
-               filename varchar(100) not null default "",
-               description varchar(200) not null default ""
-       );
+    create table files (
+        id int unique auto_increment,
+        filename varchar(100) not null default "",
+        description varchar(200) not null default ""
+    );
 EOLsql
 );
 db_send_query(<<<EOLsql
-       create table cms_images (
-               id int unique auto_increment,
-               image varchar(240) not null default "",
-               name varchar(200) not null default "",
-               caption varchar(200) not null default "",
-               created_at int not null default 0
-       );
+    create table cms_images (
+        id int unique auto_increment,
+        image varchar(240) not null default "",
+        name varchar(200) not null default "",
+        caption varchar(200) not null default "",
+        created_at int not null default 0
+    );
 EOLsql
 );
 db_send_query(<<<EOLsql
-       create table cms_pages (
-               id int unique auto_increment,
-               filename varchar(200) not null default "",
-               title varchar(200) not null default "",
-               nav_title varchar(200) not null default "",
-               navbar int not null default 0,
-               layout int not null default 0,
-               content mediumtext not null default "",
-               sidebar_content mediumtext not null default "",
-               description text not null default "",
-               keywords text not null default ""
-       );
+    create table cms_pages (
+        id int unique auto_increment,
+        filename varchar(200) not null default "",
+        title varchar(200) not null default "",
+        nav_title varchar(200) not null default "",
+        navbar int not null default 0,
+        layout int not null default 0,
+        content mediumtext not null default "",
+        sidebar_content mediumtext not null default "",
+        description text not null default "",
+        keywords text not null default ""
+    );
 EOLsql
 );
 db_send_query(<<<EOLsql
-       insert into cms_pages set
-               filename='index',
-               title='Home',
-               content='Under Construction',
-               navbar=1000000000;
+    insert into cms_pages set
+        filename='index',
+        title='Home',
+        content='Under Construction',
+        navbar=1000000000;
 EOLsql
 );
 db_send_query(<<<EOLsql
-       create table users (
-               id int unique auto_increment,
-               name varchar(200) binary not null default "",
-               username varchar(200) binary not null default "",
-               password varchar(255) binary not null default "",
-               role varchar(200) binary not null default "",
-               last_active int(11) not null default 0,
-               last_login int(11) not null default 0
-       ) CHARSET=utf8;
+    create table users (
+        id int unique auto_increment,
+        name varchar(200) binary not null default "",
+        username varchar(200) binary not null default "",
+        password varchar(255) binary not null default "",
+        role varchar(200) binary not null default "",
+        last_active int(11) not null default 0,
+        last_login int(11) not null default 0
+    ) CHARSET=utf8;
 EOLsql
 );
 db_send_query(<<<EOLsql
-       insert into users set
-               name="fixme",
-               username="fixme",
-               password="$2y$10$84xUpPFQFRYRwpGkt01YtObJZcRKGReM/5ywHXCbwDF2bja41CDZm",
-               role="admin";
+    insert into users set
+        name="fixme",
+        username="fixme",
+        password="$2y$10$84xUpPFQFRYRwpGkt01YtObJZcRKGReM/5ywHXCbwDF2bja41CDZm",
+        role="admin";
 EOLsql
 );
 db_send_query(<<<EOLsql
-       create table paypal_ipn (
-               id int unique auto_increment,
-               txn_id varchar(250) not null default "",
-               status varchar(250) not null default "",
-               ipn_at int(11) not null default 0,
-               txn_type varchar(100) not null default "",
-               subscr_id varchar(100) not null default "",
-               custom varchar(250) not null default "",
-               for_table_id int not null default 0,
-               for_row_id int not null default 0,
-               processed int(1) not null default 0,
-               item_name varchar(250) not null default "",
-               item_number varchar(250) not null default "",
-               needs_review int(1) not null default 0,
-               payment_status varchar(250) not null default "",
-               mc_gross varchar(250) not null default "",
-               mc_currency varchar(250) not null default "",
-               receiver_email varchar(250) not null default "",
-               payer_email varchar(250) not null default "",
-               log text not null default ""
-       ) CHARSET=utf8;
+    create table paypal_ipn (
+        id int unique auto_increment,
+        txn_id varchar(250) not null default "",
+        status varchar(250) not null default "",
+        ipn_at int(11) not null default 0,
+        txn_type varchar(100) not null default "",
+        subscr_id varchar(100) not null default "",
+        custom varchar(250) not null default "",
+        for_table_id int not null default 0,
+        for_row_id int not null default 0,
+        processed int(1) not null default 0,
+        item_name varchar(250) not null default "",
+        item_number varchar(250) not null default "",
+        needs_review int(1) not null default 0,
+        payment_status varchar(250) not null default "",
+        mc_gross varchar(250) not null default "",
+        mc_currency varchar(250) not null default "",
+        receiver_email varchar(250) not null default "",
+        payer_email varchar(250) not null default "",
+        log text not null default ""
+    ) CHARSET=utf8;
 EOLsql
 );
 }
 
 function db_upgrade_to_2() {
 db_send_query(<<<EOLsql
-       create table history_cms_pages (
-               history_id int unique auto_increment,
-               history_when int not null default 0,
-               history_user_id int not null default 0,
-               id int,
-               filename varchar(200) not null default "",
-               title varchar(200) not null default "",
-               nav_title varchar(200) not null default "",
-               navbar int not null default 0,
-               layout int not null default 0,
-               content mediumtext not null default "",
-               sidebar_content mediumtext not null default "",
-               description text not null default "",
-               keywords text not null default ""
-       );
+    create table history_cms_pages (
+        history_id int unique auto_increment,
+        history_when int not null default 0,
+        history_user_id int not null default 0,
+        id int,
+        filename varchar(200) not null default "",
+        title varchar(200) not null default "",
+        nav_title varchar(200) not null default "",
+        navbar int not null default 0,
+        layout int not null default 0,
+        content mediumtext not null default "",
+        sidebar_content mediumtext not null default "",
+        description text not null default "",
+        keywords text not null default ""
+    );
 EOLsql
 );
 db_send_query(<<<EOLsql
-       insert into history_cms_pages (
-               history_when,
-               history_user_id,
-               id,
-               filename,
-               title,
-               nav_title,
-               navbar,
-               layout,
-               content,
-               sidebar_content,
-               description,
-               keywords
-       ) select
-               0,
-               0,
-               id,
-               filename,
-               title,
-               nav_title,
-               navbar,
-               layout,
-               content,
-               sidebar_content,
-               description,
-               keywords
-       from cms_pages;
+    insert into history_cms_pages (
+        history_when,
+        history_user_id,
+        id,
+        filename,
+        title,
+        nav_title,
+        navbar,
+        layout,
+        content,
+        sidebar_content,
+        description,
+        keywords
+    ) select
+        0,
+        0,
+        id,
+        filename,
+        title,
+        nav_title,
+        navbar,
+        layout,
+        content,
+        sidebar_content,
+        description,
+        keywords
+    from cms_pages;
 EOLsql
 );
 }