Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Commit

Permalink
Start #3207, add a size column to the images table (#3236)
Browse files Browse the repository at this point in the history
This does not make use of the column, but puts it in place for future use
Also update schema.sql given a backlog of changes
  • Loading branch information
ianb authored and jaredhirsch committed Jul 28, 2017
1 parent b2258d1 commit 07ba77c
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
1 change: 1 addition & 0 deletions server/db-patches/patch-17-18.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE images ADD COLUMN size INT DEFAULT NULL;
1 change: 1 addition & 0 deletions server/db-patches/patch-18-17.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE images DROP COLUMN size;
22 changes: 15 additions & 7 deletions server/schema.sql
Original file line number Diff line number Diff line change
@@ -1,23 +1,30 @@
CREATE TYPE shot_block_type AS ENUM (
'none',
'dmca'
);
ALTER TYPE shot_block_type OWNER TO ianbicking;
CREATE TABLE accounts (
id character varying(200) NOT NULL,
token text
token text,
avatarurl text,
nickname text,
email text
);
CREATE TABLE data (
id character varying(120) NOT NULL,
deviceid character varying(200),
created timestamp without time zone DEFAULT now(),
value text NOT NULL,
url text NOT NULL,
url text,
expire_time timestamp without time zone DEFAULT (now() + '14 days'::interval),
deleted boolean DEFAULT false NOT NULL,
title text,
searchable_text tsvector,
searchable_version integer
searchable_version integer,
block_type shot_block_type DEFAULT 'none'::shot_block_type NOT NULL
);
CREATE TABLE devices (
id character varying(200) NOT NULL,
nickname text,
avatarurl text,
accountid character varying(200),
last_addon_version text,
last_login timestamp without time zone,
Expand All @@ -31,7 +38,8 @@ CREATE TABLE images (
shotid character varying(200) NOT NULL,
clipid character varying(200) NOT NULL,
contenttype text NOT NULL,
url text
url text,
size integer
);
CREATE TABLE metrics_cache (
created timestamp without time zone DEFAULT now(),
Expand Down Expand Up @@ -72,4 +80,4 @@ ALTER TABLE ONLY images
ADD CONSTRAINT images_shotid_fkey FOREIGN KEY (shotid) REFERENCES data(id) ON DELETE CASCADE;
ALTER TABLE ONLY states
ADD CONSTRAINT states_deviceid_fkey FOREIGN KEY (deviceid) REFERENCES devices(id) ON DELETE CASCADE;
-- pg-patch version: 14
-- pg-patch version: 18
4 changes: 3 additions & 1 deletion server/src/dbschema.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ const pgpatcher = require("pg-patcher");
const path = require("path");
const mozlog = require("./logging").mozlog("dbschema");

const MAX_DB_LEVEL = exports.MAX_DB_LEVEL = 17;
// When updating the database, please also run ./bin/dumpschema --record
// This updates schema.sql with the latest full database schema
const MAX_DB_LEVEL = exports.MAX_DB_LEVEL = 18;

exports.forceDbVersion = function(version) {
mozlog.info("forcing-db-version", {db: db.constr, version});
Expand Down

0 comments on commit 07ba77c

Please sign in to comment.