db_schema.py 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. SCHEMA_STATEMENTS = [
  2. '''
  3. create table if not exists localities (
  4. id integer not null primary key,
  5. name varchar(255) not null
  6. );
  7. ''',
  8. '''
  9. create table if not exists locality_relationships (
  10. id varchar(255) not null primary key,
  11. parent integer not null,
  12. child integer not null
  13. )
  14. ''',
  15. '''
  16. create table if not exists search_results (
  17. id integer not null primary key,
  18. time datetime not null,
  19. property_id integer not null,
  20. price integer not null,
  21. raw_json text not null
  22. )
  23. ''',
  24. '''
  25. create table if not exists properties (
  26. id integer not null primary key,
  27. last_update datetime not null,
  28. raw_json text not null
  29. )
  30. ''',
  31. 'alter table properties add column processed tinyint default 0 not null;',
  32. 'alter table properties add column price integer;',
  33. 'alter table properties add column lat float;',
  34. 'alter table properties add column lon float;',
  35. 'alter table properties add column size;',
  36. 'alter table properties add column ber varchar(255);',
  37. ]