Skip to content

Instantly share code, notes, and snippets.

@sevlyar
sevlyar / migration.sql
Created August 26, 2016 13:18
Add postgresql enum's element in transaction
-- rename the old enum
ALTER TYPE country_code RENAME TO country_code__;
-- create the new enum with the old name
CREATE TYPE country_code AS ENUM ('DE', 'AT', 'NL', 'CH');
-- ALTER all you enum columns
ALTER TABLE user_address
ALTER COLUMN country DROP DEFAULT;
ALTER TABLE user_address
@sevlyar
sevlyar / domains.js
Created April 17, 2015 03:13
Test events for EventEmitter created in domain
var domain = require("domain");
var events = require("events");
var EventEmitter = events.EventEmitter;
function suite(dispose, createInDomain) {
console.log("\n\n=== suite\n dispose d1 after error: %s\n create EventEmitter in d1 (otherwise outside): %s", dispose, createInDomain);
var d1 = domain.create();
var d2 = domain.create();
var ee = null;