From 574c32c009b187782497bf170204dc7a8976b2e0 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 11 May 2011 08:36:21 +0200 Subject: [PATCH] =?utf8?q?ID-Spalte=20f=C3=BCr=20Tabelle=20"units"=20hinzu?= =?utf8?q?gef=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- SL/DB/MetaSetup/Unit.pm | 3 +++ sql/Pg-upgrade2/units_id.sql | 6 ++++++ 2 files changed, 9 insertions(+) create mode 100644 sql/Pg-upgrade2/units_id.sql diff --git a/SL/DB/MetaSetup/Unit.pm b/SL/DB/MetaSetup/Unit.pm index c22946283..6e05737df 100644 --- a/SL/DB/MetaSetup/Unit.pm +++ b/SL/DB/MetaSetup/Unit.pm @@ -15,10 +15,13 @@ __PACKAGE__->meta->setup( factor => { type => 'numeric', precision => 5, scale => 20 }, type => { type => 'varchar', length => 20 }, sortkey => { type => 'integer', not_null => 1 }, + id => { type => 'serial', not_null => 1 }, ], primary_key_columns => [ 'name' ], + unique_key => [ 'id' ], + foreign_keys => [ unit => { class => 'SL::DB::Unit', diff --git a/sql/Pg-upgrade2/units_id.sql b/sql/Pg-upgrade2/units_id.sql new file mode 100644 index 000000000..0b20ebb67 --- /dev/null +++ b/sql/Pg-upgrade2/units_id.sql @@ -0,0 +1,6 @@ +-- @tag: units_id +-- @description: ID-Spalte für Tabelle "units" +-- @depends: release_2_6_2 +-- @charset: utf-8 +ALTER TABLE units ADD COLUMN id serial; +ALTER TABLE units ADD CONSTRAINT units_id_unique UNIQUE (id); -- 2.20.1