Project

General

Profile

Feature #536

Support Oracle SGDB -- db:migrate worked with errors if i use oracle db

Added by Nikolay Aralovets over 8 years ago. Updated about 3 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Category:
DB migrations
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

Hello,
I try to use Oracle 10.2.0.5 for Foreman 0.1-6 backend. In process create schema I see next issue:
1. In file db/migrate/20090730152224_create_ptables.rb
t.string :layout, :limit => 4096, :null => false
and Oracle generates error:
CreatePtables: migrating ================================================
-- create_table(:ptables)
rake aborted!
An error has occurred, all later migrations canceled:

OCIError: ORA-00910: specified length too long for its datatype: CREATE TABLE "PTABLES" ("ID" NUMBER NOT NULL PRIMARY KEY, "NAME" VARCHAR2 NOT NULL, "LAYOUT" VARCHAR2 NOT NULL, "OPERATINGSYSTEM_ID" NUMBER, "CREATED_AT" DATE, "UPDATED_AT" DATE)
2. At execution scropts:
- 20090915030726_change_report_field_type_to_text.rb
- 20100115021803_change_mysql_reports_column.rb
- 20100325142616_update_fact_names_and_values_to_bin.rb
- 20101018120548_create_messages.rb
- 20101018120603_create_sources.rb
I see error:
ChangeReportFieldTypeToText: migrating ==================================
rake aborted!
An error has occurred, all later migrations canceled:

undefined method `[]' for nil:NilClass


Related issues

Related to Foreman - Feature #546: Support Oracle SGDB -- It is not displayed DASHBOARD (with Oracle DB backend)Rejected2010-12-17

History

#1 Updated by Ohad Levy over 8 years ago

I have no oracle db to test, but can you try changing the following line in db/migrate/20090730152224_create_ptables.rb

t.string :layout, :limit => 4096, :null => false

to
t.text :layout, :null => false

#2 Updated by Nikolay Aralovets over 8 years ago

It's not worked, because Oracle needs to set size for datatype. I change this as follows:
t.string :layout, :limit => 4000, :null => false
4000 is max size for datatype varchar2

#3 Updated by Nikolay Aralovets over 8 years ago

Variant of a solution of a problem 2:
Add in if .. end condition else "do nothing" :)
For example in 20090915030726_change_report_field_type_to_text.rb add:
if ActiveRecord::Base.connection.instance_values["config"][:adapter] == "mysql"
execute "ALTER TABLE reports MODIFY log text;"
else
'do nothing'
end

#4 Updated by Ohad Levy about 8 years ago

Nikolay Aralovets wrote:

Variant of a solution of a problem 2:
Add in if .. end condition else "do nothing" :)
For example in 20090915030726_change_report_field_type_to_text.rb add:
if ActiveRecord::Base.connection.instance_values["config"][:adapter] == "mysql"
execute "ALTER TABLE reports MODIFY log text;"
else
'do nothing'
end

would you like to submit it as a patch for this ticket? (best if you want to use git so we can keep your details within the official foreman repo).

#5 Updated by Ohad Levy almost 8 years ago

  • Status changed from New to Need more information

Hi,

Does this ticket still relevant?

#6 Updated by Benjamin Papillon almost 7 years ago

  • Tracker changed from Bug to Feature
  • Subject changed from db:migrate worked with errors if i use oracle db to Support Oracle SGDB -- db:migrate worked with errors if i use oracle db
  • Status changed from Need more information to New

I update this ticket as Feature request. Devs are lacking a test environment to validate oracle right now.

#7 Updated by Tomer Brisker about 3 years ago

  • Description updated (diff)
  • Status changed from New to Rejected

Oracle DB is not supported by Foreman as a backend. Please use a supported database such as PostgreSQL or MySQL.

Also available in: Atom PDF