summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormark <mark>2011-03-28 23:01:59 +0000
committermark <mark>2011-03-28 23:01:59 +0000
commit3ae9dd3079e47f05f0078bec83485497854da0c1 (patch)
tree14affa3547452c841341356de18a7394b39410da
parenta8011c8edcd051e6431399f3d0a876e5de49f6a2 (diff)
primary key for areacode table
-rw-r--r--FS/FS/Schema.pm5
-rw-r--r--FS/FS/areacode.pm22
2 files changed, 11 insertions, 16 deletions
diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm
index 9406f883c..d52edcbaf 100644
--- a/FS/FS/Schema.pm
+++ b/FS/FS/Schema.pm
@@ -3067,13 +3067,14 @@ sub tables_hashref {
'areacode' => {
'columns' => [
+ 'areanum', 'serial', '', '', '', '',
'code', 'char', '', 3, '', '',
'country', 'char', 'NULL', 2, '', '',
'state', 'char', 'NULL', 2, '', '',
'description','varchar', 'NULL', 255, '', '',
],
- 'primary_key' => 'code',
- 'unique' => [],
+ 'primary_key' => 'areanum',
+ 'unique' => [ [ 'code' ] ],
'index' => [],
},
diff --git a/FS/FS/areacode.pm b/FS/FS/areacode.pm
index 58b498c09..b6defa2fc 100644
--- a/FS/FS/areacode.pm
+++ b/FS/FS/areacode.pm
@@ -25,27 +25,20 @@ FS::areacode - Object methods for areacode records
=head1 DESCRIPTION
-An FS::areacode object represents an example. FS::areacode inherits from
+An FS::areacode object represents an area code. FS::areacode inherits from
FS::Record. The following fields are currently supported:
=over 4
-=item code
+=item areanum - primary key
-area code (primary key)
+=item code - area code
-=item country
+=item country - two-letter country code
-two-letter country code
-
-=item state
-
-two-letter state code, if appropriate
-
-=item description
-
-description (optional)
+=item state - two-letter state code, if appropriate
+=item description - description (optional)
=back
@@ -92,7 +85,8 @@ sub check {
my $self = shift;
my $error =
- $self->ut_number('code')
+ $self->ut_numbern('areanum')
+ || $self->ut_number('code')
|| $self->ut_text('country')
|| $self->ut_textn('state')
|| $self->ut_textn('description')