| Line | |
|---|
| 1 | package DBIx::Class::ProxyTable::AutoCreateTable::mysql; |
|---|
| 2 | use strict; |
|---|
| 3 | use warnings; |
|---|
| 4 | use base 'DBIx::Class::ProxyTable::AutoCreateTable'; |
|---|
| 5 | |
|---|
| 6 | sub _get_table { |
|---|
| 7 | my ($class, $rs, $new_table) = @_; |
|---|
| 8 | |
|---|
| 9 | my $base_table = $rs->result_source->schema->source_registrations->{$rs->result_source->source_name}->name; |
|---|
| 10 | my $sth = $rs->result_source->schema->storage->dbh->prepare("show create table $base_table"); |
|---|
| 11 | $sth->execute; |
|---|
| 12 | my $table = $sth->fetchrow_hashref; |
|---|
| 13 | $table->{'Create Table'} =~ s/$base_table/$new_table/; |
|---|
| 14 | return $table->{'Create Table'}; |
|---|
| 15 | } |
|---|
| 16 | 1; |
|---|
| 17 | |
|---|
| 18 | __END__ |
|---|
| 19 | |
|---|
| 20 | =head1 NAME |
|---|
| 21 | |
|---|
| 22 | DBIx::Class::ProxyTable::AutoCreateTable::mysql - auto create mysql table |
|---|
| 23 | |
|---|
| 24 | =head1 METHOD |
|---|
| 25 | |
|---|
| 26 | =head2 _get_table |
|---|
| 27 | |
|---|