Ticket #77 (closed enhancement: duplicate)

Opened 5 years ago

Last modified 17 months ago

Add ENUM support for MySQL

Reported by: anonymous Owned by: hans
Priority: normal Milestone: 1.3
Component: Runtime (PHP5) Version: devel
Severity: normal Keywords: enum, validator, wishlist
Cc:

Description (last modified by hans) (diff)

implement enum type, ie

<?xml version="1.0" encoding="ISO-8859-1"?>
<database name="bookstore">
  <table name="book">
    <column name="book_id" type="INTEGER" required="true" primaryKey="true"/>
	   <column name="title" type="VARCHAR" size="50" required="true" />
	   <column name="categories" type="ENUM" values="bla, blabla, blablabla" required="true" />
  </table>
</database>

Change History

  Changed 5 years ago by david

  • status changed from new to closed
  • resolution set to invalid
  • severity changed from minor to enhancement

Please open a seperate ticket for each feature request, bug report etc.

Note that ENUM is MySQL only. You may use one-to-many relationships to achieve the same thing.

  Changed 3 years ago by chjunior@…

  • status changed from closed to reopened
  • resolution invalid deleted

ENUM is mysql, for postgresql you can use a simple check constraint, and I think that is the same for Oracle and MSSQL, so I think that it can be implemented.

When using a check constraint, the column datatype can be a varchar, that the maxlength is the number of chars of the biggest possible ENUM values.

  Changed 3 years ago by hans

  • milestone changed from 1.2 to 1.3

I'll see if we can't get some basic ENUM support for 1.3. It sounds possible, but there are some unanswered questions like how to represent the values, etc. (obviously we'd have to adjust the schema).

  Changed 3 years ago by hans

  • description modified (diff)
  • summary changed from wishlist to Add ENUM support for MySQL

I changed the summary and removed the request for updated validator documentation from the ticket (since this has been done).

  Changed 3 years ago by mahmoud.kassem@…

Just wanted to add that postgresql 8.3 supports enum. Please check postgresql people planet for more information.

This might be a good reason to increase the speed of adding enum to propel.

follow-up: ↓ 7   Changed 3 years ago by hans

  • status changed from reopened to closed
  • resolution set to duplicate

Note that this can be done with @sqlType:

<column name="enum_col" type="VARCHAR" size="32" sqlType="ENUM"/>

Also, see #462 for a duplicate ticket which includes patches (which, however, likely won't be applied given that you can workaround this issue easily).

in reply to: ↑ 6   Changed 2 years ago by anonymous

Replying to hans:

Note that this can be done with @sqlType: {{{ #!xml <column name="enum_col" type="VARCHAR" size="32" sqlType="ENUM"/> }}} Also, see #462 for a duplicate ticket which includes patches (which, however, likely won't be applied given that you can workaround this issue easily).

I think the example can be better writed as:

<column name="enum_col" type="varchar(2)" sqlType="ENUM('a','b','c')"/>
Note: See TracTickets for help on using tickets.