Class Rubernate::DBI::MySqlInit
In: rubernate/init/init_mysql.rb
Parent: GenericInit

Methods

init_db  

Constants

CREATE_R_OBJECTS = %q{ CREATE TABLE R_OBJECTS ( OBJECT_PK INTEGER(20) PRIMARY KEY AUTO_INCREMENT, OBJECT_CLASS VARCHAR(100) NOT NULL) ENGINE=InnoDB; }.gsub(INDENT, '')
CREATE_R_PARAMS = %q{ CREATE TABLE R_PARAMS ( OBJECT_PK INTEGER(20) NOT NULL, NAME VARCHAR(100) NOT NULL, FLAGS INTEGER(5) NOT NULL, INT_VALUE INTEGER(20), FLT_VALUE FLOAT, STR_VALUE VARCHAR(255), DAT_VALUE DATETIME, REF_VALUE INTEGER(20), CONSTRAINT R_PARAM_FK FOREIGN KEY (OBJECT_PK) REFERENCES R_OBJECTS(OBJECT_PK) ON DELETE CASCADE, CONSTRAINT R_REF_FK FOREIGN KEY (REF_VALUE) REFERENCES R_OBJECTS(OBJECT_PK) ON DELETE CASCADE) ENGINE=InnoDB; }.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_P_PK_NAME ON R_PARAMS (OBJECT_PK, NAME); }.gsub(INDENT, '')
TEMPLATE = %q{ # # Creates Rubernate tables for MySQL database. # Copyright (C) 2006 Andrey Ryabov <andrey_ryabov@bk.ru> # # Uncomment following if you want to create database named rubernate_db # CREATE DATABASE RUBERNATE_DB; # USE RUBERNATE_DB; # 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 %> # # End # }.gsub(INDENT, '')

Public Instance methods

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

[Validate]