use strict;
use warnings;

use Fey::Test;
use Fey::Test::Loader;
use Fey::Test::Pg;

use Test::More tests => 155;

use Fey::Loader;


{
    my $loader = Fey::Loader->new( dbh => Fey::Test::Pg->dbh() );

    my $schema1 = $loader->make_schema( name => 'Test' );
    my $schema2 = Fey::Test->mock_test_schema_with_fks();

    Fey::Test::Loader->compare_schemas
        ( $schema1, $schema2,
          { 'Message.message_date' =>
                { default => Fey::Literal::Function->new('now'),
                },
            'Message.quality' =>
                { type => 'numeric',
                },
            'Message.message' =>
                { type   => 'character varying',
                  length => 255,
                },
          },
        );
}

{
    my $def = Fey::Loader::Pg->_default('NULL');
    isa_ok( $def, 'Fey::Literal::Null');
}
