optimize db alignment

This commit is contained in:
2022-09-13 20:11:29 +02:00
parent 73e8d4eabb
commit b6c05f2201

View File

@@ -17,19 +17,19 @@ export default class Recorder {
if (!await this.db.schema.hasTable('veh_lines')) { if (!await this.db.schema.hasTable('veh_lines')) {
await this.db.schema.createTable('veh_lines', t => { await this.db.schema.createTable('veh_lines', t => {
t.timestamp('date', { useTz: false }).defaultTo(this.db.fn.now());
t.smallint('vehicle').notNullable(); t.smallint('vehicle').notNullable();
t.string('line', 32).nullable(); // 4, 9.... t.string('line', 32).nullable(); // 4, 9....
t.timestamp('date', { useTz: false }).defaultTo(this.db.fn.now());
}); });
} }
if (!await this.db.schema.hasTable('veh_pos')) { if (!await this.db.schema.hasTable('veh_pos')) {
await this.db.schema.createTable('veh_pos', t => { await this.db.schema.createTable('veh_pos', t => {
t.smallint('vehicle').notNullable();
t.smallint('line').nullable();
t.timestamp('date', { useTz: false }).defaultTo(this.db.fn.now()); t.timestamp('date', { useTz: false }).defaultTo(this.db.fn.now());
t.float('lat').nullable(); t.float('lat').nullable();
t.float('long').nullable(); t.float('long').nullable();
t.smallint('vehicle').notNullable();
t.smallint('line').nullable();
}); });
} }
} }