SCHEMA_STATEMENTS = [ ''' create table if not exists localities ( id integer not null primary key, name varchar(255) not null ); ''', ''' create table if not exists locality_relationships ( id varchar(255) not null primary key, parent integer not null, child integer not null ) ''', ''' create table if not exists search_results ( id integer not null primary key, time datetime not null, property_id integer not null, price varchar(255) not null, raw_json text ) ''', ''' create table if not exists properties ( id integer not null primary key, last_update datetime not null, raw_json text not null ) ''', 'alter table properties add column processed tinyint default 0 not null;', 'alter table properties add column price integer;', 'alter table properties add column lat float;', 'alter table properties add column lon float;', 'alter table properties add column size;', 'alter table properties add column ber varchar(255);', 'drop table properties;', ''' create table properties ( id integer not null primary key, last_update datetime not null, raw_json text, processed tinyint default 0 not null, price integer, lat float, lon float, size integer, ber varchar(255) ) ''', 'alter table properties add column address varchar(1023)', 'alter table properties add column locality_id integer', 'alter table properties add column property_type varchar(255)', 'alter table properties add column bathrooms integer', 'alter table properties add column bedrooms integer', ''' create table property_locality_map ( id varchar(255) primary key not null, property_id integer not null, locality_id integer not null ) ''', 'alter table search_results add column search_locality_id integer', ''' create table transit ( id varchar(256) not null primary key, mode varchar(128) not null, submode varchar(128), description varchar(255), src_lat float not null, src_lon float not null, dest_lat float not null, dest_lon float not null, distance integer not null, duration integer not null, time DATETIME, raw_json text ) ''', ''' create table if not exists annotations ( id integer not null primary key, favourited tinyint default 0 not null, update_ts datetime not null ) ''', 'alter table properties add column tmp_id integer', ]