From ce24161b7ec7a8874e84025544595730db1cb929 Mon Sep 17 00:00:00 2001
From: paca70 <paca70>
Date: Mon, 19 Apr 2004 04:15:24 +0000
Subject: [PATCH] First versions for postgressql

---
 blocks/db/postgres7.php | 45 +++++++++++++++++++++++++++++++++++++++++
 blocks/db/postgres7.sql | 14 +++++++++++++
 2 files changed, 59 insertions(+)
 create mode 100644 blocks/db/postgres7.php
 create mode 100644 blocks/db/postgres7.sql

diff --git a/blocks/db/postgres7.php b/blocks/db/postgres7.php
new file mode 100644
index 0000000000..ecfa8e6815
--- /dev/null
+++ b/blocks/db/postgres7.php
@@ -0,0 +1,45 @@
+<?PHP  //$Id$
+//
+// This file keeps track of upgrades to Moodle's
+// blocks system.
+//
+// Sometimes, changes between versions involve
+// alterations to database structures and other
+// major things that may break installations.
+//
+// The upgrade function in this file will attempt
+// to perform all the necessary actions to upgrade
+// your older installtion to the current version.
+//
+// If there's something it cannot do itself, it
+// will tell you what you need to do.
+//
+// Versions are defined by backup_version.php
+//
+// This file is tailored to PostgreSQL
+
+function blocks_upgrade($oldversion=0) {
+
+global $CFG;
+    
+    $result = true;
+    
+    if ($oldversion < 2004041000 and $result) {
+        $result = execute_sql("
+                                CREATE TABLE {$CFG->prefix}blocks 
+                                (
+              				    id SERIAL8 PRIMARY KEY,
+  			            	    name varchar(40) NOT NULL default '',
+  				                version INT8 NOT NULL default '0',
+  				                cron INT8  NOT NULL default '0',
+  				                lastcron INT8  NOT NULL default '0',
+  				                visible int NOT NULL default '1'
+                                )
+			                    ") ;
+
+    }
+
+    //Finally, return result
+    return $result;
+}
+?>
diff --git a/blocks/db/postgres7.sql b/blocks/db/postgres7.sql
new file mode 100644
index 0000000000..eccdc73f06
--- /dev/null
+++ b/blocks/db/postgres7.sql
@@ -0,0 +1,14 @@
+# $Id$
+# 
+# Table structure for table blocks
+# 
+
+CREATE TABLE prefix_blocks (
+  id SERIAL8 PRIMARY KEY,
+  name varchar(40) NOT NULL default '',
+  version INT8 NOT NULL default '0',
+  cron INT8  NOT NULL default '0',
+  lastcron INT8  NOT NULL default '0',
+  visible int NOT NULL default '1'
+) ;
+# --------------------------------------------------------
-- 
2.39.5