Update of /cvsroot/fink/scripts/pdb
In directory sc8-pr-cvs17:/tmp/cvs-serv4052/scripts/pdb

Modified Files:
      Tag: redesign_pdb
        drop.sql dump releases.sql schema.sql 
Log Message:
- Change name of table 'distribution_releases' to 'release'
- This involves using backticks for table names
- Use InnoDB as default database engine when creating tables
- Rearrange creation of tables in schema.sql


Index: schema.sql
===================================================================
RCS file: /cvsroot/fink/scripts/pdb/schema.sql,v
retrieving revision 1.8.2.8
retrieving revision 1.8.2.9
diff -u -d -r1.8.2.8 -r1.8.2.9
--- schema.sql  31 Aug 2007 19:39:56 -0000      1.8.2.8
+++ schema.sql  10 Sep 2007 18:02:20 -0000      1.8.2.9
@@ -1,12 +1,33 @@
-create table if not exists sections (
+create table if not exists `sections` (
  name varchar(32) not null,
  description text,
  primary key (name)
-) collate ascii_general_ci;
+) engine = innodb collate ascii_general_ci;
 
-create table if not exists package (
+create table if not exists `distribution` (
+  dist_id int unsigned not null auto_increment,
+  identifier varchar(16) not null,
+  description varchar(64) not null default '',
+  architecture enum('powerpc', 'i386') not null default 'powerpc',
+  priority tinyint unsigned not null default '1',
+  active boolean default 1,
+  visible boolean default 1,
+  primary key (dist_id)
+) engine = innodb collate ascii_general_ci;
+
+create table if not exists `release` (
+  rel_id int unsigned not null auto_increment,
+  dist_id int unsigned not null references `distribution(dist_id)`,
+  type enum('bindist', 'stable', 'unstable') not null,
+  version varchar(16) not null,
+  priority tinyint unsigned not null default '1',
+  active boolean default 1,
+  primary key (rel_id)
+) engine = innodb collate ascii_general_ci;
+
+create table if not exists `package` (
  pkg_id int unsigned not null auto_increment,
- rel_id int unsigned not null references distribution_releases(rel_id),
+ rel_id int unsigned not null references `release(rel_id)`,
  name varchar(64) not null,
  parentname varchar(64),
  version varchar(64) not null,
@@ -25,25 +46,4 @@
  index (name),
  index (section),
  index (rel_id)
-) collate ascii_general_ci;
-
-create table if not exists distribution (
-  dist_id int unsigned not null auto_increment,
-  identifier varchar(16) not null,
-  description varchar(64) not null default '',
-  architecture enum('powerpc', 'i386') not null default 'powerpc',
-  priority tinyint unsigned not null default '1',
-  active boolean default 1,
-  visible boolean default 1,
-  primary key (dist_id)
-) collate ascii_general_ci;
-
-create table if not exists distribution_releases (
-  rel_id int unsigned not null auto_increment,
-  dist_id int unsigned not null references distribution(dist_id),
-  type enum('bindist', 'stable', 'unstable') not null,
-  version varchar(16) not null,
-  priority tinyint unsigned not null default '1',
-  active boolean default 1,
-  primary key (rel_id)
-) collate ascii_general_ci;
+) engine = innodb collate ascii_general_ci;

Index: releases.sql
===================================================================
RCS file: /cvsroot/fink/scripts/pdb/releases.sql,v
retrieving revision 1.26.2.4
retrieving revision 1.26.2.5
diff -u -d -r1.26.2.4 -r1.26.2.5
--- releases.sql        31 Aug 2007 19:39:56 -0000      1.26.2.4
+++ releases.sql        10 Sep 2007 18:02:20 -0000      1.26.2.5
@@ -1,42 +1,42 @@
-delete from distribution;
-delete from distribution_releases;
+delete from `distribution`;
+delete from `release`;
 
-insert into distribution (dist_id, identifier, description, architecture, 
priority, active, visible) values (null, '10.1', '10.1', 'powerpc', 1, 0, 0);
+insert into `distribution` (dist_id, identifier, description, architecture, 
priority, active, visible) values (null, '10.1', '10.1', 'powerpc', 1, 0, 0);
 select @last_dist_id := last_insert_id();
-insert into distribution_releases (rel_id, dist_id, type, version, priority, 
active) values (null, @last_dist_id, 'bindist',  '0.4.1', 1, 0);
+insert into `release` (rel_id, dist_id, type, version, priority, active) 
values (null, @last_dist_id, 'bindist',  '0.4.1', 1, 0);
 
-insert into distribution (dist_id, identifier, description, architecture, 
priority, active, visible) values (null, '10.2-gcc3.3', '10.2\n(gcc3.3 only)', 
'powerpc', 2, 1, 1);
+insert into `distribution` (dist_id, identifier, description, architecture, 
priority, active, visible) values (null, '10.2-gcc3.3', '10.2\n(gcc3.3 only)', 
'powerpc', 2, 1, 1);
 select @last_dist_id := last_insert_id();
