This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
I have and 'asign_id' column in the MySQL, (relation between two tables OneToMany). The relation works well. asign_id type (int 11) nullable, default 'null'
The problem is that I can´t create new columns in the database from the builder because of that. When I try it, October says:
Invalid default value for the integer column 'asign_id'. The allowed formats are '10', '-10'.
So I´m working in phpMyAdmin when I want to create a new column...
Last updated
mjauvin said:
maybe try changing the default value to
NULL
instead of'null'
When I try it October says:
Unknown column type "timestamp" requested. Any Doctrine type that you use has to be registered with \Doctrine\DBAL\Types\Type::addType(). You can get a list of all the known types with \Doctrine\DBAL\Types\Type::getTypesMap(). If this error occurs during database introspection then you might have forgot to register all database types for a Doctrine Type. Use AbstractPlatform#registerDoctrineTypeMapping() or have your custom types implement Type#getMappedDatabaseTypes(). If the type name is empty you might have a problem with the cache or forgot some mapping information.
mjauvin said:
Can you show the exact table definition? From mysql DESCRIBE
id int(10) unsigned NO PRI NULL auto_increment
name varchar(191) NO NULL
surname varchar(191) YES null
employment varchar(191) YES null
active tinyint(1) NO NULL
telephone_rep text YES NULL
email_contact text YES NULL
address_contacto varchar(191) YES NULL
asign_id int(11) YES NULL
freetext text YES NULL
created_at timestamp YES NULL
updated_at timestamp YES NULL
deleted_at timestamp YES NULL
The null is automatic when you choose nullable. I´m going to review all my updates because a have a little tutti-frutti, too much table´s updates, so I need to rollback my first update with the tables again...
I wrote this in contact.php use \October\Rain\Database\Traits\Nullable;
protected $nullable = ['asign_id'];
Last updated
Finally I have restored all my Tables Versions because I had a lot of updates... It´s important to keep as clean as possible this part of the builder.
While working in development it is preferable to do a rollback when we want to create columns in the database or change their characteristics. It´s just a tip.
Did that solve your problem?
I agree about keeping migrations lean and clean, that's what I do as well.
mjauvin said:
Did that solve your problem?
I agree about keeping migrations lean and clean, that's what I do as well.
Yes, but as I say, I had a complete disaster of updates
1-9 of 9