Skip to content

Instantly share code, notes, and snippets.

@charyorde
Last active December 28, 2015 10:19
Show Gist options
  • Save charyorde/7485159 to your computer and use it in GitHub Desktop.
Save charyorde/7485159 to your computer and use it in GitHub Desktop.
Create postgres table
CREATE TABLE jivevideoviewhistory
(
objectid integer NOT NULL,
objecttype integer NOT NULL,
dateviewed bigint NOT NULL,
viewcount bigint DEFAULT 0,
userid bigint,
expirydate bigint NOT NULL,
CONSTRAINT jivevideoviewhistory_pkey PRIMARY KEY (objectid, objecttype)
)
WITH (
OIDS=FALSE
);
ALTER TABLE jivevideoviewhistory
OWNER TO postgres;
// with autoincrement field
CREATE TABLE jivevideoviewhistory
(
viewhistid serial NOT NULL,
objectid bigint,
objecttype integer,
dateviewed bigint NOT NULL,
viewcount bigint NOT NULL,
userid bigint NOT NULL,
expirydate bigint NOT NULL
)
WITH (
OIDS=FALSE
);
ALTER TABLE
jivevideoviewhistory
OWNER TO postgres;
// stable
CREATE TABLE jivevideoviewhistory
(
viewhistid serial NOT NULL,
objectid bigint,
objecttype integer,
dateviewed bigint NOT NULL,
viewcount bigint NOT NULL,
userid bigint NOT NULL,
expirydate bigint NOT NULL,
CONSTRAINT jivevideoviewhistory_pkey PRIMARY KEY (viewhistid)
)
WITH (
OIDS=FALSE
);
ALTER TABLE jivevideoviewhistory
OWNER TO postgres;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment