Fix data type inconsistencies in directus_shares table (#10740)

* Fix date resolution in share info endpoint

* Add note on leaving fields blank

* Tweak example to use proper db client

* Treat mysql 0000-00-00 00:00:00 as null

* Fix migration for mysql 5

* Add missing defaults to system fields
This commit is contained in:
Rijk van Zanten
2021-12-28 18:32:27 -05:00
committed by GitHub
parent 8a0fba0691
commit a5f64efb22
7 changed files with 18 additions and 6 deletions

View File

@@ -10,8 +10,11 @@ export async function up(knex: Knex): Promise<void> {
table.string('password');
table.uuid('user_created').references('id').inTable('directus_users').onDelete('SET NULL');
table.timestamp('date_created').defaultTo(knex.fn.now());
table.timestamp('date_start');
table.timestamp('date_end');
// This was changed after the migration went live to retroactively fix mysql5, see #10693
table.timestamp('date_start').nullable().defaultTo(null);
table.timestamp('date_end').nullable().defaultTo(null);
table.integer('times_used').defaultTo(0);
table.integer('max_uses');
});