diff --git a/dlt-database/entity/0001-init_db/User.ts b/dlt-database/entity/0001-init_db/User.ts index 933c3d236..a0cc2cb18 100644 --- a/dlt-database/entity/0001-init_db/User.ts +++ b/dlt-database/entity/0001-init_db/User.ts @@ -22,7 +22,7 @@ export class User extends BaseEntity { @Column({ name: 'created_at', type: 'datetime', - default: () => 'CURRENT_TIMESTAMP', + default: () => 'CURRENT_TIMESTAMP(3)', }) createdAt: Date diff --git a/dlt-database/migrations/0001-init_db.ts b/dlt-database/migrations/0001-init_db.ts index ff9086b18..a7f31ac9b 100644 --- a/dlt-database/migrations/0001-init_db.ts +++ b/dlt-database/migrations/0001-init_db.ts @@ -19,8 +19,8 @@ export async function upgrade(queryFn: (query: string, values?: any[]) => Promis \`id\` int(10) unsigned NOT NULL AUTO_INCREMENT, \`gradido_id\` char(36) DEFAULT NULL, \`derive1_pubkey\` binary(32) NOT NULL, - \`created_at\` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, - \`confirmed_at\` datetime DEFAULT NULL, + \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3), + \`confirmed_at\` datetime(3) DEFAULT NULL, PRIMARY KEY (\`id\`), UNIQUE KEY \`gradido_id\` (\`gradido_id\`), UNIQUE KEY \`pubkey\` (\`pubkey\`) @@ -33,10 +33,10 @@ export async function upgrade(queryFn: (query: string, values?: any[]) => Promis \`derivation_index\` int(10) unsigned NOT NULL, \`derive2_pubkey\` binary(32) NOT NULL, \`type\` tinyint unsigned NOT NULL, - \`created_at\` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, - \`confirmed_at\` datetime DEFAULT NULL, + \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3), + \`confirmed_at\` datetime(3) DEFAULT NULL, \`balance\` decimal(40,20) NOT NULL DEFAULT 0, - \`balance_date\` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + \`balance_date\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3), PRIMARY KEY (\`id\`), UNIQUE KEY \`pubkey\` (\`pubkey\`), FOREIGN KEY (\`user_id\`) REFERENCES users(id) @@ -53,8 +53,8 @@ export async function upgrade(queryFn: (query: string, values?: any[]) => Promis \`foreign\` tinyint(4) NOT NULL DEFAULT true, \`gmw_account_id\` int(10) unsigned DEFAULT NULL, \`auf_account_id\` int(10) unsigned DEFAULT NULL, - \`created_at\` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, - \`confirmed_at\` datetime DEFAULT NULL, + \`created_at\` datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3), + \`confirmed_at\` datetime(3) DEFAULT NULL, PRIMARY KEY (\`id\`), UNIQUE KEY \`pubkey\` (\`pubkey\`), FOREIGN KEY (\`gmw_account_id\`) REFERENCES accounts(id), @@ -66,8 +66,8 @@ export async function upgrade(queryFn: (query: string, values?: any[]) => Promis \`id\` int(10) unsigned NOT NULL AUTO_INCREMENT, \`account_id\` int(10) unsigned NOT NULL, \`community_id\` int(10) unsigned NOT NULL, - \`valid_from\` datetime NOT NULL, - \`valid_to\` datetime DEFAULT NULL, + \`valid_from\` datetime(3) NOT NULL, + \`valid_to\` datetime(3) DEFAULT NULL, PRIMARY KEY (\`id\`), FOREIGN KEY (\`account_id\`) REFERENCES accounts(id), FOREIGN KEY (\`community_id\`) REFERENCES communities(id) @@ -83,7 +83,7 @@ export async function upgrade(queryFn: (query: string, values?: any[]) => Promis \`recipient_community_id\` int(10) unsigned DEFAULT NULL, \`amount\` decimal(40,20) DEFAULT NULL, \`type\` tinyint unsigned NOT NULL, - \`created_at\` datetime NOT NULL, + \`created_at\` datetime(3) NOT NULL, \`body_bytes\` BLOB NOT NULL, \`signature\` binary(64) NOT NULL, \`protocol_version\` int(10) NOT NULL DEFAULT 1, @@ -103,7 +103,7 @@ export async function upgrade(queryFn: (query: string, values?: any[]) => Promis \`account_id\` int(10) unsigned NOT NULL, \`account_balance\` decimal(40,20) NOT NULL DEFAULT 0, \`iota_milestone\` bigint NOT NULL, - \`confirmed_at\` datetime NOT NULL, + \`confirmed_at\` datetime(3) NOT NULL, PRIMARY KEY (\`id\`), FOREIGN KEY (\`transaction_recipe_id\`) REFERENCES transaction_recipes(id), FOREIGN KEY (\`account_id\`) REFERENCES accounts(id)