-insert into distribution_releases (rel_id, dist_id, type, version, priority, 
active) values (null, @last_dist_id, 'unstable', 'current', 3, 1);
-insert into distribution_releases (rel_id, dist_id, type, version, priority, 
active) values (null, @last_dist_id, 'stable',   'current', 2, 1);
-insert into distribution_releases (rel_id, dist_id, type, version, priority, 
active) values (null, @last_dist_id, 'bindist',  '0.6.4', 1, 1);
+insert into `release` (rel_id, dist_id, type, version, priority, active) 
values (null, @last_dist_id, 'unstable', 'current', 3, 1);
+insert into `release` (rel_id, dist_id, type, version, priority, active) 
values (null, @last_dist_id, 'stable',   'current', 2, 1);
+insert into `release` (rel_id, dist_id, type, version, priority, active) 
values (null, @last_dist_id, 'bindist',  '0.6.4', 1, 1);
 
-insert into distribution (dist_id, identifier, description, architecture, 
priority, active, visible) values (null, '10.3', '10.3', 'powerpc', 3, 1, 1);
+insert into `distribution` (dist_id, identifier, description, architecture, 
priority, active, visible) values (null, '10.3', '10.3', 'powerpc', 3, 1, 1);
 select @last_dist_id := last_insert_id();
-insert into distribution_releases (rel_id, dist_id, type, version, priority, 
active) values (null, @last_dist_id, 'unstable', 'current', 3, 1);
-insert into distribution_releases (rel_id, dist_id, type, version, priority, 
active) values (null, @last_dist_id, 'stable',   'current', 2, 1);
-insert into distribution_releases (rel_id, dist_id, type, version, priority, 
active) values (null, @last_dist_id, 'bindist',  '0.7.2', 1, 1);
+insert into `release` (rel_id, dist_id, type, version, priority, active) 
values (null, @last_dist_id, 'unstable', 'current', 3, 1);
+insert into `release` (rel_id, dist_id, type, version, priority, active) 
values (null, @last_dist_id, 'stable',   'current', 2, 1);
+insert into `release` (rel_id, dist_id, type, version, priority, active) 
values (null, @last_dist_id, 'bindist',  '0.7.2', 1, 1);
 
-insert into distribution (dist_id, identifier, description, architecture, 
priority, active, visible) values (null, '10.4', '10.4/powerpc', 'powerpc', 4, 
1, 1);
+insert into `distribution` (dist_id, identifier, description, architecture, 
priority, active, visible) values (null, '10.4', '10.4/powerpc', 'powerpc', 4, 
1, 1);
 select @last_dist_id := last_insert_id();
-insert into distribution_releases (rel_id, dist_id, type, version, priority, 
active) values (null, @last_dist_id, 'unstable', 'current', 3, 1);
-insert into distribution_releases (rel_id, dist_id, type, version, priority, 
active) values (null, @last_dist_id, 'stable',   'current', 2, 1);
-insert into distribution_releases (rel_id, dist_id, type, version, priority, 
active) values (null, @last_dist_id, 'bindist',  '0.8.1', 1, 1);
+insert into `release` (rel_id, dist_id, type, version, priority, active) 
values (null, @last_dist_id, 'unstable', 'current', 3, 1);
+insert into `release` (rel_id, dist_id, type, version, priority, active) 
values (null, @last_dist_id, 'stable',   'current', 2, 1);
+insert into `release` (rel_id, dist_id, type, version, priority, active) 
values (null, @last_dist_id, 'bindist',  '0.8.1', 1, 1);
 
-insert into distribution (dist_id, identifier, description, architecture, 
priority, active, visible) values (null, '10.4', '10.4/intel', 'i386', 5, 1, 1);
+insert into `distribution` (dist_id, identifier, description, architecture, 
priority, active, visible) values (null, '10.4', '10.4/intel', 'i386', 5, 1, 1);
 select @last_dist_id := last_insert_id();
-insert into distribution_releases (rel_id, dist_id, type, version, priority, 
active) values (null, @last_dist_id, 'unstable', 'current', 3, 1);
-insert into distribution_releases (rel_id, dist_id, type, version, priority, 
active) values (null, @last_dist_id, 'stable',   'current', 2, 1);
-insert into distribution_releases (rel_id, dist_id, type, version, priority, 
active) values (null, @last_dist_id, 'bindist',  '0.8.1', 1, 1);
+insert into `release` (rel_id, dist_id, type, version, priority, active) 
values (null, @last_dist_id, 'unstable', 'current', 3, 1);
+insert into `release` (rel_id, dist_id, type, version, priority, active) 
values (null, @last_dist_id, 'stable',   'current', 2, 1);
+insert into `release` (rel_id, dist_id, type, version, priority, active) 
values (null, @last_dist_id, 'bindist',  '0.8.1', 1, 1);
 
