Migration with SQLite failed #317
Unanswered
UweWagner403
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Hey! 👋 I am guessing that this is the field you added to your model? field :quelle, :string, max_size: 255, blank: true, default: nil The class Article < Marten::Model
with_timestamp_fields
field :id, :big_int, primary_key: true, auto: true
field :title, :string, max_size: 255
field :content, : text
field :quelle, :string, max_size: 255, blank: true, null: true, default: nil
field :created_at, :date_time, auto_now_add: true, blank: true
field :updated_at, :date_time, auto_now: true, blank: true
end Please remember that |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Based on the example model Article, the expanded model look like this:
class Article < Marten::Model
with_timestamp_fields
field :id, :big_int, primary_key: true, auto: true
field :title, :string, max_size: 255
field :content, :text
field :quelle, :string, max_size: 255, blank: true, default: nil
field :created_at, :date_time, auto_now_add: true, blank: true
field :updated_at, :date_time, auto_now: true, blank: true
end
marten genmigrations generate:
def plan
change_column :main_article, :quelle, :string, max_size: 255
end
I noticed the constraints blank: true and default: nil are not noticed.
marten migrate gives an error: "Unhandled exception: NOT NULL constraint failed: new_main_article.quelle (SQLite3::Exception)".
Beta Was this translation helpful? Give feedback.
All reactions