#64 ✓resolved
Sirn

:integer becomes INT(4) instead of INT(11) on AutoMigrations

Reported by Sirn | November 23rd, 2007 @ 11:53 AM

When AutoMigrations, :integer becomes INT(4) instead of expected INT(11)

Model Code

class Post < DataMapper::Base
  property :user_id, :integer
  property :source, :string
  property :title, :string
  property :trashed, :boolean
  property :created_at, :datetime
  property :updated_at, :datetime
  
  database.table_exists?(Post) or database.save(Post)
end

Result

mysql> show columns from posts;
+------------+-------------+------+-----+---------+----------------+
| Field      | Type        | Null | Key | Default | Extra          |
+------------+-------------+------+-----+---------+----------------+
| id         | int(4)      | NO   | PRI | NULL    | auto_increment | 
| user_id    | int(4)      | YES  |     | NULL    |                | 
| source     | varchar(50) | YES  |     | NULL    |                | 
| title      | varchar(50) | YES  |     | NULL    |                | 
| trashed    | tinyint(1)  | YES  |     | NULL    |                | 
| created_at | datetime    | YES  |     | NULL    |                | 
| updated_at | datetime    | YES  |     | NULL    |                | 
+------------+-------------+------+-----+---------+----------------+

Comments and changes to this ticket

  • Rein Henrichs

    Rein Henrichs December 4th, 2007 @ 10:02 PM

    • State changed from “new” to “resolved”

    it "should default the size of an integer column to 11" do

    mappings = DataMapper::Adapters::Sql::Mappings

    table = mappings::Table.new(database(:mock).adapter, "Zebu")

    integer = mappings::Column.new(database(:mock).adapter, table, :age, :integer, 1)

    integer.size.should == 11

    end

    Added in @527

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

People watching this ticket

Tags

Pages