-insert into distribution (dist_id, identifier, description, architecture, 
priority, active, visible) values (null, '10.5', '10.5/powerpc', 'powerpc', 6, 
1, 0);
+insert into `distribution` (dist_id, identifier, description, architecture, 
priority, active, visible) values (null, '10.5', '10.5/powerpc', 'powerpc', 6, 
1, 0);
 select @last_dist_id := last_insert_id();
-insert into distribution_releases (rel_id, dist_id, type, version, priority, 
active) values (null, @last_dist_id, 'unstable', 'current', 3, 1);
-insert into distribution_releases (rel_id, dist_id, type, version, priority, 
active) values (null, @last_dist_id, 'stable',   'current', 2, 1);
-insert into distribution_releases (rel_id, dist_id, type, version, priority, 
active) values (null, @last_dist_id, 'bindist',  '0.9.0', 1, 1);
+insert into `release` (rel_id, dist_id, type, version, priority, active) 
values (null, @last_dist_id, 'unstable', 'current', 3, 1);
+insert into `release` (rel_id, dist_id, type, version, priority, active) 
values (null, @last_dist_id, 'stable',   'current', 2, 1);
+insert into `release` (rel_id, dist_id, type, version, priority, active) 
values (null, @last_dist_id, 'bindist',  '0.9.0', 1, 1);
 
-insert into distribution (dist_id, identifier, description, architecture, 
priority, active, visible) values (null, '10.5', '10.5/intel', 'i386', 7, 1, 0);
+insert into `distribution` (dist_id, identifier, description, architecture, 
priority, active, visible) values (null, '10.5', '10.5/intel', 'i386', 7, 1, 0);
 select @last_dist_id := last_insert_id();
-insert into distribution_releases (rel_id, dist_id, type, version, priority, 
active) values (null, @last_dist_id, 'unstable', 'current', 3, 1);
-insert into distribution_releases (rel_id, dist_id, type, version, priority, 
active) values (null, @last_dist_id, 'stable',   'current', 2, 1);
-insert into distribution_releases (rel_id, dist_id, type, version, priority, 
active) values (null, @last_dist_id, 'bindist',  '0.9.0', 1, 1);
+insert into `release` (rel_id, dist_id, type, version, priority, active) 
values (null, @last_dist_id, 'unstable', 'current', 3, 1);
+insert into `release` (rel_id, dist_id, type, version, priority, active) 
values (null, @last_dist_id, 'stable',   'current', 2, 1);
+insert into `release` (rel_id, dist_id, type, version, priority, active) 
values (null, @last_dist_id, 'bindist',  '0.9.0', 1, 1);

Index: dump
===================================================================
RCS file: /cvsroot/fink/scripts/pdb/dump,v
retrieving revision 1.32.2.14
retrieving revision 1.32.2.15
diff -u -d -r1.32.2.14 -r1.32.2.15
--- dump        4 Sep 2007 16:38:06 -0000       1.32.2.14
+++ dump        10 Sep 2007 18:02:20 -0000      1.32.2.15
@@ -78,8 +78,8 @@
 
 ### get distributions/releases
 
-$q = "SELECT r.*,d.* FROM distribution d ";
-$q .= "INNER JOIN distribution_releases r ON r.dist_id = d.dist_id ";
+$q = "SELECT r.*,d.* FROM `distribution` d ";
+$q .= "INNER JOIN `release` r ON r.dist_id = d.dist_id ";
 $q .= "WHERE d.active AND r.active ";
 if (defined $distribution) {
   $q .= "AND d.identifier='$distribution' ";
@@ -184,7 +184,7 @@
 
 print "# delete old rows\n";
 print "BEGIN;\n";
-print "DELETE FROM package WHERE rel_id='$rel_id';\n";
+print "DELETE FROM `package` WHERE rel_id='$rel_id';\n";
 
 ### loop over packages
 
@@ -258,7 +258,7 @@
   } 
 
   # generate SQL query
-  $q = "INSERT INTO package (";
+  $q = "INSERT INTO `package` (";
   $v = ") VALUES (";
   foreach $key (keys %data) {
     $q .= "$key,";

Index: drop.sql
===================================================================
RCS file: /cvsroot/fink/scripts/pdb/drop.sql,v
retrieving revision 1.3.2.3
retrieving revision 1.3.2.4
diff -u -d -r1.3.2.3 -r1.3.2.4
--- drop.sql    17 Feb 2007 19:05:49 -0000      1.3.2.3
+++ drop.sql    10 Sep 2007 18:02:20 -0000      1.3.2.4
@@ -1,7 +1,7 @@
-drop table if exists distribution;
-drop table if exists distribution_releases;
-drop table if exists package;
-drop table if exists sections;
-drop table if exists splitoffs;
-drop table if exists latest_pkg;
-drop table if exists release;
+drop table if exists `distribution`;
+drop table if exists `distribution_releases`;
+drop table if exists `package`;
+drop table if exists `sections`;
+drop table if exists `splitoffs`;
+drop table if exists `latest_pkg`;
+drop table if exists `release`;


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Fink-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fink-commits

Reply via email to