[geeklog-devel] MS SQL Upgrade

Randy Kolenko Randy.Kolenko at nextide.ca
Fri May 23 14:38:33 EDT 2008


> 
> In the MySQL db schema, the primary key is
> 
>   PRIMARY KEY (qid, pid)
> 
> whereas in the MS SQL schema, only qid is the primary key. 
> That looks like the problem to me.
> 


True -- its one of the problems.  The other is that the qid column needs
a default value of '0' as shown here in the mysql install sql:

$_SQL[] = "
CREATE TABLE {$_TABLES['pollquestions']} (
  qid mediumint(9) NOT NULL DEFAULT '0',
  pid varchar(20) NOT NULL,
  question varchar(255) NOT NULL,
  PRIMARY KEY (qid, pid)
) TYPE=MyISAM
";


Which now means that we have to alter the mssql version to look like
this:



CREATE TABLE [dbo].[gl_pollquestions] (
	[qid] [int] NOT NULL ,
	[pid] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NOT
NULL ,
	[question] [varchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS
NULL 
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[gl_pollquestions] ADD 
	CONSTRAINT [DF_gl_pollquestions_qid] DEFAULT (0) FOR [qid],
	CONSTRAINT [PK_gl_pollquestions] PRIMARY KEY  CLUSTERED 
	(
		[qid],
		[pid]
	)  ON [PRIMARY] 
GO




More information about the geeklog-devel mailing list