package Orchard::DB::Schema::InformationSchema::Tables;

use strict;
use warnings;

use lib '/app/tools/common/lib';
use base 'Orchard::DB::DBIxCore';

__PACKAGE__->table('information_schema.tables');
__PACKAGE__->add_columns(
	qw/
	  table_catalog
	  table_schema
	  table_name
	  table_type
	  engine
	  version
	  row_format
	  table_rows
	  avg_row_length
	  data_length
	  max_data_length
	  index_length
	  data_free
	  auto_increment
	  create_time
	  update_time
	  check_time
	  table_collation
	  checksum
	  create_options
	  table_comment
	  /
);

__PACKAGE__->has_many(
	'columns' => 'Orchard::DB::Schema::InformationSchema::Columns',
	{
		'foreign.table_schema' => 'self.table_schema',
		'foreign.table_name'   => 'self.table_name'
	},
	{ 'order_by' => 'ordinal_position' }
);

__PACKAGE__->has_many(
	'indexes' => 'Orchard::DB::Schema::InformationSchema::Indexes',
	{
		'foreign.table_schema' => 'self.table_schema',
		'foreign.table_name'   => 'self.table_name'
	}
);

1;

