-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support nullable timestamps on MySQL (#3100)
* Add test to recreate the issue * Improve test, add some documentation * Improve test * Add explicit nullable flag to column * Set nullability explicitly on MySQL to deal with timestamp edge case * Use same assertion for everything
- Loading branch information
Showing
4 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
test/integration/migrate/null_timestamp_default/01_create.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
exports.up = function(knex, Promise) { | ||
return Promise.all([ | ||
knex.schema.createTable('null_date', function(t) { | ||
t.increments('id').primary(); | ||
t.timestamp('deleted_at') | ||
.nullable() | ||
.defaultTo(null); | ||
}), | ||
]); | ||
}; | ||
|
||
exports.down = (knex) => { | ||
return knex.schema.dropTable('null_date'); | ||
}; |