Skip to content

Instantly share code, notes, and snippets.

@Sebdevar
Sebdevar / change_primary_key.md
Created December 21, 2020 15:57 — forked from scaryguy/change_primary_key.md
How to change PRIMARY KEY of an existing PostgreSQL table?
-- Firstly, remove PRIMARY KEY attribute of former PRIMARY KEY
ALTER TABLE <table_name> DROP CONSTRAINT <table_name>_pkey;
-- Then change column name of  your PRIMARY KEY and PRIMARY KEY candidates properly.
ALTER TABLE <table_name> RENAME COLUMN <primary_key_candidate> TO id;
@Sebdevar
Sebdevar / MockFile.js
Last active October 19, 2020 20:32 — forked from josephhanson/MockFile.js
Test Utility function that creates a mock file with specified name, size and MIMETYPE
/**
* Creates a file containing the requested parameters.
*
* @param {string} name The name of the file, including the extension.
* @param {number} size The file's size in bytes.
* @param {string} mimeType The file's MIMETYPE, @see {@link https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types}
*/
export const createMockFile = (name?: string, size?: number, mimeType?: string): File => {
const fileName = name || 'mock.txt';
const fileSize = size || 1024;