Skip to content

Instantly share code, notes, and snippets.

@ehogberg
Created December 12, 2013 20:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ehogberg/7935296 to your computer and use it in GitHub Desktop.
Save ehogberg/7935296 to your computer and use it in GitHub Desktop.
Proposed schema for company location model
CREATE TABLE locations (
id integer NOT NULL,
company_id integer,
name character varying(255),
legacy_url text,
address1 character varying(255),
address2 character varying(255),
city character varying(255),
region character varying(255),
country character varying(255),
postcode character varying(255),
telephone character varying(255),
manager_name character varying(255),
created_at timestamp without time zone,
updated_at timestamp without time zone
);
@deanrad
Copy link

deanrad commented Dec 12, 2013

see branch db-hygiene for some code relating to timestamps (should upgrade your schema to timezone columns
automagically)

@jhirn
Copy link

jhirn commented Dec 12, 2013

I don't think timestamptz is desired as it does funny things depending on the local where you are querying/inserting from. See this link on how timezone conversion takes place.

http://www.postgresql.org/docs/9.3/static/functions-datetime.html#FUNCTIONS-DATETIME-ZONECONVERT-TABLE

See this excellent post on the differences.

http://stackoverflow.com/questions/9571392/ignoring-timezones-altogether-in-rails-and-postgresql

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment