Archived
0

добавлены индексы в таблицы

This commit is contained in:
2018-09-14 01:16:55 +03:00
parent df3ceba789
commit 3e6d0687ab
2 changed files with 8 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
CREATE TABLE IF NOT EXISTS players ( CREATE TABLE IF NOT EXISTS players (
id INT AUTO_INCREMENT, id INT AUTO_INCREMENT PRIMARY KEY NOT NULL,
uuid VARCHAR(36) NOT NULL, uuid VARCHAR(36) NOT NULL UNIQUE,
name VARCHAR(16) NOT NULL, name VARCHAR(16) NOT NULL,
location_x DOUBLE NOT NULL, location_x DOUBLE NOT NULL,
location_y DOUBLE NOT NULL, location_y DOUBLE NOT NULL,
@@ -9,3 +9,6 @@ CREATE TABLE IF NOT EXISTS players (
location_pitch FLOAT NOT NULL, location_pitch FLOAT NOT NULL,
location_world varchar(64) NOT NULL location_world varchar(64) NOT NULL
); );
CREATE INDEX idx_players_uuid ON players(uuid);
CREATE INDEX idx_players_name ON players(name);

View File

@@ -68,6 +68,8 @@ public class TestDAO {
@Before @Before
public void init() throws IOException { public void init() throws IOException {
jdbcTemplate.execute("DROP INDEX IF EXISTS idx_players_uuid;");
jdbcTemplate.execute("DROP INDEX IF EXISTS idx_players_name;");
jdbcTemplate.execute("DROP TABLE IF EXISTS players;"); jdbcTemplate.execute("DROP TABLE IF EXISTS players;");
jdbcTemplate.execute(IOUtils.resourceToString("/sqls/create_tables.sql", StandardCharsets.UTF_8)); jdbcTemplate.execute(IOUtils.resourceToString("/sqls/create_tables.sql", StandardCharsets.UTF_8));
createPlayer(); createPlayer();