Return-Path: X-Original-To: apmail-cayenne-user-archive@www.apache.org Delivered-To: apmail-cayenne-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E75839611 for ; Sun, 5 Feb 2012 07:25:37 +0000 (UTC) Received: (qmail 68101 invoked by uid 500); 5 Feb 2012 07:25:36 -0000 Delivered-To: apmail-cayenne-user-archive@cayenne.apache.org Received: (qmail 67818 invoked by uid 500); 5 Feb 2012 07:25:24 -0000 Mailing-List: contact user-help@cayenne.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cayenne.apache.org Delivered-To: mailing list user@cayenne.apache.org Received: (qmail 67807 invoked by uid 99); 5 Feb 2012 07:25:15 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 05 Feb 2012 07:25:15 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [208.78.103.231] (HELO vorsha.objectstyle.org) (208.78.103.231) by apache.org (qpsmtpd/0.29) with SMTP; Sun, 05 Feb 2012 07:25:08 +0000 Received: (qmail 1930 invoked from network); 5 Feb 2012 07:24:46 -0000 Received: from unknown (HELO ?127.0.0.1?) (127.0.0.1) by localhost with SMTP; 5 Feb 2012 07:24:46 -0000 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1084) Subject: Re: Modeling MySQL views and primary keys From: Andrus Adamchik In-Reply-To: Date: Sun, 5 Feb 2012 10:24:45 +0300 Content-Transfer-Encoding: quoted-printable Message-Id: <253AC93F-B159-4517-B630-D569F7A9DEF5@objectstyle.org> References: To: user@cayenne.apache.org X-Mailer: Apple Mail (2.1084) AFAIK there's no way to tell the Modeler to ignore certain manual model = tweaks when creating migrations. Things like that are the reason why I = am using manual SQL-based migrations to evolve my schema.=20 Andrus On Feb 4, 2012, at 3:11 AM, Tad wrote: > We've got an existing MySQL 5.x database that contains a single view. = This > view includes the primary key column of its source table in its = results. >=20 > When modeling this view with a db-entity (through re-engineering, > migration, and manual creation) the modeler tells us that the entity = lacks > a primary key column (even though the modeler picks up the column and = adds > it as an attribute). So, we assign the appropriate PK column, and this > error disappears. >=20 > The problem now is that any future migrations attempt to alter the = view and > add a primary key (using ALTER TABLE, no less), and we have to know = not to > apply these changes to the database schema. >=20 > Is there a way to suppress this behavior? Perhaps by ignoring the view > entirely, or adding something to the view definition itself to assign = the > "primary key" attribute to a column of its results? >=20 > Thanks for any help. >=20 > -Tad Fisher