change_column(tablename, columnname, :big_integer, :null => true)
end
end
+
+ # SONAR-4178
+ def self.create_table(table_name, options = {})
+ super(table_name, options)
+ case dialect()
+ when "oracle"
+ create_id_trigger(table_name) unless options[:id] == false
+ else
+ # Do nothing
+ end
+ end
+
+ private
+
+ def self.create_id_trigger(table)
+ execute_ddl("create trigger for table #{table}",
+
+ %{CREATE OR REPLACE TRIGGER #{table}_id_trg
+ BEFORE INSERT ON #{table}
+ FOR EACH ROW
+ BEGIN
+ IF :new.id IS null THEN
+ SELECT #{table}_seq.nextval INTO :new.id FROM dual;
+ END IF;
+ END;})
+ end
+
+ def self.execute_ddl(message, ddl)
+ begin
+ say_with_time(message) do
+ ActiveRecord::Base.connection.execute(ddl)
+ end
+ rescue
+ # already executed
+ end
+ end
end
# patch for SONAR-1182. GWT does not support ISO8601 dates that end with 'Z'