Firebird News

Wednesday, March 05, 2008

creating the blog database for cakephp (beta)

after creating the empty database for cake and php5_interbase is installed
now i create the posts table from the cake tutorial

CREATE TABLE POSTS(
ID Integer NOT NULL,
TITLE Varchar(50),
BODY Varchar(2000),
CREATED Timestamp,
MODIFIED Timestamp,
PRIMARY KEY (ID)
);

also an autoincremental id with generator

CREATE GENERATOR GEN_POSTS_ID;

SET TERM ^ ;
CREATE TRIGGER POSTS_BI FOR POSTS ACTIVE
BEFORE INSERT POSITION 0
AS
BEGIN
IF (NEW.ID IS NULL) THEN
NEW.ID = GEN_ID(GEN_POSTS_ID, 1);
END^
SET TERM ;

No comments: