Forum OpenACS Q&A: migrate database

Collapse
Posted by miko miko on
i have a complete database in postgresql, how do i migrate the database so that i can use the database in the openacs application
Collapse
2: Re: migrate database (response to 1)
Posted by Nick Carroll on
Complete database of what?
Collapse
3: Re: migrate database (response to 1)
Posted by miko miko on
i mean complete database consist of tables staff, department , etc etc...all of them already in postgresql...or actually in sql command because i create the table using the command eg:

create table dept
( deptid varchar(20) primary key,
  deptname varchar(50) );

etc, but i found out, using openacs the command for the table is slightly different, eg :

begin
  acs_object_type.create_type (
    supertype    => 'acs_object',
    object_type  => 'note',
    pretty_name  => 'Note',
    pretty_plural => 'Notes',
    table_name    => 'NOTES',
    id_column    => 'NOTE_ID'
  );
end;
/
show errors;

declare
attr_id acs_attributes.attribute_id%TYPE;
begin
  attr_id := acs_attribute.create_attribute (
    object_type    => 'note',
    attribute_name => 'TITLE',
    pretty_name    => 'Title',
    pretty_plural  => 'Titles',
    datatype      => 'string'
  );

  attr_id := acs_attribute.create_attribute (
    object_type    => 'note',
    attribute_name => 'BODY',
    pretty_name    => 'Body',
    pretty_plural  => 'Bodies',
    datatype      => 'string'
  );
end;
/
show errors;

create table notes (
    note_id    integer references acs_objects(object_id) primary key,
    owner_id  integer references users(user_id),
    title      varchar(255) not null,
    body      varchar(1024)
)

so how do i convert the command for the existing tables so that i can use the tables for my openacs application.

the existing tables are about 50 tables..it is difficult if i have to convert it manually one by one, do you have any program to convert the tables?

thank u!!

Collapse
4: Re: migrate database (response to 1)
Posted by Claudio Pasolini on
It is not mandatory to make your tables ACS objects: you can simply start using your tables with the various db API.

Otherwise you can read and experiment this excellent tutorial.

Collapse
5: Re: migrate database (response to 3)
Posted by Nick Carroll on
You can try Laetitia's case tool to automatically generate that code from a UML diagram.  Check it out at the following URL.

http://www.weg.ee.usyd.edu.au/people/laetitia/