Red icon indicating copy to clipboard operation
Red copied to clipboard

$*RED-DB wasn't defined when red-defaults is present in sub package

Open kawaii opened this issue 5 years ago • 3 comments

Let's say I have a module like App::Example::Schema, which contains my red-defaults like so:

red-defaults
    "Pg",
        host => "localhost",
        database => "example",
        user => "example",
        password => "password",
        :default,
; 

And then I have my main script trying to call it like this:

use App::Example::Schema;

MyModel.^create-table: :if-not-exists;

We still get the $*RED-DB wasn't defined error.

kawaii avatar Jul 20 '20 19:07 kawaii

Hi, i had the same problem ( within Cro ) and ended using

$GLOBAL::RED-DB = database "SQLite", :database( "db.sql" );

maybe this will help

Demayl avatar Jul 20 '20 22:07 Demayl

@Demayl unfortunately I have the same issue when using your method, but I appreciate the suggestion. :)

kawaii avatar Jul 21 '20 02:07 kawaii

@kawaii I've added a test for it (https://github.com/FCO/Red/commit/d0085007ff75e3eb35e1f334b24b5ee6165a6926). Is it still broken for you?

FCO avatar May 16 '22 19:05 FCO