Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add dynamodb support #28

Merged
merged 3 commits into from
Nov 26, 2018
Merged

add dynamodb support #28

merged 3 commits into from
Nov 26, 2018

Conversation

ccbrown
Copy link
Owner

@ccbrown ccbrown commented Nov 26, 2018

The tracker is going ✨serverless✨.

The goal is more effective cost and scalability.

@ccbrown
Copy link
Owner Author

ccbrown commented Nov 26, 2018

For posterity, migrating from a DB file to a DynamoDB table can be done like so:

func migrate() {
	config, err := external.LoadDefaultAWSConfig()
	if err != nil {
		log.Fatal(err)
	}
	dest, err := server.NewDynamoDBDatabase(dynamodb.New(config), viper.GetString("dynamodb-table"))
	if err != nil {
		log.Fatal(err)
	}
	defer dest.Close()
	source, err := server.NewBoltDatabase(viper.GetString("db"))
	if err != nil {
		log.Fatal(err)
	}
	defer source.Close()

	for _, locale := range server.Locales {
		activity, _, err := source.Activity(locale, "", 1000000000000000000)
		if err != nil {
			log.Fatal(err)
		}
		if err := dest.AddActivity(activity); err != nil {
			log.Fatal(err)
		}
	}
}

@ccbrown ccbrown merged commit 5ed72da into master Nov 26, 2018
@ccbrown ccbrown deleted the dynamodb branch November 26, 2018 04:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant