object migration script
This commit is contained in:
parent
ac0e0ff94d
commit
8dd19ce491
@ -18,7 +18,7 @@ type Tile struct {
|
|||||||
|
|
||||||
type MapObject struct {
|
type MapObject struct {
|
||||||
//mapblock position
|
//mapblock position
|
||||||
MBPos coords.MapBlockCoords
|
MBPos *coords.MapBlockCoords
|
||||||
|
|
||||||
//block position
|
//block position
|
||||||
X, Y, Z int
|
X, Y, Z int
|
||||||
@ -26,6 +26,7 @@ type MapObject struct {
|
|||||||
Type string
|
Type string
|
||||||
Data string
|
Data string
|
||||||
Mtime int64
|
Mtime int64
|
||||||
|
Attributes map[string]string
|
||||||
}
|
}
|
||||||
|
|
||||||
type SearchQuery struct {
|
type SearchQuery struct {
|
||||||
|
@ -8,6 +8,10 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const migrateScript = `
|
const migrateScript = `
|
||||||
|
PRAGMA foreign_keys = ON;
|
||||||
|
PRAGMA journal_mode = MEMORY;
|
||||||
|
-- PRAGMA synchronous = OFF;
|
||||||
|
|
||||||
create table if not exists objects(
|
create table if not exists objects(
|
||||||
id integer primary key autoincrement,
|
id integer primary key autoincrement,
|
||||||
x int,
|
x int,
|
||||||
@ -24,6 +28,14 @@ create table if not exists objects(
|
|||||||
create index if not exists objects_pos on objects(posx,posy,posz);
|
create index if not exists objects_pos on objects(posx,posy,posz);
|
||||||
create index if not exists objects_pos_type on objects(posx,posy,posz,type);
|
create index if not exists objects_pos_type on objects(posx,posy,posz,type);
|
||||||
|
|
||||||
|
create table if not exists object_attributes(
|
||||||
|
id integer primary key autoincrement,
|
||||||
|
objectid integer not null,
|
||||||
|
key varchar not null,
|
||||||
|
value varchar not null,
|
||||||
|
FOREIGN KEY (objectid) references objects(id) ON DELETE CASCADE
|
||||||
|
);
|
||||||
|
|
||||||
create table if not exists tiles(
|
create table if not exists tiles(
|
||||||
data blob,
|
data blob,
|
||||||
mtime bigint,
|
mtime bigint,
|
||||||
@ -33,9 +45,6 @@ create table if not exists tiles(
|
|||||||
zoom int,
|
zoom int,
|
||||||
primary key(x,y,zoom,layerid)
|
primary key(x,y,zoom,layerid)
|
||||||
);
|
);
|
||||||
|
|
||||||
-- PRAGMA synchronous = OFF;
|
|
||||||
-- PRAGMA journal_mode = MEMORY;
|
|
||||||
`
|
`
|
||||||
|
|
||||||
type Sqlite3Accessor struct {
|
type Sqlite3Accessor struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user