DB migrations without any adapter or ORM layer needed
Following a simplified version of the series by K. Scott Allen: http://blog.codinghorror.com/get-your-database-under-version-control/
With rollbacks added in.
#!/bin/env python | |
import sys | |
import re | |
from argparse import ArgumentParser | |
WORD_SPLIT = re.compile('[^a-zA-Z0-9]+') | |
FIRST_ALPHA = re.compile('^[a-zA-Z]') | |
def render(args,typename,values): |
type Page | |
= Search Page.Search.Model | |
type alias Model = | |
{ page : Page | |
, session : Session | |
} | |
type Msg |
import dramatiq | |
@dramatiq.actor | |
def sequence(environ, sequence, environ_key=None, result_key=None): | |
""" could be anything, just used to kick off a sequence """ | |
return { | |
u'environ': environ, | |
u'count': len(sequence) | |
} |
-- update triggered by browser URL change | |
updatePage : Pages.Page -> Model -> (Model, Cmd Msg) | |
updatePage page model = | |
let | |
(valueTypesStatus, valueTypesTask) = | |
if isLoadedValueTypes model then | |
( model.valueTypes |
module Validation | |
exposing | |
( ValidationResult(..) | |
, map, mapMessage, andThen, andMap, succeed | |
, withDefault | |
, fromMaybeInitial, fromMaybe, toMaybe | |
, fromResultInitial, fromResult | |
, toString, message, isValid, isInvalid | |
, validate | |
) |
module AutocompleteIDList exposing (..) | |
{- | |
Adapted from https://github.com/thebritican/elm-autocomplete/blob/master/examples/src/AccessibleExample.elm | |
**Work in Progress** | |
Note that the underlying items must be `List (id,item)` | |
and `selectedItem` is `Maybe id` . | |
import Html exposing (Html, div, button, text) | |
import Html.Attributes as Attr | |
import Html.Events as Evt | |
import Html.App exposing (beginnerProgram) | |
import Html.Events exposing (onClick) | |
import Json.Decode as Json | |
import String | |
sample : Person |
""" | |
Derived from [fn.py](https://github.com/kachayev/fn.py) function 'curried' | |
Amended to fix wrapping error: cf. https://github.com/kachayev/fn.py/pull/75 | |
Copyright 2013 Alexey Kachayev | |
Under the Apache License, Version 2.0 | |
http://www.apache.org/licenses/LICENSE-2.0 | |
""" |
#!/usr/bin/env sh | |
# loosely based on http://pastebin/D8y7prYV, except with windows not sessions | |
if [ ${#} -eq 3 ]; then | |
echo "You need to provide both a session and path" 2>&1 | |
exit 1 | |
fi | |
sess=${1} |
DB migrations without any adapter or ORM layer needed
Following a simplified version of the series by K. Scott Allen: http://blog.codinghorror.com/get-your-database-under-version-control/
With rollbacks added in.