-- update script 2005-09-08 by pietro
--
-- * adds "db_patches" and "model_version" tables to the database
--
-- This script will terminate with an error the second time it's run,
--   so running this script when it isn't needed can't do any harm.
--

BEGIN TRANSACTION;

--
-- db_patches
--

CREATE SEQUENCE "db_patches_id_seq" start 1 increment 1 maxvalue 2147483647 minvalue 1  cache 1 ;

CREATE TABLE "db_patches" (
  "id" integer DEFAULT nextval('db_patches_id_seq'::text) NOT NULL,
  "date" date NOT NULL,
  "description" text
);

INSERT INTO "db_patches" VALUES (1, DATE '2002-12-13', '* introduces sequences and primary keys for comment_status, article_type and
      language\n * adds is_html to comment');
INSERT INTO "db_patches" VALUES (2, DATE '2003-04-09', '* creates table comment_x_media, to support media in comments\n * adds webdb_lastchange to comment');
INSERT INTO "db_patches" VALUES (3, DATE '2003-11-22', '* added a bunch of fields to webdb_user: is_disabled, email, profile, creation date, last login date');
INSERT INTO "db_patches" VALUES (4, DATE '2003-11-24', '* Clean up comments\n * added a comment field for internal comments');
INSERT INTO "db_patches" VALUES (5, DATE '2003-11-25', '* Removal of media (uploaded_media and content are now independently)\n * Clean up of content\n * Added a field for content-locking\n * Added a keywords field for content');
INSERT INTO "db_patches" VALUES (6, DATE '2003-12-12', '* makes login unique on webdb_users\n * drops unnecessary index on webdb_users\n * inserts a line for ogg support in media_types\n * drop "- deprecated -" from media_types\n * drop redundant index on id of topic\n * drop redundant index on id of comment\n * recreate indexes on content_x_media');
INSERT INTO "db_patches" VALUES (7, DATE '2005-01-09', '* adds filter and filtergroups to the database');
INSERT INTO "db_patches" VALUES (8, DATE '2005-09-13', '* adds "db_patches" and "model_version" tables to the database for database changes tracking');

--
-- model_version
--

CREATE TABLE "model_version" (
  "description"  character varying(24)
);

INSERT INTO "model_version" VALUES ('1.1-1');

COMMIT TRANSACTION;

