| | 374 | sub fid_type { |
| | 375 | my $self = shift; |
| | 376 | return $self->{_fid_type} if $self->{_fid_type}; |
| | 377 | |
| | 378 | # let people force bigint mode with environment. |
| | 379 | if ($ENV{MOG_FIDSIZE} && $ENV{MOG_FIDSIZE} eq "big") { |
| | 380 | return $self->{_fid_type} = "BIGINT"; |
| | 381 | } |
| | 382 | |
| | 383 | # else, check a maybe-existing table and see if we're in bigint |
| | 384 | # mode already. |
| | 385 | my $dbh = $self->dbh; |
| | 386 | my $file_fid_type = $self->column_type("file", "fid"); |
| | 387 | if($file_fid_type) { |
| | 388 | if ($file_fid_type =~ /bigint/i) { |
| | 389 | return $self->{_fid_type} = "BIGINT"; |
| | 390 | } elsif($file_fid_type =~ /int/i) { |
| | 391 | # Old installs might not have raised the fid type size yet. |
| | 392 | return $self->{_fid_type} = "INT"; |
| | 393 | } |
| | 394 | } |
| | 395 | |
| | 396 | # Used to default to 32bit ints, but this always bites people |
| | 397 | # a few years down the road. So default to 64bit. |
| | 398 | return $self->{_fid_type} = "BIGINT"; |
| | 399 | } |
| | 400 | |