Class Rubernate::DBI::PgInit
In: rubernate/init/init_pg.rb
Parent: GenericInit

Methods

init_db  

Constants

CREATE_R_OBJECTS = %q{ CREATE TABLE R_OBJECTS ( OBJECT_PK INTEGER PRIMARY KEY, OBJECT_CLASS VARCHAR(100)) }.gsub(INDENT, '')
CREATE_R_PARAMS = %q{ CREATE TABLE R_PARAMS ( OBJECT_PK INTEGER NOT NULL REFERENCES R_OBJECTS(OBJECT_PK) ON DELETE CASCADE, NAME VARCHAR NOT NULL, FLAGS INTEGER NOT NULL, INT_VALUE INTEGER, FLT_VALUE FLOAT, STR_VALUE VARCHAR, DAT_VALUE TIMESTAMP WITH TIME ZONE, REF_VALUE INTEGER REFERENCES R_OBJECTS(OBJECT_PK) ON DELETE CASCADE) }.gsub(INDENT, '')
CREATE_INDEX_O_PK_CLASS = %q{ CREATE INDEX R_O_PK_CLASS ON R_OBJECTS (OBJECT_PK, OBJECT_CLASS) }.gsub(INDENT, '')
CREATE_INDEX_P_PK_NAME = %q{ CREATE INDEX R_O_CLASS ON R_OBJECTS (OBJECT_CLASS) }.gsub(INDENT, '')
CREATE_R_PK_SEQUENCE = %q{ CREATE SEQUENCE R_PK_SEQUENCE; }.gsub(INDENT, '')
TEMPLATE = %q{ /** * Creates Rubernate tables for PostgreSQL database. * Copyright (C) 2006 Andrey Ryabov <andrey_ryabov@bk.ru> */ /** * Create r_objects table */ <%= CREATE_R_OBJECTS %>/ /** * Create r_params table */ <%= CREATE_R_PARAMS %>/ /** * Create index on r_objects */ <%= CREATE_INDEX_O_PK_CLASS %>/ /** * Create index on r_params */ <%= CREATE_INDEX_P_PK_NAME %>/ /** * Create primary key sequence */ <%= CREATE_R_PK_SEQUENCE %>/ /** * End */ }.gsub(INDENT, '')

Public Instance methods

Prints initialization script and tryes to initialize databaes database if dbh is given.

[Validate]