--- /dev/null
+use DBIx::Class::Fixtures;
+use Test::More;
+use Test::Fatal;
+use File::Path 'rmtree';
+
+use lib qw(t/lib/DBICTest);
+use Schema3;
+use Test::TempDir::Tiny;
+use IO::All;
+
+my $tempdir = tempdir;
+
+(my $schema = Schema3->connect(
+ 'DBI:SQLite::memory:','',''))->init_schema;
+
+ok my $row = $schema
+ ->resultset('Person')
+ ->first;
+
+ok $row->get_column('weight_to_height_ratio'),
+ 'has virtual column';
+
+my $fixtures = DBIx::Class::Fixtures
+ ->new({
+ config_dir => io->catfile(qw't var configs')->name,
+ debug => 0 });
+
+ok(
+ $fixtures->dump({
+ config => 'virtual-columns.json',
+ schema => $schema,
+ directory => io->catfile($tempdir, 'people')->name }),
+ 'fetch dump executed okay');
+
+ok $schema->resultset('Person')->delete;
+
+is exception {
+ $fixtures->populate({
+ no_deploy => 1,
+ schema => $schema,
+ directory => io->catfile($tempdir, 'people')->name
+ })
+}, undef, 'populated';
+
+$row = $schema->resultset('Person')->first;
+
+BAIL_OUT("can't continue without data") unless $row;
+
+ok $row->get_column('weight_to_height_ratio'),
+ 'still has virtual column';
+
+done_testing;
+
+END {
+ rmtree io->catfile(qw't var files')->name;
+ rmtree io->catfile($tempdir, 'people')->name;
+}
--- /dev/null
+package Schema3::Result::Person;
+
+use strict;
+use warnings;
+
+use base 'DBIx::Class::Core';
+
+__PACKAGE__->table('person');
+
+__PACKAGE__->add_columns(
+ id => {
+ data_type => 'integer',
+ is_auto_increment => 1,
+ },
+ name => {
+ data_type => 'varchar',
+ size => 255,
+ },
+ weight => {
+ datatype => 'float',
+ },
+ height => {
+ datatype => 'float',
+ },
+);
+
+__PACKAGE__->set_primary_key('id');
+
+# Add virtual column
+__PACKAGE__->resultset_attributes({
+ '+select' => [ \'weight/height' ],
+ '+as' => [ 'weight_to_height_ratio' ],
+});
+
+package Schema3;
+
+use strict;
+use warnings;
+
+use base 'DBIx::Class::Schema';
+
+__PACKAGE__->register_class(Person => 'Schema3::Result::Person');
+
+sub load_sql {
+ local $/ = undef;
+ my $sql = <DATA>;
+}
+
+sub init_schema {
+ my $sql = (my $schema = shift)
+ ->load_sql;
+
+ ($schema->storage->dbh->do($_) ||
+ die "Error on SQL: $_\n")
+ for split(/;\n/, $sql);
+}
+
+1;
+
+__DATA__
+CREATE TABLE person (
+ id INTEGER PRIMARY KEY NOT NULL,
+ name varchar(255) NOT NULL,
+ weight FLOAT NOT NULL,
+ height FLOAT NOT NULL
+);
+
+INSERT INTO person (name, weight, height)
+VALUES
+('Fred Flintstone', 220, 5.2),
+('Barney Rubble', 190, 4.8)