chore: add users migration

pull/2572/head
Luke Edwards 7 years ago
parent 2eacc359a4
commit e8adc9c0ab

@ -1,6 +1,8 @@
NODE_ENV=
PORT=
BASEURL=
DATABASE_URL=
GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
MAPBOX_ACCESS_TOKEN=

@ -0,0 +1,23 @@
exports.up = DB => {
DB.sql(`
create table if not exists users (
id serial primary key,
uid character varying(255) not null unique,
name character varying(255),
username character varying(255) not null,
avatar text,
token character varying(255) not null
);
create unique index if not exists users_pkey ON users(id int4_ops);
create unique index if not exists users_uid_key ON users(uid text_ops);
`);
};
exports.down = DB => {
DB.sql(`
drop table if exists users cascade;
drop index if exists users_uid_key;
drop index if exists users_pkey;
`);
};

@ -4,6 +4,7 @@
"description": "Docs and examples for Svelte",
"scripts": {
"dev": "sapper dev",
"migrate": "node-pg-migrate -r dotenv/config",
"sapper": "sapper build --legacy && npm run update_shimport",
"update_shimport": "cp node_modules/shimport/index.js __sapper__/build/client/shimport@0.0.14.js",
"update": "node scripts/update_template.js && node scripts/get-contributors.js",
@ -38,6 +39,7 @@
"esm": "^3.2.22",
"jimp": "^0.6.0",
"mocha": "^6.1.3",
"node-pg-migrate": "^3.18.1",
"npm-run-all": "^4.1.5",
"rollup": "^1.2.2",
"rollup-plugin-babel": "^4.3.2",

Loading…
Cancel
Save