refactor(go): simplify identity table keys
This commit is contained in:
@@ -71,17 +71,14 @@ func identityBindingTableSQL(table string) string {
|
||||
table = "vehicle_identity_binding"
|
||||
}
|
||||
return `CREATE TABLE IF NOT EXISTS ` + table + ` (
|
||||
id BIGINT PRIMARY KEY AUTO_INCREMENT,
|
||||
vin VARCHAR(32) NOT NULL,
|
||||
vin VARCHAR(32) PRIMARY KEY,
|
||||
plate VARCHAR(32) NULL,
|
||||
phone VARCHAR(32) NULL,
|
||||
device_id VARCHAR(64) NULL,
|
||||
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
UNIQUE KEY uk_identity_plate (plate),
|
||||
UNIQUE KEY uk_identity_phone (phone),
|
||||
UNIQUE KEY uk_identity_device (device_id),
|
||||
KEY idx_identity_vin (vin)
|
||||
UNIQUE KEY uk_identity_device (device_id)
|
||||
)`
|
||||
}
|
||||
|
||||
@@ -103,7 +100,6 @@ const jt808RegistrationTableSQL = `CREATE TABLE IF NOT EXISTS jt808_registration
|
||||
latest_registered_at DATETIME NULL,
|
||||
latest_authenticated_at DATETIME NULL,
|
||||
latest_seen_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
KEY idx_jt808_registration_device (device_id),
|
||||
KEY idx_jt808_registration_plate (plate),
|
||||
|
||||
Reference in New Issue
Block a user