DO $$
DECLARE
 version_new_ CONSTANT integer := 1;-- new version number --
 ver_ integer;
BEGIN
  LOCK TABLE variables;
  SELECT version_is('Ls') INTO ver_;
  IF ver_ < version_new_ THEN
    -- begin update --

-- Table: station_type

-- DROP TABLE station_type;

CREATE TABLE station_type
(
  _id bigserial NOT NULL,
  name text NOT NULL,
  descr text,
  endpoint text NOT NULL,
  cpu_arch text,
  os_name text,
  os_version text,
  valid_from timestamp with time zone,
  valid_to timestamp with time zone,
  CONSTRAINT station_type_pkey PRIMARY KEY (_id)
)
WITH (
  OIDS=FALSE
);
ALTER TABLE station_type
  OWNER TO su;

INSERT INTO station_type (name, descr, endpoint, cpu_arch, os_name, os_version) VALUES ('G', 'RPi CM v1.0', 'debug', 'armv7l', 'Raspbian', '8.0');

    -- end update --
    PERFORM version_set('Ls', version_new_);
  END IF;
END$$;