Development

#3067 (schema.yml should accept "size" attribute in indexes)

You must first sign up to be able to contribute.

Ticket #3067 (closed defect: fixed)

Opened 9 months ago

Last modified 5 months ago

schema.yml should accept "size" attribute in indexes

Reported by: lathspell Assigned to: FabianLange
Priority: minor Milestone: 1.0.17
Component: model Version: 1.0.10
Keywords: propel mysql longvarchar Cc:
Qualification: Design decision

Description

When using the column type "longvarchar" with MySQL a column of the MySQL type "text" is created. Currently it is not possible to put an index on such a column as MySQL requrires a size parameter on such indexes that denotes how many bytes of the potential very big text column should be used for the index.

The attached patch fixes this bug by allowing a slightly enhanced syntax for defining indexes in YML files that gets used when translating it to a propel XML file.

In the following example a multi-column key is created that indexes both, the "content" column (using the first 255 chars) and the author column:

propel:

blog_comment:

author: varchar(255) content: longvarchar _indexes:

idx1: [ { name: content, size: 255 }, author ]

The resulting XML file looks like this:

<index name="idx1">

<index-column name="content" size="255"/> <index-column name="author"/>

</index>

Attachments

yml2xml_index_sizes.diff (1.7 kB) - added by lathspell on 03/08/08 17:15:26.
Patch to allow a size definition for indexes in schema.yml

Change History

03/08/08 17:15:26 changed by lathspell

  • attachment yml2xml_index_sizes.diff added.

Patch to allow a size definition for indexes in schema.yml

03/08/08 18:19:14 changed by FabianLange

  • qualification changed from Unreviewed to Design decision.

although you could say its a new feature, you could also see that this is required for the outlined scenario to work correctly, thus a bugfix, thus valid for 1.0.x Also it does not do any symfony functionality, but enhances the wrapper for propel ina a way propel needs it. I would vote for applying the patch also against 1.0

03/13/08 00:32:41 changed by fabien

  • owner changed from fabien to francois.

06/08/08 17:56:27 changed by fabien

  • owner changed from francois to FabianLange.

This is indeed a bug, not a feature. I'd rather prefer to implement it like I've done in r9457 for symfony 1.1. It's more in line with how we can configure the size of a varchar.

06/08/08 17:56:43 changed by fabien

  • milestone set to 1.0.17.

06/09/08 10:06:53 changed by FabianLange

(In [9475]) doc: added information about size information for indexes. refs #3067, #3661

06/24/08 14:22:26 changed by FabianLange

  • status changed from new to closed.
  • resolution set to fixed.

(in r9474) 1.0: added support for specifying index size like my_index: [created_at(10)] to support putting indexes and uniques on mysql text type columns. (backport from r9457)