Topic: Customizing db:structure:dump
I'm using Rails 3.2.8 and have
config.active_record.schema_format = :sql
in my config/application.rb.
In an Oracle 11g database, I've defined a table with virtual columns that depend on user-defined functions:
CREATE TABLE BAR (
ID NUMBER(19,0) NOT NULL,
STATUS NUMBER(19, 0) DEFAULT 1,
CALCULATED_STATUS NUMBER(19,0) GENERATED ALWAYS AS (MY_FUNCTION(STATUS)) VIRTUAL)
When Rake performs a db:test:clone_structure (Tasks: TOP => default => spec => db:test:clone_structure), I'm hitting:
OCIError: ORA-00904: "FOO"."MY_FUNCTION": invalid identifier: CREATE TABLE "BAR" (...
I think what is happening is that db:structure:dump exports the tables before the functions so in development_structure.sql, the CREATE FUNCTION MY_FUNCTION appears after the CREATE TABLE BAR statement.
Do I have to go in and monkeypatch how db:structure:dump works?
Last edited by ayang (2012-12-10 18:28:28)