Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fail to fall back to mediumtext specified :default #189

Open
hykw opened this issue Jul 7, 2017 · 2 comments
Open

fail to fall back to mediumtext specified :default #189

hykw opened this issue Jul 7, 2017 · 2 comments

Comments

@hykw
Copy link

hykw commented Jul 7, 2017

As you know, change() in a migration file define the column with mediumtext, when you specify size: 65535 like below.

add :description, :string, null: false, size: 65535

It doesn't work well when default: is also specified like following.

add :description, :string, null: false, size: 65535, default: ""

or

add :description, :string, null: false, default: "", size: 65535

The error message, when specified the :default.

$ mix ecto.migrate

10:42:56.119 [info]  == Running Bsn.Repo.Migrations.CreateMovies.change/0 forward

10:42:56.120 [info]  create table movies
** (Mariaex.Error) (1074): Column length too big for column 'description' (max = 21845); use BLOB or TEXT instead

It occurred in this environments:

  • mariaex: 0.8.2
  • ecto: 2.1.4
  • elixir: 1.4.2
  • Erlang/OTP: 19.2
@mtokioka
Copy link
Contributor

TEXT column cannot be assigned a default value.

@hykw
Copy link
Author

hykw commented Jul 10, 2017

Oh, thank you. I see the reason.
BTW, how about to change the error message to "BLOB/TEXT column can't have a default value", or like that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants