Skip to content

Commit

Permalink
4.0.0: pynamo==3.2.1 boolean migration (#170)
Browse files Browse the repository at this point in the history
  • Loading branch information
vivianho authored Mar 30, 2018
1 parent 81fda7d commit b5f4f17
Show file tree
Hide file tree
Showing 9 changed files with 348 additions and 8 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 4.0.0

* This is a breaking release. This change upgrades the `LegacyBooleanAttributes`
to `BooleanAttributes`, which saves data in a new format. Once you upgrade
to this version, you must run the migrate\_bool\_attribute maintenance
script immediately after upgrading, which will convert all old data into
the new format and prevent further issues with Pynamo upgrades.

## 3.0.0

* This is a breaking release, if you're using blind credentials. This change
Expand Down
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
FROM ubuntu:trusty
MAINTAINER Ryan Lane <[email protected]>

RUN apt-get update && \
apt-get install -y curl && \
curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
RUN apt-get update && \
# For frontend
apt-get install -y ruby-full npm nodejs nodejs-legacy git git-core && \
apt-get install -y ruby-full nodejs git git-core && \
# For backend
apt-get install -y python python-pip python-dev build-essential libffi-dev \
libxml2-dev libxmlsec1-dev
Expand Down
4 changes: 2 additions & 2 deletions confidant/models/blind_credential.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from pynamodb.attributes import (
UnicodeAttribute,
NumberAttribute,
LegacyBooleanAttribute,
BooleanAttribute,
UTCDateTimeAttribute,
JSONAttribute
)
Expand Down Expand Up @@ -43,7 +43,7 @@ class Meta:
name = UnicodeAttribute()
credential_pairs = JSONAttribute()
credential_keys = NonNullUnicodeSetAttribute(default=set([]), null=True)
enabled = LegacyBooleanAttribute(default=True)
enabled = BooleanAttribute(default=True)
data_key = JSONAttribute()
cipher_version = NumberAttribute()
cipher_type = UnicodeAttribute()
Expand Down
4 changes: 2 additions & 2 deletions confidant/models/credential.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from pynamodb.attributes import (
UnicodeAttribute,
NumberAttribute,
LegacyBooleanAttribute,
BooleanAttribute,
UTCDateTimeAttribute,
BinaryAttribute,
JSONAttribute
Expand Down Expand Up @@ -40,7 +40,7 @@ class Meta:
data_type_date_index = DataTypeDateIndex()
name = UnicodeAttribute()
credential_pairs = UnicodeAttribute()
enabled = LegacyBooleanAttribute(default=True)
enabled = BooleanAttribute(default=True)
data_key = BinaryAttribute()
# TODO: add cipher_type
cipher_version = NumberAttribute(null=True)
Expand Down
4 changes: 2 additions & 2 deletions confidant/models/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
UnicodeAttribute,
NumberAttribute,
UTCDateTimeAttribute,
LegacyBooleanAttribute
BooleanAttribute
)
from pynamodb.indexes import GlobalSecondaryIndex, AllProjection

Expand Down Expand Up @@ -39,7 +39,7 @@ class Meta:
data_type = UnicodeAttribute()
data_type_date_index = DataTypeDateIndex()
revision = NumberAttribute()
enabled = LegacyBooleanAttribute(default=True)
enabled = BooleanAttribute(default=True)
credentials = NonNullUnicodeSetAttribute(default=set())
blind_credentials = NonNullUnicodeSetAttribute(default=set())
account = UnicodeAttribute(null=True)
Expand Down
3 changes: 3 additions & 0 deletions confidant/scripts/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
MigrateBlindCredentialSetAttribute,
MigrateServiceSetAttribute,
)
from confidant.scripts.migrate_bool import MigrateBooleanAttribute

manager = Manager(app.app)

Expand All @@ -33,6 +34,8 @@
MigrateBlindCredentialSetAttribute)
manager.add_command("migrate_service_set_attribute",
MigrateServiceSetAttribute)
manager.add_command("migrate_boolean_attribute",
MigrateBooleanAttribute)


def main():
Expand Down
Loading

0 comments on commit b5f4f17

Please sign in to comment.